don't find a new candidate to refocus on unfocused unmap

This commit is contained in:
vaxerski 2022-08-24 11:14:11 +02:00
parent 29696d046e
commit 9366c187dc

View file

@ -370,7 +370,10 @@ void Events::listener_unmapWindow(void* owner, void* data) {
// Allow the renderer to catch the last frame. // Allow the renderer to catch the last frame.
g_pHyprOpenGL->makeWindowSnapshot(PWINDOW); g_pHyprOpenGL->makeWindowSnapshot(PWINDOW);
bool wasLastWindow = false;
if (PWINDOW == g_pCompositor->m_pLastWindow) { if (PWINDOW == g_pCompositor->m_pLastWindow) {
wasLastWindow = true;
g_pCompositor->m_pLastWindow = nullptr; g_pCompositor->m_pLastWindow = nullptr;
g_pCompositor->m_pLastFocus = nullptr; g_pCompositor->m_pLastFocus = nullptr;
} }
@ -388,7 +391,8 @@ void Events::listener_unmapWindow(void* owner, void* data) {
// do this after onWindowRemoved because otherwise it'll think the window is invalid // do this after onWindowRemoved because otherwise it'll think the window is invalid
PWINDOW->m_bIsMapped = false; PWINDOW->m_bIsMapped = false;
// refocus on a new window // refocus on a new window if needed
if (wasLastWindow) {
auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(PWINDOW->m_vRealPosition.goalv() + PWINDOW->m_vRealSize.goalv() / 2.f); auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(PWINDOW->m_vRealPosition.goalv() + PWINDOW->m_vRealSize.goalv() / 2.f);
if (PWORKSPACE->m_bHasFullscreenWindow && (!PWINDOWCANDIDATE->m_bCreatedOverFullscreen || !PWINDOW->m_bIsFloating)) if (PWORKSPACE->m_bHasFullscreenWindow && (!PWINDOWCANDIDATE->m_bCreatedOverFullscreen || !PWINDOW->m_bIsFloating))
@ -405,6 +409,9 @@ void Events::listener_unmapWindow(void* owner, void* data) {
else else
g_pCompositor->focusWindow(PWINDOWCANDIDATE); g_pCompositor->focusWindow(PWINDOWCANDIDATE);
} }
} else {
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
}
Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %x", PWINDOW); Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %x", PWINDOW);
SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree); SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);