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;
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();
}
}

View file

@ -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);

View file

@ -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