From a351dd7b550ed38d7537a00b9c5f53d87ce64ef3 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 20 Nov 2024 09:57:36 +0800 Subject: [PATCH] per window state instead of global --- src/Compositor.cpp | 16 ++++++++-------- src/Compositor.hpp | 1 - src/desktop/Window.hpp | 3 +++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 3f766686c5b..2c658e16578 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2338,7 +2338,7 @@ void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFull } void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenState state) { - static auto PDIRECTSCANOUT = CConfigValue("render:direct_scanout"); + static auto PDIRECTSCANOUT = CConfigValue("render:direct_scanout"); static auto PALLOWPINFULLSCREEN = CConfigValue("binds:pin_fullscreen"); if (!validMapped(PWINDOW) || g_pCompositor->m_bUnsafeState) @@ -2353,16 +2353,16 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenS const eFullscreenMode CURRENT_EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)PWINDOW->m_sFullscreenState.internal); const eFullscreenMode EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)state.internal); - if (*PALLOWPINFULLSCREEN && !m_bPinFullscreened && PWINDOW->m_bPinned && !PWINDOW->isFullscreen()) { - PWINDOW->m_bPinned = false; - m_bPinFullscreened = true; + if (*PALLOWPINFULLSCREEN && !PWINDOW->m_bPinFullscreened && PWINDOW->m_bPinned && !PWINDOW->isFullscreen()) { + PWINDOW->m_bPinned = false; + PWINDOW->m_bPinFullscreened = true; } - const bool CHANGEINTERNAL = !(PWINDOW->m_bPinned || CURRENT_EFFECTIVE_MODE == EFFECTIVE_MODE || (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->isFullscreen())); + const bool CHANGEINTERNAL = !(PWINDOW->m_bPinned || CURRENT_EFFECTIVE_MODE == EFFECTIVE_MODE || (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->isFullscreen())); - if (*PALLOWPINFULLSCREEN && m_bPinFullscreened && !PWINDOW->m_bPinned && PWINDOW->isFullscreen()) { - PWINDOW->m_bPinned = true; - m_bPinFullscreened = false; + if (*PALLOWPINFULLSCREEN && PWINDOW->m_bPinFullscreened && !PWINDOW->m_bPinned && PWINDOW->isFullscreen()) { + PWINDOW->m_bPinned = true; + PWINDOW->m_bPinFullscreened = false; } // TODO: update the state on syncFullscreen changes diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 535a6007580..208b6ecfa47 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -94,7 +94,6 @@ class CCompositor { bool m_bFinalRequests = false; bool m_bDesktopEnvSet = false; bool m_bEnableXwayland = true; - bool m_bPinFullscreened = false; // ------------------------------------------------- // diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp index ac81e5ef3c3..5dd5943782e 100644 --- a/src/desktop/Window.hpp +++ b/src/desktop/Window.hpp @@ -332,6 +332,9 @@ class CWindow { // For pinned (sticky) windows bool m_bPinned = false; + // For preserving pinned state when fullscreening a pinned window + bool m_bPinFullscreened = false; + // urgency hint bool m_bIsUrgent = false;