From a442edfa3ef13ae62b7b5ce845c0c6e801bf0166 Mon Sep 17 00:00:00 2001 From: jsecchiero Date: Sun, 21 Jan 2024 00:17:27 +0100 Subject: [PATCH] layout: restore fullscreen on window move currently windows will be changed in tile mode in the source workspace if a fullscreen window is moved in another workspace --- src/Compositor.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 085590b9..e4bd6128 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2684,8 +2684,9 @@ void CCompositor::moveWindowToWorkspaceSafe(CWindow* pWindow, CWorkspace* pWorks if (pWindow->m_bPinned && pWorkspace->m_bIsSpecialWorkspace) return; + const int OLDWORKSPACE = pWindow->m_iWorkspaceID; const bool FULLSCREEN = pWindow->m_bIsFullscreen; - const auto FULLSCREENMODE = getWorkspaceByID(pWindow->m_iWorkspaceID)->m_efFullscreenMode; + const auto FULLSCREENMODE = getWorkspaceByID(OLDWORKSPACE)->m_efFullscreenMode; if (FULLSCREEN) setWindowFullscreen(pWindow, false, FULLSCREEN_FULL); @@ -2726,6 +2727,14 @@ void CCompositor::moveWindowToWorkspaceSafe(CWindow* pWindow, CWorkspace* pWorks g_pCompositor->updateWorkspaceWindows(pWorkspace->m_iID); g_pCompositor->updateWorkspaceWindows(pWindow->m_iWorkspaceID); + + // restore fullscreen in the previous workspace if we move a fullscreen window in another workspace + CWindow* FWINDOW = g_pCompositor->getFirstWindowOnWorkspace(OLDWORKSPACE); + + if (FWINDOW && FULLSCREEN) { + Debug::log(LOG, "Set fullscreen in the first window of workspace {}", OLDWORKSPACE); + g_pCompositor->setWindowFullscreen(FWINDOW, true, FULLSCREENMODE); + } } CWindow* CCompositor::getForceFocus() {