diff options
author | Aqa-Ib <[email protected]> | 2024-10-30 10:00:58 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-30 10:00:58 +0000 |
commit | 5f721dce36651232ae245d872c17dfa3aae5cc6c (patch) | |
tree | 6db9c78da825d1873209f54341552e8b795d024d | |
parent | d679d200299ed4670f0d0f138c793d5f507b7cec (diff) | |
download | Hyprland-5f721dce36651232ae245d872c17dfa3aae5cc6c.tar.gz Hyprland-5f721dce36651232ae245d872c17dfa3aae5cc6c.zip |
group: fix moveWindowIntoGroup (#8297)
-rw-r--r-- | src/layout/IHyprLayout.cpp | 19 | ||||
-rw-r--r-- | src/managers/KeybindManager.cpp | 3 | ||||
-rw-r--r-- | src/render/decorations/CHyprGroupBarDecoration.cpp | 6 |
3 files changed, 12 insertions, 16 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index e3606532..f2616668 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -341,7 +341,9 @@ void IHyprLayout::onEndDragWindow() { const bool FLOATEDINTOTILED = !pWindow->m_bIsFloating && !DRAGGINGWINDOW->m_bDraggingTiled; static auto PDRAGINTOGROUP = CConfigValue<Hyprlang::INT>("group:drag_into_group"); + if (pWindow->m_sGroupData.pNextWindow.lock() && DRAGGINGWINDOW->canBeGroupedInto(pWindow) && *PDRAGINTOGROUP == 1 && !FLOATEDINTOTILED) { + if (DRAGGINGWINDOW->m_bDraggingTiled) { changeWindowFloatingMode(DRAGGINGWINDOW); DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize; @@ -349,17 +351,12 @@ void IHyprLayout::onEndDragWindow() { } if (DRAGGINGWINDOW->m_sGroupData.pNextWindow) { - std::vector<PHLWINDOW> members; - PHLWINDOW curr = DRAGGINGWINDOW->getGroupHead(); - do { - members.push_back(curr); - curr = curr->m_sGroupData.pNextWindow.lock(); - } while (curr != members[0]); - - for (auto it = members.begin(); it != members.end(); ++it) { - (*it)->m_bIsFloating = pWindow->m_bIsFloating; // match the floating state of group members - if (pWindow->m_bIsFloating) - (*it)->m_vRealSize = pWindow->m_vRealSize.goal(); // match the size of group members + PHLWINDOW next = DRAGGINGWINDOW->m_sGroupData.pNextWindow.lock(); + while (next != DRAGGINGWINDOW) { + next->m_bIsFloating = pWindow->m_bIsFloating; // match the floating state of group members + next->m_vRealSize = pWindow->m_vRealSize.goal(); // match the size of group members + next->m_vRealPosition = pWindow->m_vRealPosition.goal(); // match the position of group members + next = next->m_sGroupData.pNextWindow.lock(); } } diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index c2779c58..5be6a1d9 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -2665,9 +2665,8 @@ void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowIn } static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current"); - pWindowInDirection = *USECURRPOS ? pWindowInDirection : pWindowInDirection->getGroupTail(); + (*USECURRPOS ? pWindowInDirection : pWindowInDirection->getGroupTail())->insertWindowToGroup(pWindow); - pWindowInDirection->insertWindowToGroup(pWindow); pWindowInDirection->setGroupCurrent(pWindow); pWindow->updateWindowDecos(); g_pLayoutManager->getCurrentLayout()->recalculateWindow(pWindow); diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index e342e244..c9f812d7 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -439,9 +439,9 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND // restores the group for (auto it = members.begin(); it != members.end(); ++it) { - (*it)->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of group members - if (pWindowInsertAfter->m_bIsFloating) - (*it)->m_vRealSize = pWindowInsertAfter->m_vRealSize.goal(); // match the size of group members + (*it)->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of group members + (*it)->m_vRealSize = pWindowInsertAfter->m_vRealSize.goal(); // match the size of group members + (*it)->m_vRealPosition = pWindowInsertAfter->m_vRealPosition.goal(); // match the position of group members if (std::next(it) != members.end()) (*it)->m_sGroupData.pNextWindow = *std::next(it); else |