fix passing input to constrained windows without relative

This commit is contained in:
vaxerski 2022-11-04 11:09:34 +00:00
parent b51222c004
commit e796157672

View file

@ -38,6 +38,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
m_pFoundSurfaceToFocus = nullptr; m_pFoundSurfaceToFocus = nullptr;
m_pFoundLSToFocus = nullptr; m_pFoundLSToFocus = nullptr;
m_pFoundWindowToFocus = 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) if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown)
return; return;
@ -105,7 +110,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
} else { } else {
if ((!CONSTRAINTWINDOW->m_bIsX11 && PMONITOR && CONSTRAINTWINDOW->m_iWorkspaceID == PMONITOR->activeWorkspace) || (CONSTRAINTWINDOW->m_bIsX11)) { if ((!CONSTRAINTWINDOW->m_bIsX11 && PMONITOR && CONSTRAINTWINDOW->m_iWorkspaceID == PMONITOR->activeWorkspace) || (CONSTRAINTWINDOW->m_bIsX11)) {
g_pCompositor->m_sSeat.mouse->constraintActive = true; 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()); g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
// focus
wlr_surface* foundSurface = nullptr;
if (didConstraintOnCursor) if (didConstraintOnCursor)
return; // don't process when cursor constrained 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}); 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 // overlay is above fullscreen
if (!foundSurface) if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);