per window state instead of global

This commit is contained in:
littleblack111 2024-11-20 09:57:36 +08:00
parent e51b201316
commit a351dd7b55
No known key found for this signature in database
GPG key ID: 736753424BA3940C
3 changed files with 11 additions and 9 deletions

View file

@ -2338,7 +2338,7 @@ void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFull
} }
void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenState state) { void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenState state) {
static auto PDIRECTSCANOUT = CConfigValue<Hyprlang::INT>("render:direct_scanout"); static auto PDIRECTSCANOUT = CConfigValue<Hyprlang::INT>("render:direct_scanout");
static auto PALLOWPINFULLSCREEN = CConfigValue<Hyprlang::INT>("binds:pin_fullscreen"); static auto PALLOWPINFULLSCREEN = CConfigValue<Hyprlang::INT>("binds:pin_fullscreen");
if (!validMapped(PWINDOW) || g_pCompositor->m_bUnsafeState) 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 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); const eFullscreenMode EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)state.internal);
if (*PALLOWPINFULLSCREEN && !m_bPinFullscreened && PWINDOW->m_bPinned && !PWINDOW->isFullscreen()) { if (*PALLOWPINFULLSCREEN && !PWINDOW->m_bPinFullscreened && PWINDOW->m_bPinned && !PWINDOW->isFullscreen()) {
PWINDOW->m_bPinned = false; PWINDOW->m_bPinned = false;
m_bPinFullscreened = true; 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()) { if (*PALLOWPINFULLSCREEN && PWINDOW->m_bPinFullscreened && !PWINDOW->m_bPinned && PWINDOW->isFullscreen()) {
PWINDOW->m_bPinned = true; PWINDOW->m_bPinned = true;
m_bPinFullscreened = false; PWINDOW->m_bPinFullscreened = false;
} }
// TODO: update the state on syncFullscreen changes // TODO: update the state on syncFullscreen changes

View file

@ -94,7 +94,6 @@ class CCompositor {
bool m_bFinalRequests = false; bool m_bFinalRequests = false;
bool m_bDesktopEnvSet = false; bool m_bDesktopEnvSet = false;
bool m_bEnableXwayland = true; bool m_bEnableXwayland = true;
bool m_bPinFullscreened = false;
// ------------------------------------------------- // // ------------------------------------------------- //

View file

@ -332,6 +332,9 @@ class CWindow {
// For pinned (sticky) windows // For pinned (sticky) windows
bool m_bPinned = false; bool m_bPinned = false;
// For preserving pinned state when fullscreening a pinned window
bool m_bPinFullscreened = false;
// urgency hint // urgency hint
bool m_bIsUrgent = false; bool m_bIsUrgent = false;