layout: restore fullscreen on window close

currently windows will be changed in tile mode if a fullscreen window is
closed
This commit is contained in:
jsecchiero 2024-01-20 21:31:46 +01:00
parent bff54d85d0
commit ae6b9e59ff
No known key found for this signature in database

View file

@ -690,7 +690,10 @@ void Events::listener_unmapWindow(void* owner, void* data) {
PWINDOW->hyprListener_requestMinimize.removeCallback(); PWINDOW->hyprListener_requestMinimize.removeCallback();
} }
if (PWINDOW->m_bIsFullscreen) const auto WORKSPACE = PWINDOW->m_iWorkspaceID;
const bool FULLSCREEN = PWINDOW->m_bIsFullscreen;
const auto FULLSCREENMODE = g_pCompositor->getWorkspaceByID(WORKSPACE)->m_efFullscreenMode;
if (FULLSCREEN)
g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_FULL); g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_FULL);
// Allow the renderer to catch the last frame. // Allow the renderer to catch the last frame.
@ -713,11 +716,13 @@ void Events::listener_unmapWindow(void* owner, void* data) {
g_pInputManager->releaseAllMouseButtons(); g_pInputManager->releaseAllMouseButtons();
} }
// remove the fullscreen window status from workspace if we closed it // restore fullscreen if we closed a fullscreen window
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID); CWindow* FWINDOW = g_pCompositor->getFirstWindowOnWorkspace(WORKSPACE);
if (PWORKSPACE->m_bHasFullscreenWindow && PWINDOW->m_bIsFullscreen) if (FWINDOW && FULLSCREEN) {
PWORKSPACE->m_bHasFullscreenWindow = false; Debug::log(LOG, "Set fullscreen in the first window of workspace {}", WORKSPACE);
g_pCompositor->setWindowFullscreen(FWINDOW, true, FULLSCREENMODE);
}
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW); g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);