From 23ec4793e18949f32c4954b46ff2e724dc1e6f31 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 20 Mar 2022 19:14:17 +0100 Subject: fix xwayland windows grabbing mouse when hidden --- src/managers/KeybindManager.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/managers/KeybindManager.cpp') diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 68f6dbc4..2dedf22c 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -100,9 +100,21 @@ void CKeybindManager::changeworkspace(std::string args) { const auto PMONITOR = g_pCompositor->getMonitorFromID(g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->monitorID); // if it's not visible, make it visible. - if (!g_pCompositor->isWorkspaceVisible(workspaceToChangeTo)) + if (!g_pCompositor->isWorkspaceVisible(workspaceToChangeTo)) { + const auto OLDWORKSPACEID = PMONITOR->activeWorkspace; + + // change it PMONITOR->activeWorkspace = workspaceToChangeTo; + // we need to move XWayland windows to narnia or otherwise they will still process our cursor and shit + // and that'd be annoying as hell + g_pCompositor->fixXWaylandWindowsOnWorkspace(OLDWORKSPACEID); + + // and fix on the new workspace + g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace); + } + + // If the monitor is not the one our cursor's at, warp to it. if (PMONITOR != g_pCompositor->getMonitorFromCursor()) { Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f; @@ -111,7 +123,7 @@ void CKeybindManager::changeworkspace(std::string args) { // focus the first window g_pCompositor->focusWindow(g_pCompositor->getFirstWindowOnWorkspace(workspaceToChangeTo)); - + return; } -- cgit v1.2.3