From 34455844e9ac623e68375bb007535cdf979f2a02 Mon Sep 17 00:00:00 2001 From: memchr <118117622+memchr@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:13:12 +0000 Subject: [PATCH] groups: ensure consistency in dispatcher behavior with global group lock (#3531) --- src/managers/KeybindManager.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 52581b62..fd298d34 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -2019,7 +2019,10 @@ void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string& void CKeybindManager::moveIntoGroup(std::string args) { char arg = args[0]; - static auto* const BIGNOREGROUPLOCK = &g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock")->intValue; + static auto* const PIGNOREGROUPLOCK = &g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock")->intValue; + + if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked) + return; if (!isDirection(args)) { Debug::log(ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); @@ -2037,13 +2040,18 @@ void CKeybindManager::moveIntoGroup(std::string args) { return; // Do not move window into locked group if binds:ignore_group_lock is false - if (!*BIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || (PWINDOW->m_sGroupData.pNextWindow && PWINDOW->getGroupHead()->m_sGroupData.locked))) + if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || (PWINDOW->m_sGroupData.pNextWindow && PWINDOW->getGroupHead()->m_sGroupData.locked))) return; moveWindowIntoGroup(PWINDOW, PWINDOWINDIR); } void CKeybindManager::moveOutOfGroup(std::string args) { + static auto* const PIGNOREGROUPLOCK = &g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock")->intValue; + + if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked) + return; + const auto PWINDOW = g_pCompositor->m_pLastWindow; if (!PWINDOW || !PWINDOW->m_sGroupData.pNextWindow) @@ -2065,6 +2073,12 @@ void CKeybindManager::moveWindowOrGroup(std::string args) { const auto PWINDOW = g_pCompositor->m_pLastWindow; if (!PWINDOW || PWINDOW->m_bIsFullscreen) return; + + if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked) { + g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args); + return; + } + const auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg); const bool ISWINDOWGROUP = PWINDOW->m_sGroupData.pNextWindow;