keybinds: Keep focus on special when switching workspaces (#4084)

This commit is contained in:
dranull 2023-12-07 22:12:08 +00:00 committed by GitHub
parent aa020a2a1a
commit 004bf94a23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -533,24 +533,24 @@ void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal, bool
} }
} }
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; if (!g_pCompositor->m_pLastMonitor->specialWorkspaceID) {
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
CWindow* pWindow = pWorkspace->getLastFocusedWindow();
if (const auto PLASTWINDOW = pWorkspace->getLastFocusedWindow(); PLASTWINDOW) if (!pWindow) {
g_pCompositor->focusWindow(PLASTWINDOW); if (*PFOLLOWMOUSE == 1)
else { pWindow = g_pCompositor->vectorToWindowIdeal(g_pInputManager->getMouseCoordsInternal());
CWindow* pWindow = nullptr;
if (*PFOLLOWMOUSE == 1) if (!pWindow)
pWindow = g_pCompositor->vectorToWindowIdeal(g_pInputManager->getMouseCoordsInternal()); pWindow = g_pCompositor->getTopLeftWindowOnWorkspace(pWorkspace->m_iID);
if (!pWindow) if (!pWindow)
pWindow = g_pCompositor->getTopLeftWindowOnWorkspace(pWorkspace->m_iID); pWindow = g_pCompositor->getFirstWindowOnWorkspace(pWorkspace->m_iID);
}
if (!pWindow)
pWindow = g_pCompositor->getFirstWindowOnWorkspace(pWorkspace->m_iID);
g_pCompositor->focusWindow(pWindow); g_pCompositor->focusWindow(pWindow);
} }
if (!noMouseMove) if (!noMouseMove)
g_pInputManager->simulateMouseMovement(); g_pInputManager->simulateMouseMovement();