From 4bd23604f88708718df0f5e5971b2d1169e13e9b Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 12 Apr 2022 19:18:26 +0200 Subject: [PATCH] Dwindle window group fixes fixed a crash and animations in the bg --- src/layout/DwindleLayout.cpp | 23 +++++++++++------------ src/managers/AnimationManager.cpp | 3 ++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index b007ae8e..6faf6538 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -283,20 +283,9 @@ void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) { } } - if (PSIBLING->pParent) - PSIBLING->pParent->recalcSizePosRecursive(); - else - PSIBLING->recalcSizePosRecursive(); - // check if it was grouped if (PNODE->pGroupParent) { - const auto MEMBERSCOPY = PNODE->pGroupParent->groupMembers; - PNODE->pGroupParent->groupMembers.clear(); - for (auto& c : MEMBERSCOPY) { - if (c != PNODE) { - PNODE->pGroupParent->groupMembers.push_back(c); - } - } + PNODE->pGroupParent->groupMembers.erase(PNODE->pGroupParent->groupMembers.begin() + PNODE->pGroupParent->groupMemberActive); if ((long unsigned int)PNODE->pGroupParent->groupMemberActive >= PNODE->pGroupParent->groupMembers.size()) PNODE->pGroupParent->groupMemberActive = 0; @@ -310,8 +299,18 @@ void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) { } else { PNODE->pGroupParent->recalcSizePosRecursive(); } + + // if the parent is to be removed, remove the group + if (PPARENT == PNODE->pGroupParent) { + toggleWindowGroup(PPARENT->groupMembers[PPARENT->groupMemberActive]->pWindow); + } } + if (PSIBLING->pParent) + PSIBLING->pParent->recalcSizePosRecursive(); + else + PSIBLING->recalcSizePosRecursive(); + m_lDwindleNodesData.remove(*PPARENT); m_lDwindleNodesData.remove(*PNODE); diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 48d56148..8c1f6e38 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -48,7 +48,8 @@ void CAnimationManager::tick() { } // process fadein/out for unmapped windows, but nothing else. - if (!g_pCompositor->windowValidMapped(&w)) + // we can't use windowValidMapped because we want to animate hidden windows too. + if (!g_pCompositor->windowExists(&w) || !w.m_bIsMapped || !g_pXWaylandManager->getWindowSurface(&w)) continue; // process the borders