From ba9e7814b0e02be251ff6172d644de59cf0170de Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 2 Nov 2023 21:36:16 +0000 Subject: [PATCH] input: simulate movement only if mouse is over in open/close window fixes #3726 --- src/events/Windows.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index e2ff6cc0..ce65fa72 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -649,7 +649,8 @@ void Events::listener_mapWindow(void* owner, void* data) { g_pCompositor->setPreferredScaleForSurface(PWINDOW->m_pWLSurface.wlr(), PMONITOR->scale); g_pCompositor->setPreferredTransformForSurface(PWINDOW->m_pWLSurface.wlr(), PMONITOR->transform); - g_pInputManager->simulateMouseMovement(); + if (g_pCompositor->vectorToWindowIdeal(g_pInputManager->getMouseCoordsInternal()) == g_pCompositor->m_pLastWindow) + g_pInputManager->simulateMouseMovement(); } void Events::listener_unmapWindow(void* owner, void* data) { @@ -740,7 +741,8 @@ void Events::listener_unmapWindow(void* owner, void* data) { if (PWINDOWCANDIDATE != g_pCompositor->m_pLastWindow && PWINDOWCANDIDATE) g_pCompositor->focusWindow(PWINDOWCANDIDATE); - g_pInputManager->simulateMouseMovement(); + if (g_pCompositor->vectorToWindowIdeal(g_pInputManager->getMouseCoordsInternal()) == PWINDOWCANDIDATE) + g_pInputManager->simulateMouseMovement(); // CWindow::onUnmap will remove this window's active status, but we can't really do it above. if (PWINDOW == g_pCompositor->m_pLastWindow || !g_pCompositor->m_pLastWindow) {