binds: option to fullscreen pinned window

this stores the state in a var and apply pinned status back when
un-fullscrening
This commit is contained in:
littleblack111 2024-11-19 23:17:33 +08:00
parent 67cee43006
commit e51b201316
No known key found for this signature in database
GPG key ID: 45AE0FF5962FA6EF
3 changed files with 13 additions and 0 deletions

View file

@ -2339,6 +2339,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 PALLOWPINFULLSCREEN = CConfigValue<Hyprlang::INT>("binds:pin_fullscreen");
if (!validMapped(PWINDOW) || g_pCompositor->m_bUnsafeState)
return;
@ -2352,8 +2353,18 @@ 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;
}
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;
}
// TODO: update the state on syncFullscreen changes
if (!CHANGEINTERNAL && PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault())
return;

View file

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

View file

@ -534,6 +534,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("binds:movefocus_cycles_fullscreen", Hyprlang::INT{1});
m_pConfig->addConfigValue("binds:disable_keybind_grabbing", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:window_direction_monitor_fallback", Hyprlang::INT{1});
m_pConfig->addConfigValue("binds:pin_fullscreen", Hyprlang::INT{0});
m_pConfig->addConfigValue("gestures:workspace_swipe", Hyprlang::INT{0});
m_pConfig->addConfigValue("gestures:workspace_swipe_fingers", Hyprlang::INT{3});