From 22024dc0d6601df7da91fa71a50e7be09425b5f3 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 21 Nov 2024 00:23:43 +0800 Subject: [PATCH] feat: remember maxiumize(fullscreenstate 1) pinned state too --- src/Compositor.cpp | 23 +++++++++++++++++++---- src/desktop/Window.hpp | 3 +++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 8c92cf00..500b3d41 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2353,10 +2353,15 @@ 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 && !PWINDOW->m_bPinFullscreened && PWINDOW->m_bPinned && PWINDOW->m_sFullscreenState.internal != FSMODE_FULLSCREEN) { - PWINDOW->m_bPinned = false; - PWINDOW->m_bPinFullscreened = true; - } + if (*PALLOWPINFULLSCREEN) { + if (!PWINDOW->m_bPinFullscreened && PWINDOW->m_sFullscreenState.internal != FSMODE_FULLSCREEN) { + PWINDOW->m_bPinned = false; + PWINDOW->m_bPinFullscreened = true; + } else if (!PWINDOW->m_bPinMaximized && PWINDOW->m_sFullscreenState.internal != FSMODE_MAXIMIZED) { + PWINDOW->m_bPinned = false; + PWINDOW->m_bPinMaximized = true; + } + } const bool CHANGEINTERNAL = !(PWINDOW->m_bPinned || CURRENT_EFFECTIVE_MODE == EFFECTIVE_MODE || (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->isFullscreen())); @@ -2365,6 +2370,16 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenS PWINDOW->m_bPinFullscreened = false; } + if (*PALLOWPINFULLSCREEN) { + if (PWINDOW->m_bPinFullscreened && PWINDOW->m_sFullscreenState.internal == FSMODE_FULLSCREEN) { + PWINDOW->m_bPinned = true; + PWINDOW->m_bPinFullscreened = false; + } else if (PWINDOW->m_bPinMaximized && PWINDOW->m_sFullscreenState.internal == FSMODE_MAXIMIZED) { + PWINDOW->m_bPinned = true; + PWINDOW->m_bPinMaximized = false; + } + } + // TODO: update the state on syncFullscreen changes if (!CHANGEINTERNAL && PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault()) return; diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp index 5dd59437..a00ff607 100644 --- a/src/desktop/Window.hpp +++ b/src/desktop/Window.hpp @@ -335,6 +335,9 @@ class CWindow { // For preserving pinned state when fullscreening a pinned window bool m_bPinFullscreened = false; + // For preserving pinned state when maximizing a pinned window + bool m_bPinMaximized = false; + // urgency hint bool m_bIsUrgent = false;