From 214c2c7b1c0182594a07a2c5ac7d99e9d7b5fcb3 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sat, 13 Aug 2022 10:08:35 +0200 Subject: [PATCH] fix groups not updating size on head change --- src/layout/DwindleLayout.cpp | 22 ++++++++++++++++++++++ src/layout/DwindleLayout.hpp | 1 + 2 files changed, 23 insertions(+) diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index fa9cbeab..192fe7c2 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -63,6 +63,20 @@ SDwindleNodeData* SDwindleNodeData::getGroupHead() { return this; } +SDwindleNodeData* SDwindleNodeData::getGroupVisible() { + SDwindleNodeData* current = this->pNextGroupMember; + + while (current != this) { + if (!current->pWindow->m_bHidden) { + return current; + } + + current = current->pNextGroupMember; + } + + return this; +} + void SDwindleNodeData::setGroupFocusedNode(SDwindleNodeData* pMember) { SDwindleNodeData* current = this->pNextGroupMember; @@ -222,6 +236,14 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for PWINDOW->m_vRealSize.warp(); } + if (pNode->isGroupMember() && pNode->groupHead) { + // update visible node + const auto PVISNODE = pNode->getGroupVisible(); + + PVISNODE->pWindow->m_vRealSize = PWINDOW->m_vRealSize.goalv(); + PVISNODE->pWindow->m_vRealPosition = PWINDOW->m_vRealPosition.goalv(); + } + PWINDOW->updateWindowDecos(); } diff --git a/src/layout/DwindleLayout.hpp b/src/layout/DwindleLayout.hpp index fa171841..64c6a29d 100644 --- a/src/layout/DwindleLayout.hpp +++ b/src/layout/DwindleLayout.hpp @@ -40,6 +40,7 @@ struct SDwindleNodeData { void getAllChildrenRecursive(std::deque*); bool isGroupMember(); SDwindleNodeData* getGroupHead(); + SDwindleNodeData* getGroupVisible(); void setGroupFocusedNode(SDwindleNodeData*); CHyprDwindleLayout* layout = nullptr; };