refactor: Use new hyprutils casts (#11377)
This commit is contained in:
parent
aa6a78f0a4
commit
beee22a95e
116 changed files with 715 additions and 696 deletions
|
|
@ -8,7 +8,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
|||
const auto PINHIBIT = m_idleInhibitors.emplace_back(makeUnique<SIdleInhibitor>()).get();
|
||||
PINHIBIT->inhibitor = std::any_cast<SP<CIdleInhibitor>>(inhibitor);
|
||||
|
||||
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", (uintptr_t)PINHIBIT->inhibitor->m_surface.get());
|
||||
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", rc<uintptr_t>(PINHIBIT->inhibitor->m_surface.get()));
|
||||
|
||||
PINHIBIT->inhibitor->m_listeners.destroy = PINHIBIT->inhibitor->m_resource->m_events.destroy.listen([this, PINHIBIT] {
|
||||
std::erase_if(m_idleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; });
|
||||
|
|
@ -89,7 +89,7 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
|
|||
return;
|
||||
|
||||
if (WLSurface->visible())
|
||||
*(bool*)data = true;
|
||||
*sc<bool*>(data) = true;
|
||||
},
|
||||
&isInhibiting);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ CInputManager::CInputManager() {
|
|||
if (wl_resource_get_client(event.pMgr->resource()) != g_pSeatManager->m_state.pointerFocusResource->client())
|
||||
return;
|
||||
|
||||
Debug::log(LOG, "cursorImage request: shape {} -> {}", (uint32_t)event.shape, event.shapeName);
|
||||
Debug::log(LOG, "cursorImage request: shape {} -> {}", sc<uint32_t>(event.shape), event.shapeName);
|
||||
|
||||
m_cursorSurfaceInfo.wlSurface->unassign();
|
||||
m_cursorSurfaceInfo.vHotspot = {};
|
||||
|
|
@ -113,11 +113,11 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
|
|||
const auto DELTA = *PNOACCEL == 1 ? unaccel : delta;
|
||||
|
||||
if (g_pSeatManager->m_isPointerFrameSkipped)
|
||||
g_pPointerManager->storeMovement((uint64_t)e.timeMs, DELTA, unaccel);
|
||||
g_pPointerManager->storeMovement(e.timeMs, DELTA, unaccel);
|
||||
else
|
||||
g_pPointerManager->setStoredMovement((uint64_t)e.timeMs, DELTA, unaccel);
|
||||
g_pPointerManager->setStoredMovement(e.timeMs, DELTA, unaccel);
|
||||
|
||||
PROTO::relativePointer->sendRelativeMotion((uint64_t)e.timeMs * 1000, DELTA, unaccel);
|
||||
PROTO::relativePointer->sendRelativeMotion(sc<uint64_t>(e.timeMs) * 1000, DELTA, unaccel);
|
||||
|
||||
if (e.mouse)
|
||||
recheckMouseWarpOnMouseInput();
|
||||
|
|
@ -236,13 +236,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
g_pCompositor->warpCursorTo(CLOSEST, true);
|
||||
g_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL);
|
||||
PROTO::relativePointer->sendRelativeMotion((uint64_t)time * 1000, {}, {});
|
||||
PROTO::relativePointer->sendRelativeMotion(sc<uint64_t>(time) * 1000, {}, {});
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
} else
|
||||
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", (uintptr_t)SURF.get(), (uintptr_t)CONSTRAINT.get());
|
||||
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", rc<uintptr_t>(SURF.get()), rc<uintptr_t>(CONSTRAINT.get()));
|
||||
}
|
||||
|
||||
if (PMONITOR != g_pCompositor->m_lastMonitor && (*PMOUSEFOCUSMON || refocus) && m_forcedFocus.expired())
|
||||
|
|
@ -644,7 +644,7 @@ void CInputManager::processMouseRequest(const CSeatManager::SSetCursorEvent& eve
|
|||
if (!cursorImageUnlocked())
|
||||
return;
|
||||
|
||||
Debug::log(LOG, "cursorImage request: surface {:x}", (uintptr_t)event.surf.get());
|
||||
Debug::log(LOG, "cursorImage request: surface {:x}", rc<uintptr_t>(event.surf.get()));
|
||||
|
||||
if (event.surf != m_cursorSurfaceInfo.wlSurface->resource()) {
|
||||
m_cursorSurfaceInfo.wlSurface->unassign();
|
||||
|
|
@ -937,7 +937,7 @@ void CInputManager::newKeyboard(SP<IKeyboard> keeb) {
|
|||
|
||||
setupKeyboard(PNEWKEYBOARD);
|
||||
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: {:x}", (uintptr_t)PNEWKEYBOARD.get());
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: {:x}", rc<uintptr_t>(PNEWKEYBOARD.get()));
|
||||
}
|
||||
|
||||
void CInputManager::newKeyboard(SP<Aquamarine::IKeyboard> keyboard) {
|
||||
|
|
@ -945,7 +945,7 @@ void CInputManager::newKeyboard(SP<Aquamarine::IKeyboard> keyboard) {
|
|||
|
||||
setupKeyboard(PNEWKEYBOARD);
|
||||
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: {:x} and AQ: {:x}", (uintptr_t)PNEWKEYBOARD.get(), (uintptr_t)keyboard.get());
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: {:x} and AQ: {:x}", rc<uintptr_t>(PNEWKEYBOARD.get()), rc<uintptr_t>(keyboard.get()));
|
||||
}
|
||||
|
||||
void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keyboard) {
|
||||
|
|
@ -953,7 +953,7 @@ void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keyboard)
|
|||
|
||||
setupKeyboard(PNEWKEYBOARD);
|
||||
|
||||
Debug::log(LOG, "New virtual keyboard created at {:x}", (uintptr_t)PNEWKEYBOARD.get());
|
||||
Debug::log(LOG, "New virtual keyboard created at {:x}", rc<uintptr_t>(PNEWKEYBOARD.get()));
|
||||
}
|
||||
|
||||
void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
||||
|
|
@ -974,7 +974,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||
return;
|
||||
|
||||
destroyKeyboard(PKEEB);
|
||||
Debug::log(LOG, "Destroyed keyboard {:x}", (uintptr_t)keeb);
|
||||
Debug::log(LOG, "Destroyed keyboard {:x}", rc<uintptr_t>(keeb));
|
||||
});
|
||||
|
||||
keeb->m_keyboardEvents.key.listenStatic([this, keeb = keeb.get()](const IKeyboard::SKeyEvent& event) {
|
||||
|
|
@ -1035,7 +1035,7 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) {
|
|||
|
||||
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
||||
|
||||
Debug::log(LOG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", devname, (int)HASCONFIG);
|
||||
Debug::log(LOG, "ApplyConfigToKeyboard for \"{}\", hasconfig: {}", devname, sc<int>(HASCONFIG));
|
||||
|
||||
const auto REPEATRATE = g_pConfigManager->getDeviceInt(devname, "repeat_rate", "input:repeat_rate");
|
||||
const auto REPEATDELAY = g_pConfigManager->getDeviceInt(devname, "repeat_delay", "input:repeat_delay");
|
||||
|
|
@ -1119,7 +1119,7 @@ void CInputManager::newMouse(SP<Aquamarine::IPointer> mouse) {
|
|||
|
||||
setupMouse(PMOUSE);
|
||||
|
||||
Debug::log(LOG, "New mouse created, pointer AQ: {:x}", (uintptr_t)mouse.get());
|
||||
Debug::log(LOG, "New mouse created, pointer AQ: {:x}", rc<uintptr_t>(mouse.get()));
|
||||
}
|
||||
|
||||
void CInputManager::setupMouse(SP<IPointer> mauz) {
|
||||
|
|
@ -1135,8 +1135,8 @@ void CInputManager::setupMouse(SP<IPointer> mauz) {
|
|||
const auto LIBINPUTDEV = mauz->aq()->getLibinputHandle();
|
||||
|
||||
Debug::log(LOG, "New mouse has libinput sens {:.2f} ({:.2f}) with accel profile {} ({})", libinput_device_config_accel_get_speed(LIBINPUTDEV),
|
||||
libinput_device_config_accel_get_default_speed(LIBINPUTDEV), (int)libinput_device_config_accel_get_profile(LIBINPUTDEV),
|
||||
(int)libinput_device_config_accel_get_default_profile(LIBINPUTDEV));
|
||||
libinput_device_config_accel_get_default_speed(LIBINPUTDEV), sc<int>(libinput_device_config_accel_get_profile(LIBINPUTDEV)),
|
||||
sc<int>(libinput_device_config_accel_get_default_profile(LIBINPUTDEV)));
|
||||
}
|
||||
|
||||
g_pPointerManager->attachPointer(mauz);
|
||||
|
|
@ -1223,7 +1223,7 @@ void CInputManager::setPointerConfigs() {
|
|||
|
||||
const auto TAP_DRAG_LOCK = g_pConfigManager->getDeviceInt(devname, "drag_lock", "input:touchpad:drag_lock");
|
||||
if (TAP_DRAG_LOCK >= 0 && TAP_DRAG_LOCK <= 2) {
|
||||
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, static_cast<libinput_config_drag_lock_state>(TAP_DRAG_LOCK));
|
||||
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, sc<libinput_config_drag_lock_state>(TAP_DRAG_LOCK));
|
||||
}
|
||||
|
||||
if (libinput_device_config_tap_get_finger_count(LIBINPUTDEV)) // this is for tapping (like on a laptop)
|
||||
|
|
@ -1241,13 +1241,12 @@ void CInputManager::setPointerConfigs() {
|
|||
}
|
||||
|
||||
if (libinput_device_config_3fg_drag_get_finger_count(LIBINPUTDEV) >= 3) {
|
||||
const auto DRAG_3FG_STATE = static_cast<libinput_config_3fg_drag_state>(g_pConfigManager->getDeviceInt(devname, "drag_3fg", "input:touchpad:drag_3fg"));
|
||||
const auto DRAG_3FG_STATE = sc<libinput_config_3fg_drag_state>(g_pConfigManager->getDeviceInt(devname, "drag_3fg", "input:touchpad:drag_3fg"));
|
||||
libinput_device_config_3fg_drag_set_enabled(LIBINPUTDEV, DRAG_3FG_STATE);
|
||||
}
|
||||
|
||||
if (libinput_device_config_dwt_is_available(LIBINPUTDEV)) {
|
||||
const auto DWT =
|
||||
static_cast<enum libinput_config_dwt_state>(g_pConfigManager->getDeviceInt(devname, "disable_while_typing", "input:touchpad:disable_while_typing") != 0);
|
||||
const auto DWT = sc<enum libinput_config_dwt_state>(g_pConfigManager->getDeviceInt(devname, "disable_while_typing", "input:touchpad:disable_while_typing") != 0);
|
||||
libinput_device_config_dwt_set_enabled(LIBINPUTDEV, DWT);
|
||||
}
|
||||
|
||||
|
|
@ -1319,7 +1318,7 @@ static void removeFromHIDs(WP<IHID> hid) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) {
|
||||
Debug::log(LOG, "Keyboard at {:x} removed", (uintptr_t)pKeyboard.get());
|
||||
Debug::log(LOG, "Keyboard at {:x} removed", rc<uintptr_t>(pKeyboard.get()));
|
||||
|
||||
std::erase_if(m_keyboards, [pKeyboard](const auto& other) { return other == pKeyboard; });
|
||||
|
||||
|
|
@ -1343,7 +1342,7 @@ void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyPointer(SP<IPointer> mouse) {
|
||||
Debug::log(LOG, "Pointer at {:x} removed", (uintptr_t)mouse.get());
|
||||
Debug::log(LOG, "Pointer at {:x} removed", rc<uintptr_t>(mouse.get()));
|
||||
|
||||
std::erase_if(m_pointers, [mouse](const auto& other) { return other == mouse; });
|
||||
|
||||
|
|
@ -1356,7 +1355,7 @@ void CInputManager::destroyPointer(SP<IPointer> mouse) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyTouchDevice(SP<ITouch> touch) {
|
||||
Debug::log(LOG, "Touch device at {:x} removed", (uintptr_t)touch.get());
|
||||
Debug::log(LOG, "Touch device at {:x} removed", rc<uintptr_t>(touch.get()));
|
||||
|
||||
std::erase_if(m_touches, [touch](const auto& other) { return other == touch; });
|
||||
|
||||
|
|
@ -1364,7 +1363,7 @@ void CInputManager::destroyTouchDevice(SP<ITouch> touch) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyTablet(SP<CTablet> tablet) {
|
||||
Debug::log(LOG, "Tablet device at {:x} removed", (uintptr_t)tablet.get());
|
||||
Debug::log(LOG, "Tablet device at {:x} removed", rc<uintptr_t>(tablet.get()));
|
||||
|
||||
std::erase_if(m_tablets, [tablet](const auto& other) { return other == tablet; });
|
||||
|
||||
|
|
@ -1372,7 +1371,7 @@ void CInputManager::destroyTablet(SP<CTablet> tablet) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyTabletTool(SP<CTabletTool> tool) {
|
||||
Debug::log(LOG, "Tablet tool at {:x} removed", (uintptr_t)tool.get());
|
||||
Debug::log(LOG, "Tablet tool at {:x} removed", rc<uintptr_t>(tool.get()));
|
||||
|
||||
std::erase_if(m_tabletTools, [tool](const auto& other) { return other == tool; });
|
||||
|
||||
|
|
@ -1380,7 +1379,7 @@ void CInputManager::destroyTabletTool(SP<CTabletTool> tool) {
|
|||
}
|
||||
|
||||
void CInputManager::destroyTabletPad(SP<CTabletPad> pad) {
|
||||
Debug::log(LOG, "Tablet pad at {:x} removed", (uintptr_t)pad.get());
|
||||
Debug::log(LOG, "Tablet pad at {:x} removed", rc<uintptr_t>(pad.get()));
|
||||
|
||||
std::erase_if(m_tabletPads, [pad](const auto& other) { return other == pad; });
|
||||
|
||||
|
|
@ -1674,7 +1673,7 @@ void CInputManager::newTouchDevice(SP<Aquamarine::ITouch> pDevice) {
|
|||
destroyTouchDevice(PDEV);
|
||||
});
|
||||
|
||||
Debug::log(LOG, "New touch device added at {:x}", (uintptr_t)PNEWDEV.get());
|
||||
Debug::log(LOG, "New touch device added at {:x}", rc<uintptr_t>(PNEWDEV.get()));
|
||||
}
|
||||
|
||||
void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ void CInputPopup::updateBox() {
|
|||
if (!cursorRect) {
|
||||
Vector2D coords = OWNER ? OWNER->getSurfaceBoxGlobal().value_or(CBox{0, 0, 500, 500}).pos() : Vector2D{0, 0};
|
||||
parentBox = {coords, {500, 500}};
|
||||
cursorBoxParent = {0, 0, (int)parentBox.w, (int)parentBox.h};
|
||||
cursorBoxParent = {0, 0, sc<int>(parentBox.w), sc<int>(parentBox.h)};
|
||||
}
|
||||
|
||||
Vector2D currentPopupSize = m_surface->getViewporterCorrectedSize() / m_surface->resource()->m_current.scale;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void CInputManager::endWorkspaceSwipe() {
|
|||
// commit
|
||||
auto workspaceIDLeft = getWorkspaceIDNameFromString((*PSWIPEUSER ? "r-1" : "m-1")).id;
|
||||
auto workspaceIDRight = getWorkspaceIDNameFromString((*PSWIPEUSER ? "r+1" : "m+1")).id;
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, sc<int64_t>(1LL), sc<int64_t>(UINT32_MAX));
|
||||
|
||||
// If we've been swiping off the right end with PSWIPENEW enabled, there is
|
||||
// no workspace there yet, and we need to choose an ID for a new one now.
|
||||
|
|
@ -213,7 +213,7 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
|
|||
static auto PSWIPEUSER = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_use_r");
|
||||
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
||||
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, sc<int64_t>(1LL), sc<int64_t>(UINT32_MAX));
|
||||
const auto XDISTANCE = m_activeSwipe.pMonitor->m_size.x + *PWORKSPACEGAP;
|
||||
const auto YDISTANCE = m_activeSwipe.pMonitor->m_size.y + *PWORKSPACEGAP;
|
||||
const auto ANIMSTYLE = m_activeSwipe.pWorkspaceBegin->m_renderOffset->getStyle();
|
||||
|
|
@ -234,7 +234,7 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
|
|||
|
||||
m_activeSwipe.pWorkspaceBegin->m_forceRendering = true;
|
||||
|
||||
m_activeSwipe.delta = std::clamp(m_activeSwipe.delta, (double)-SWIPEDISTANCE, (double)SWIPEDISTANCE);
|
||||
m_activeSwipe.delta = std::clamp(m_activeSwipe.delta, sc<double>(-SWIPEDISTANCE), sc<double>(SWIPEDISTANCE));
|
||||
|
||||
if ((m_activeSwipe.pWorkspaceBegin->m_id == workspaceIDLeft && *PSWIPENEW && (m_activeSwipe.delta < 0)) ||
|
||||
(m_activeSwipe.delta > 0 && m_activeSwipe.pWorkspaceBegin->getWindows() == 0 && workspaceIDRight <= m_activeSwipe.pWorkspaceBegin->m_id) ||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ void CTextInput::commitStateToIME(SP<CInputMethodV2> ime) {
|
|||
ime->textChangeCause(ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
|
||||
|
||||
if (m_v1Input->m_pendingContentType.isPending)
|
||||
ime->textContentType((zwpTextInputV3ContentHint)INPUT->m_pendingContentType.hint, (zwpTextInputV3ContentPurpose)INPUT->m_pendingContentType.purpose);
|
||||
ime->textContentType(sc<zwpTextInputV3ContentHint>(INPUT->m_pendingContentType.hint), sc<zwpTextInputV3ContentPurpose>(INPUT->m_pendingContentType.purpose));
|
||||
}
|
||||
|
||||
g_pInputManager->m_relay.updateAllPopups();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
|||
|
||||
static auto PSWIPETOUCH = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch");
|
||||
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
|
||||
auto* const PGAPSOUT = (CCssGapData*)(PGAPSOUTDATA.ptr())->getData();
|
||||
auto* const PGAPSOUT = sc<CCssGapData*>((PGAPSOUTDATA.ptr())->getData());
|
||||
// TODO: WORKSPACERULE.gapsOut.value_or()
|
||||
auto gapsOut = *PGAPSOUT;
|
||||
static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size");
|
||||
|
|
@ -126,7 +126,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
|
|||
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
|
||||
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch_invert");
|
||||
static auto PSWIPEDIST = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_distance");
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
|
||||
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, sc<int64_t>(1LL), sc<int64_t>(UINT32_MAX));
|
||||
// Handle the workspace swipe if there is one
|
||||
if (m_activeSwipe.initialDirection == -1) {
|
||||
if (*PSWIPEINVR)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue