fix dwindle groupbars

This commit is contained in:
vaxerski 2022-08-29 19:52:35 +02:00
parent 20c050e890
commit 179562b646
4 changed files with 22 additions and 5 deletions

View file

@ -233,3 +233,12 @@ CWindow* CWindow::X11TransientFor() {
return PPARENT; return PPARENT;
} }
void CWindow::removeDecorationByType(eDecorationType type) {
for (auto& wd : m_dWindowDecorations) {
if (wd->getDecorationType() == type)
m_vDecosToRemove.push_back(wd.get());
}
updateWindowDecos();
}

View file

@ -154,6 +154,7 @@ public:
void updateWindowDecos(); void updateWindowDecos();
pid_t getPID(); pid_t getPID();
IHyprWindowDecoration* getDecorationByType(eDecorationType); IHyprWindowDecoration* getDecorationByType(eDecorationType);
void removeDecorationByType(eDecorationType);
void createToplevelHandle(); void createToplevelHandle();
void destroyToplevelHandle(); void destroyToplevelHandle();
void updateToplevel(); void updateToplevel();

View file

@ -803,6 +803,7 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) {
for (auto& pw : toAddWindows) { for (auto& pw : toAddWindows) {
onWindowCreated(pw); onWindowCreated(pw);
pw->removeDecorationByType(DECORATION_GROUPBAR);
} }
recalculateMonitor(PWORKSPACE->m_iMonitorID); recalculateMonitor(PWORKSPACE->m_iMonitorID);
@ -862,6 +863,9 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) {
newGroupMembers[i]->pPreviousGroupMember = PREVMEMBER; newGroupMembers[i]->pPreviousGroupMember = PREVMEMBER;
newGroupMembers[i]->pNextGroupMember = NEXTMEMBER; newGroupMembers[i]->pNextGroupMember = NEXTMEMBER;
// add the deco
newGroupMembers[i]->pWindow->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(newGroupMembers[i]->pWindow));
} }
// focus // focus
@ -883,14 +887,15 @@ std::deque<CWindow*> CHyprDwindleLayout::getGroupMembers(CWindow* pWindow) {
// get the node // get the node
const auto PNODE = getNodeFromWindow(pWindow); const auto PNODE = getNodeFromWindow(pWindow);
if (!PNODE) if (!PNODE || !PNODE->isGroupMember())
return result; // reject with empty 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); result.push_back(current->pWindow);
current = current->pNextGroupMember; current = current->pNextGroupMember;
} }
@ -939,6 +944,9 @@ void CHyprDwindleLayout::switchGroupWindow(CWindow* pWindow, bool forward) {
pNewNode->pWindow->m_vRealSize.warp(); pNewNode->pWindow->m_vRealSize.warp();
pNewNode->pWindow->m_vRealPosition.warp(); pNewNode->pWindow->m_vRealPosition.warp();
} }
pNewNode->pWindow->updateWindowDecos();
PNODE->pWindow->updateWindowDecos();
} }
SWindowRenderLayoutHints CHyprDwindleLayout::requestRenderHints(CWindow* pWindow) { SWindowRenderLayoutHints CHyprDwindleLayout::requestRenderHints(CWindow* pWindow) {

View file

@ -3,7 +3,6 @@
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) { CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) {
m_pWindow = pWindow; m_pWindow = pWindow;
updateWindow(pWindow);
} }
CHyprGroupBarDecoration::~CHyprGroupBarDecoration() { CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {