keybinds: avoid onWindowRemoved & onWindowCreated when group has one member (#3286)

Make moveWindowOutOfGroup behave like toggleGroup on a group with single
member, this prevents the window from moving around rabidly.
This commit is contained in:
memchr 2023-09-13 10:44:02 +00:00 committed by GitHub
parent 41e5f401c5
commit 4f88897fc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1977,15 +1977,19 @@ void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string&
default: direction = DIRECTION_DEFAULT;
}
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
if (pWindow->m_sGroupData.pNextWindow == pWindow) {
pWindow->m_sGroupData.pNextWindow = nullptr;
pWindow->updateWindowDecos();
} else {
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
const auto GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
const auto GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
g_pKeybindManager->m_bGroupsLocked = true;
g_pKeybindManager->m_bGroupsLocked = true;
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow, direction);
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow, direction);
g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV;
g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV;
}
if (*BFOCUSREMOVEDWINDOW) {
g_pCompositor->focusWindow(pWindow);