layout: Focus a floating window after closing the last tiled (#4137)

This commit is contained in:
dranull 2023-12-12 16:44:31 +00:00 committed by GitHub
parent 934112af5b
commit 4de986072c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {