diff options
author | MightyPlaza <[email protected]> | 2023-07-03 10:49:56 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2023-07-03 12:49:56 +0200 |
commit | 05047f60f4a6303a26f5ecef712f249b770f27b9 (patch) | |
tree | 10cca6c3f8f095be53d162ddafa64d0401530026 /src/layout/MasterLayout.cpp | |
parent | 738ec900f4d5c5e2b00f90e71221ca380555b874 (diff) | |
download | Hyprland-05047f60f4a6303a26f5ecef712f249b770f27b9.tar.gz Hyprland-05047f60f4a6303a26f5ecef712f249b770f27b9.zip |
groupbar fixes (#2630)
Fixes multiple groupbar decoration issues:
- togglegroup removes fullscreen to avoid to avoid weird state
- fixes issue where a group had multiple windows with head = true
- fixes issue where merging 2 groups would cause a window to have 2 groupbar decorations
- fixes issue where merging a group with more than 1 window into another group would make windows have no groupbar decoration
- fixes issue where ungrouping windows could just move them into another group on the same workspace
---------
Co-authored-by: vaxerski <[email protected]>
Diffstat (limited to 'src/layout/MasterLayout.cpp')
-rw-r--r-- | src/layout/MasterLayout.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 494fd7a2..b7e5a1bf 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -91,16 +91,34 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow) { getNodeFromWindow(g_pCompositor->m_pLastWindow) : getMasterNodeOnWorkspace(pWindow->m_iWorkspaceID); - if (OPENINGON && OPENINGON->pWindow->m_sGroupData.pNextWindow && !OPENINGON->pWindow->getGroupHead()->m_sGroupData.locked && // target is an unlocked group - (!pWindow->m_sGroupData.pNextWindow || !pWindow->getGroupHead()->m_sGroupData.locked) // source is not group or is an unlocked group - && OPENINGON != PNODE && !g_pKeybindManager->m_bGroupsLocked) { - m_lMasterNodesData.remove(*PNODE); + // if it's a group, add the window + if (OPENINGON && OPENINGON->pWindow->m_sGroupData.pNextWindow && !OPENINGON->pWindow->getGroupHead()->m_sGroupData.locked && !g_pKeybindManager->m_bGroupsLocked && + OPENINGON != PNODE) { // target is an unlocked group - OPENINGON->pWindow->insertWindowToGroup(pWindow); + if (!pWindow->m_sGroupData.pNextWindow) { // source is not a group + m_lMasterNodesData.remove(*PNODE); + OPENINGON->pWindow->insertWindowToGroup(pWindow); + OPENINGON->pWindow->setGroupCurrent(pWindow); - pWindow->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(pWindow)); + pWindow->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(pWindow)); + pWindow->updateWindowDecos(); + recalculateWindow(pWindow); - return; + g_pCompositor->focusWindow(pWindow); + return; + } + + if (!pWindow->getGroupHead()->m_sGroupData.locked) { // source is an unlocked group + m_lMasterNodesData.remove(*PNODE); + OPENINGON->pWindow->insertWindowToGroup(pWindow); + OPENINGON->pWindow->setGroupCurrent(pWindow); + + pWindow->updateWindowDecos(); + recalculateWindow(pWindow); + + g_pCompositor->focusWindow(pWindow); + return; + } } if (*PNEWISMASTER || WINDOWSONWORKSPACE == 1 || (!pWindow->m_bFirstMap && OPENINGON->isMaster)) { @@ -276,7 +294,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) { if ((WINDOWS < 2) && !centerMasterWindow) { PMASTERNODE->position = PMONITOR->vecReservedTopLeft + PMONITOR->vecPosition; PMASTERNODE->size = Vector2D(PMONITOR->vecSize.x - PMONITOR->vecReservedTopLeft.x - PMONITOR->vecReservedBottomRight.x, - PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y); + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PMONITOR->vecReservedTopLeft.y); applyNodeDataToWindow(PMASTERNODE); return; } else if (orientation == ORIENTATION_LEFT || orientation == ORIENTATION_RIGHT || (orientation == ORIENTATION_CENTER && STACKWINDOWS <= 1)) { |