From f7755322fc515108cc9eed8113c09492d4a352c1 Mon Sep 17 00:00:00 2001 From: Visal Vijay <150381094+B2krobbery@users.noreply.github.com> Date: Fri, 10 Apr 2026 19:08:28 +0530 Subject: input: avoid repeated weak_ptr::lock() and ensure consistent usage (#14039) --- src/managers/input/InputManager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/managers/input/InputManager.cpp') diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 8672d28c..d1dafbc9 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -255,9 +255,12 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st if (PMONITOR->m_cursorZoom->value() != 1.f) g_pHyprRenderer->damageMonitor(PMONITOR); - bool skipFrameSchedule = PMONITOR->shouldSkipScheduleFrameOnMouseEvent(); + bool skipFrameSchedule = PMONITOR->shouldSkipScheduleFrameOnMouseEvent(); - if (!PMONITOR->m_solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(PMONITOR->m_self.lock()) && !skipFrameSchedule) + const auto solitary = PMONITOR->m_solitaryClient.lock(); + const auto self = PMONITOR->m_self.lock(); + + if (!solitary && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(self) && !skipFrameSchedule) g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE); // constraints @@ -513,7 +516,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st if (!foundSurface) foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface); - if (g_pPointerManager->softwareLockedFor(PMONITOR->m_self.lock()) > 0 && !skipFrameSchedule) + if (g_pPointerManager->softwareLockedFor(self) > 0 && !skipFrameSchedule) g_pCompositor->scheduleFrameForMonitor(Desktop::focusState()->monitor(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE); // FIXME: This will be disabled during DnD operations because we do not exactly follow the spec -- cgit v1.2.3