From 179562b646851c06ee79fa4a5e2e7386885cee0e Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:52:35 +0200 Subject: [PATCH] fix dwindle groupbars --- src/Window.cpp | 9 +++++++++ src/Window.hpp | 1 + src/layout/DwindleLayout.cpp | 16 ++++++++++++---- .../decorations/CHyprGroupBarDecoration.cpp | 1 - 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index d5b248414..d0ea4f24e 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -233,3 +233,12 @@ CWindow* CWindow::X11TransientFor() { return PPARENT; } + +void CWindow::removeDecorationByType(eDecorationType type) { + for (auto& wd : m_dWindowDecorations) { + if (wd->getDecorationType() == type) + m_vDecosToRemove.push_back(wd.get()); + } + + updateWindowDecos(); +} diff --git a/src/Window.hpp b/src/Window.hpp index 6cf222046..11cc709e7 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -154,6 +154,7 @@ public: void updateWindowDecos(); pid_t getPID(); IHyprWindowDecoration* getDecorationByType(eDecorationType); + void removeDecorationByType(eDecorationType); void createToplevelHandle(); void destroyToplevelHandle(); void updateToplevel(); diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index babe1a6e9..8f6613e06 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -803,6 +803,7 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) { for (auto& pw : toAddWindows) { onWindowCreated(pw); + pw->removeDecorationByType(DECORATION_GROUPBAR); } recalculateMonitor(PWORKSPACE->m_iMonitorID); @@ -862,6 +863,9 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) { newGroupMembers[i]->pPreviousGroupMember = PREVMEMBER; newGroupMembers[i]->pNextGroupMember = NEXTMEMBER; + + // add the deco + newGroupMembers[i]->pWindow->m_dWindowDecorations.emplace_back(std::make_unique(newGroupMembers[i]->pWindow)); } // focus @@ -883,14 +887,15 @@ std::deque CHyprDwindleLayout::getGroupMembers(CWindow* pWindow) { // get the node const auto PNODE = getNodeFromWindow(pWindow); - if (!PNODE) + if (!PNODE || !PNODE->isGroupMember()) return result; // reject with empty - SDwindleNodeData* current = PNODE->pNextGroupMember; + const auto HEAD = PNODE->getGroupHead(); + SDwindleNodeData* current = HEAD->pNextGroupMember; - result.push_back(pWindow); + result.push_back(HEAD->pWindow); - while (current != PNODE) { + while (current != HEAD) { result.push_back(current->pWindow); current = current->pNextGroupMember; } @@ -939,6 +944,9 @@ void CHyprDwindleLayout::switchGroupWindow(CWindow* pWindow, bool forward) { pNewNode->pWindow->m_vRealSize.warp(); pNewNode->pWindow->m_vRealPosition.warp(); } + + pNewNode->pWindow->updateWindowDecos(); + PNODE->pWindow->updateWindowDecos(); } SWindowRenderLayoutHints CHyprDwindleLayout::requestRenderHints(CWindow* pWindow) { diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index eadcd1678..08e3540cc 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -3,7 +3,6 @@ CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) { m_pWindow = pWindow; - updateWindow(pWindow); } CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {