diff options
author | MightyPlaza <[email protected]> | 2024-08-04 19:40:34 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-04 21:40:34 +0200 |
commit | 2b520571e897be2a0e88c8692da607b062000038 (patch) | |
tree | 064ce4f8f65e2e19e9c210b81f18729238395be3 | |
parent | 5dd2c27b631f16e49a2c6e6cbbefba9fa50bf543 (diff) | |
download | Hyprland-2b520571e897be2a0e88c8692da607b062000038.tar.gz Hyprland-2b520571e897be2a0e88c8692da607b062000038.zip |
keybinds: improve fullscreenstate toggling (#7174)
modified: src/managers/KeybindManager.cpp
-rw-r--r-- | src/managers/KeybindManager.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 9984fe40..09ba7d50 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1164,8 +1164,6 @@ void CKeybindManager::fullscreenStateActive(std::string args) { if (!PWINDOW) return; - PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_SET_PROP); - int internalMode, clientMode; try { internalMode = std::stoi(ARGS[0]); @@ -1177,10 +1175,26 @@ void CKeybindManager::fullscreenStateActive(std::string args) { const sFullscreenState STATE = sFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_sFullscreenState.internal), .client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_sFullscreenState.client)}; - if (PWINDOW->m_sFullscreenState.internal == STATE.internal && PWINDOW->m_sFullscreenState.client == STATE.client) + if (internalMode != -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal && PWINDOW->m_sFullscreenState.client == STATE.client) { g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE}); - else - g_pCompositor->setWindowFullscreenState(PWINDOW, STATE); + PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(true, PRIORITY_SET_PROP); + return; + } + + if (internalMode != -1 && clientMode == -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal) { + g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = PWINDOW->m_sFullscreenState.client, .client = PWINDOW->m_sFullscreenState.client}); + PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(true, PRIORITY_SET_PROP); + return; + } + + if (internalMode == -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.client == STATE.client) { + g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = PWINDOW->m_sFullscreenState.internal}); + PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(true, PRIORITY_SET_PROP); + return; + } + + PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_SET_PROP); + g_pCompositor->setWindowFullscreenState(PWINDOW, STATE); } void CKeybindManager::moveActiveToWorkspace(std::string args) { |