From f044e4c9514ec89c4c1fc8a523ca90b8cb907fb7 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 19 Oct 2024 23:03:29 +0100 Subject: internal: Move CMonitor to SP (#8178) * move monitors to sp * XD --- src/managers/input/InputManager.cpp | 10 +++++----- src/managers/input/InputManager.hpp | 2 +- src/managers/input/InputMethodPopup.cpp | 6 +++--- src/managers/input/Swipe.cpp | 10 +++++----- src/managers/input/Touch.cpp | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/managers/input') diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index eef5e040..196f0b71 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -172,7 +172,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { m_vLastCursorPosFloored = MOUSECOORDSFLOORED; - const auto PMONITOR = isLocked() && g_pCompositor->m_pLastMonitor ? g_pCompositor->m_pLastMonitor.get() : g_pCompositor->getMonitorFromCursor(); + const auto PMONITOR = isLocked() && g_pCompositor->m_pLastMonitor ? g_pCompositor->m_pLastMonitor.lock() : g_pCompositor->getMonitorFromCursor(); // this can happen if there are no displays hooked up to Hyprland if (PMONITOR == nullptr) @@ -212,7 +212,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", (uintptr_t)SURF.get(), (uintptr_t)CONSTRAINT.get()); } - if (PMONITOR != g_pCompositor->m_pLastMonitor.get() && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired()) + if (PMONITOR != g_pCompositor->m_pLastMonitor && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired()) g_pCompositor->setActiveMonitor(PMONITOR); if (g_pSessionLockManager->isSessionLocked()) { @@ -370,7 +370,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface); if (g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) > 0 && !skipFrameSchedule) - g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_pLastMonitor.get(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE); + g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_pLastMonitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE); // grabs if (g_pSeatManager->seatGrab && !g_pSeatManager->seatGrab->accepts(foundSurface)) { @@ -720,7 +720,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) { // notify app if we didnt handle it g_pSeatManager->sendPointerButton(e.timeMs, e.button, e.state); - if (const auto PMON = g_pCompositor->getMonitorFromVector(mouseCoords); PMON != g_pCompositor->m_pLastMonitor.get() && PMON) + if (const auto PMON = g_pCompositor->getMonitorFromVector(mouseCoords); PMON != g_pCompositor->m_pLastMonitor && PMON) g_pCompositor->setActiveMonitor(PMON); if (g_pSeatManager->seatGrab && e.state == WL_POINTER_BUTTON_STATE_PRESSED) { @@ -1359,7 +1359,7 @@ void CInputManager::refocus() { mouseMoveUnified(0, true); } -void CInputManager::refocusLastWindow(CMonitor* pMonitor) { +void CInputManager::refocusLastWindow(PHLMONITOR pMonitor) { if (!pMonitor) { refocus(); return; diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index d5634796..10faff24 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -112,7 +112,7 @@ class CInputManager { Vector2D getMouseCoordsInternal(); void refocus(); - void refocusLastWindow(CMonitor* pMonitor); + void refocusLastWindow(PHLMONITOR pMonitor); void simulateMouseMovement(); void sendMotionEventsToFocused(); diff --git a/src/managers/input/InputMethodPopup.cpp b/src/managers/input/InputMethodPopup.cpp index cf48f2a5..ffb4edcc 100644 --- a/src/managers/input/InputMethodPopup.cpp +++ b/src/managers/input/InputMethodPopup.cpp @@ -100,11 +100,11 @@ void CInputPopup::updateBox() { cursorBoxParent = {0, 0, (int)parentBox.w, (int)parentBox.h}; } - Vector2D currentPopupSize = surface->getViewporterCorrectedSize() / surface->resource()->current.scale; + Vector2D currentPopupSize = surface->getViewporterCorrectedSize() / surface->resource()->current.scale; - CMonitor* pMonitor = g_pCompositor->getMonitorFromVector(parentBox.middle()); + PHLMONITOR pMonitor = g_pCompositor->getMonitorFromVector(parentBox.middle()); - Vector2D popupOffset(0, 0); + Vector2D popupOffset(0, 0); if (parentBox.y + cursorBoxParent.y + cursorBoxParent.height + currentPopupSize.y > pMonitor->vecPosition.y + pMonitor->vecSize.y) popupOffset.y -= currentPopupSize.y; diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp index aa1d3274..8f95c6c6 100644 --- a/src/managers/input/Swipe.cpp +++ b/src/managers/input/Swipe.cpp @@ -33,7 +33,7 @@ void CInputManager::beginWorkspaceSwipe() { m_sActiveSwipe.pWorkspaceBegin = PWORKSPACE; m_sActiveSwipe.delta = 0; - m_sActiveSwipe.pMonitor = g_pCompositor->m_pLastMonitor.get(); + m_sActiveSwipe.pMonitor = g_pCompositor->m_pLastMonitor; m_sActiveSwipe.avgSpeed = 0; m_sActiveSwipe.speedPoints = 0; @@ -179,7 +179,7 @@ void CInputManager::endWorkspaceSwipe() { } m_sActiveSwipe.pWorkspaceBegin->rememberPrevWorkspace(pSwitchedTo); - g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); + g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock()); if (PWORKSPACEL) PWORKSPACEL->m_bForceRendering = false; @@ -264,7 +264,7 @@ void CInputManager::updateWorkspaceSwipe(double delta) { if (workspaceIDLeft > m_sActiveSwipe.pWorkspaceBegin->m_iID || !PWORKSPACE) { if (*PSWIPENEW) { - g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); + g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock()); if (VERTANIMS) m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE)); @@ -304,7 +304,7 @@ void CInputManager::updateWorkspaceSwipe(double delta) { if (workspaceIDRight < m_sActiveSwipe.pWorkspaceBegin->m_iID || !PWORKSPACE) { if (*PSWIPENEW) { - g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); + g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock()); if (VERTANIMS) m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE)); @@ -341,7 +341,7 @@ void CInputManager::updateWorkspaceSwipe(double delta) { g_pCompositor->updateWorkspaceWindowDecos(workspaceIDRight); } - g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); + g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock()); g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID); diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index 0333648a..454391af 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -18,7 +18,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { auto PMONITOR = g_pCompositor->getMonitorFromName(!e.device->boundOutput.empty() ? e.device->boundOutput : ""); - PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_pLastMonitor.get(); + PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_pLastMonitor.lock(); g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true); -- cgit v1.2.3