diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-11-04 11:09:34 +0000 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-11-04 11:09:34 +0000 |
| commit | e7961576721f1bd7cc976d14c6dccaddf6c1a69f (patch) | |
| tree | a40bbf7e2ffc426db25c5ea27cc670163645250b /src/managers/input/InputManager.cpp | |
| parent | b51222c0044a04869f0486544606e4f65df9995c (diff) | |
fix passing input to constrained windows without relative
Diffstat (limited to 'src/managers/input/InputManager.cpp')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 8a7550db..e7eaf646 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -38,6 +38,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { m_pFoundSurfaceToFocus = nullptr; m_pFoundLSToFocus = nullptr; m_pFoundWindowToFocus = nullptr; + wlr_surface* foundSurface = nullptr; + Vector2D surfaceCoords; + Vector2D surfacePos = Vector2D(-1337, -1337); + CWindow* pFoundWindow = nullptr; + SLayerSurface* pFoundLayerSurface = nullptr; if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown) return; @@ -105,7 +110,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { } else { if ((!CONSTRAINTWINDOW->m_bIsX11 && PMONITOR && CONSTRAINTWINDOW->m_iWorkspaceID == PMONITOR->activeWorkspace) || (CONSTRAINTWINDOW->m_bIsX11)) { g_pCompositor->m_sSeat.mouse->constraintActive = true; - didConstraintOnCursor = true; + if (CONSTRAINTWINDOW->m_bIsX11) { + foundSurface = g_pXWaylandManager->getWindowSurface(CONSTRAINTWINDOW); + surfacePos = CONSTRAINTWINDOW->m_vRealPosition.vec(); + } else { + g_pCompositor->vectorWindowToSurface(mouseCoords, CONSTRAINTWINDOW, surfaceCoords); + } + pFoundWindow = CONSTRAINTWINDOW; } } } @@ -116,9 +127,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal()); - // focus - wlr_surface* foundSurface = nullptr; - if (didConstraintOnCursor) return; // don't process when cursor constrained @@ -134,11 +142,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { g_pEventManager->postEvent(SHyprIPCEvent{"focusedmon", PMONITOR->szName + "," + ACTIVEWORKSPACE->m_szName}); } - Vector2D surfaceCoords; - Vector2D surfacePos = Vector2D(-1337, -1337); - CWindow* pFoundWindow = nullptr; - SLayerSurface* pFoundLayerSurface = nullptr; - // overlay is above fullscreen if (!foundSurface) foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); |
