group: fix moveWindowIntoGroup (#8297)

This commit is contained in:
Aqa-Ib 2024-10-30 10:00:58 +00:00 committed by GitHub
parent d679d20029
commit 5f721dce36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 16 deletions

View file

@ -341,7 +341,9 @@ void IHyprLayout::onEndDragWindow() {
const bool FLOATEDINTOTILED = !pWindow->m_bIsFloating && !DRAGGINGWINDOW->m_bDraggingTiled; const bool FLOATEDINTOTILED = !pWindow->m_bIsFloating && !DRAGGINGWINDOW->m_bDraggingTiled;
static auto PDRAGINTOGROUP = CConfigValue<Hyprlang::INT>("group:drag_into_group"); static auto PDRAGINTOGROUP = CConfigValue<Hyprlang::INT>("group:drag_into_group");
if (pWindow->m_sGroupData.pNextWindow.lock() && DRAGGINGWINDOW->canBeGroupedInto(pWindow) && *PDRAGINTOGROUP == 1 && !FLOATEDINTOTILED) { if (pWindow->m_sGroupData.pNextWindow.lock() && DRAGGINGWINDOW->canBeGroupedInto(pWindow) && *PDRAGINTOGROUP == 1 && !FLOATEDINTOTILED) {
if (DRAGGINGWINDOW->m_bDraggingTiled) { if (DRAGGINGWINDOW->m_bDraggingTiled) {
changeWindowFloatingMode(DRAGGINGWINDOW); changeWindowFloatingMode(DRAGGINGWINDOW);
DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize; DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize;
@ -349,17 +351,12 @@ void IHyprLayout::onEndDragWindow() {
} }
if (DRAGGINGWINDOW->m_sGroupData.pNextWindow) { if (DRAGGINGWINDOW->m_sGroupData.pNextWindow) {
std::vector<PHLWINDOW> members; PHLWINDOW next = DRAGGINGWINDOW->m_sGroupData.pNextWindow.lock();
PHLWINDOW curr = DRAGGINGWINDOW->getGroupHead(); while (next != DRAGGINGWINDOW) {
do { next->m_bIsFloating = pWindow->m_bIsFloating; // match the floating state of group members
members.push_back(curr); next->m_vRealSize = pWindow->m_vRealSize.goal(); // match the size of group members
curr = curr->m_sGroupData.pNextWindow.lock(); next->m_vRealPosition = pWindow->m_vRealPosition.goal(); // match the position of group members
} while (curr != members[0]); next = next->m_sGroupData.pNextWindow.lock();
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
} }
} }

View file

@ -2665,9 +2665,8 @@ void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowIn
} }
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current"); 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); pWindowInDirection->setGroupCurrent(pWindow);
pWindow->updateWindowDecos(); pWindow->updateWindowDecos();
g_pLayoutManager->getCurrentLayout()->recalculateWindow(pWindow); g_pLayoutManager->getCurrentLayout()->recalculateWindow(pWindow);

View file

@ -440,8 +440,8 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
// restores the group // restores the group
for (auto it = members.begin(); it != members.end(); ++it) { for (auto it = members.begin(); it != members.end(); ++it) {
(*it)->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of group members (*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_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()) if (std::next(it) != members.end())
(*it)->m_sGroupData.pNextWindow = *std::next(it); (*it)->m_sGroupData.pNextWindow = *std::next(it);
else else