From ae6b9e59ff70620b425a6b281f708e9d45538b15 Mon Sep 17 00:00:00 2001 From: jsecchiero Date: Sat, 20 Jan 2024 21:31:46 +0100 Subject: [PATCH] layout: restore fullscreen on window close currently windows will be changed in tile mode if a fullscreen window is closed --- src/events/Windows.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index cb7a6aaf..ee1be4f3 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -690,7 +690,10 @@ void Events::listener_unmapWindow(void* owner, void* data) { 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); // Allow the renderer to catch the last frame. @@ -713,11 +716,13 @@ void Events::listener_unmapWindow(void* owner, void* data) { g_pInputManager->releaseAllMouseButtons(); } - // remove the fullscreen window status from workspace if we closed it - const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID); + // restore fullscreen if we closed a fullscreen window + CWindow* FWINDOW = g_pCompositor->getFirstWindowOnWorkspace(WORKSPACE); - if (PWORKSPACE->m_bHasFullscreenWindow && PWINDOW->m_bIsFullscreen) - PWORKSPACE->m_bHasFullscreenWindow = false; + if (FWINDOW && FULLSCREEN) { + Debug::log(LOG, "Set fullscreen in the first window of workspace {}", WORKSPACE); + g_pCompositor->setWindowFullscreen(FWINDOW, true, FULLSCREENMODE); + } g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);