diff options
| author | dranull <150595692+dranull@users.noreply.github.com> | 2023-12-12 16:44:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-12 16:44:31 +0000 |
| commit | 4de986072c12af8081f877f4792d57b4a11a0a6a (patch) | |
| tree | 7bb61c1040249da6049f40adfe6502eb4c7e48e0 /src/layout/IHyprLayout.cpp | |
| parent | 934112af5bed36a1273cc0d5588e27ab4825922b (diff) | |
layout: Focus a floating window after closing the last tiled (#4137)
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
| -rw-r--r-- | src/layout/IHyprLayout.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index acd84684..0c6d24fd 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -565,13 +565,19 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) { } // if it was a tiled window, we first try to find the window that will replace it. - const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(pWindow->middle()); + auto pWindowCandidate = g_pCompositor->vectorToWindowIdeal(pWindow->middle()); - if (!PWINDOWCANDIDATE || pWindow == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->isHidden() || PWINDOWCANDIDATE->m_bX11ShouldntFocus || - PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) + if (!pWindowCandidate) + pWindowCandidate = g_pCompositor->getTopLeftWindowOnWorkspace(pWindow->m_iWorkspaceID); + + if (!pWindowCandidate) + pWindowCandidate = g_pCompositor->getFirstWindowOnWorkspace(pWindow->m_iWorkspaceID); + + if (!pWindowCandidate || pWindow == pWindowCandidate || !pWindowCandidate->m_bIsMapped || pWindowCandidate->isHidden() || pWindowCandidate->m_bX11ShouldntFocus || + pWindowCandidate->m_iX11Type == 2 || pWindowCandidate->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) return nullptr; - return PWINDOWCANDIDATE; + return pWindowCandidate; } bool IHyprLayout::isWindowReachable(CWindow* pWindow) { |
