Skip to content

Commit

Permalink
per window state instead of global
Browse files Browse the repository at this point in the history
  • Loading branch information
littleblack111 committed Nov 20, 2024
1 parent e51b201 commit a351dd7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,7 @@ void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFull
}

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");

if (!validMapped(PWINDOW) || g_pCompositor->m_bUnsafeState)
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/Compositor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class CCompositor {
bool m_bFinalRequests = false;
bool m_bDesktopEnvSet = false;
bool m_bEnableXwayland = true;
bool m_bPinFullscreened = false;

// ------------------------------------------------- //

Expand Down
3 changes: 3 additions & 0 deletions src/desktop/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a351dd7

Please sign in to comment.