Skip to content

Commit d4de693

Browse files
authored
internal: set value and goal for window size and position on setGroupCurrent (#11120)
1 parent 503fc45 commit d4de693

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

src/desktop/Window.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,8 +1045,10 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
10451045

10461046
const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_lastWindow.lock();
10471047

1048-
const auto PWINDOWSIZE = PCURRENT->m_realSize->goal();
1049-
const auto PWINDOWPOS = PCURRENT->m_realPosition->goal();
1048+
const auto PWINDOWSIZE = PCURRENT->m_realSize->value();
1049+
const auto PWINDOWPOS = PCURRENT->m_realPosition->value();
1050+
const auto PWINDOWSIZEGOAL = PCURRENT->m_realSize->goal();
1051+
const auto PWINDOWPOSGOAL = PCURRENT->m_realPosition->goal();
10501052
const auto PWINDOWLASTFLOATINGSIZE = PCURRENT->m_lastFloatingSize;
10511053
const auto PWINDOWLASTFLOATINGPOSITION = PCURRENT->m_lastFloatingPosition;
10521054

@@ -1058,8 +1060,14 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
10581060

10591061
g_pLayoutManager->getCurrentLayout()->replaceWindowDataWith(PCURRENT, pWindow);
10601062

1061-
pWindow->m_realPosition->setValueAndWarp(PWINDOWPOS);
1062-
pWindow->m_realSize->setValueAndWarp(PWINDOWSIZE);
1063+
if (PCURRENT->m_isFloating) {
1064+
pWindow->m_realPosition->setValueAndWarp(PWINDOWPOSGOAL);
1065+
pWindow->m_realSize->setValueAndWarp(PWINDOWSIZEGOAL);
1066+
pWindow->sendWindowSize();
1067+
}
1068+
1069+
pWindow->m_realPosition->setValue(PWINDOWPOS);
1070+
pWindow->m_realSize->setValue(PWINDOWSIZE);
10631071

10641072
if (FULLSCREEN)
10651073
g_pCompositor->setWindowFullscreenInternal(pWindow, MODE);
@@ -1081,13 +1089,11 @@ void CWindow::insertWindowToGroup(PHLWINDOW pWindow) {
10811089
const auto BEGINAT = m_self.lock();
10821090
const auto ENDAT = m_groupData.pNextWindow.lock();
10831091

1084-
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
1085-
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
1086-
10871092
if (!pWindow->m_groupData.pNextWindow.lock()) {
10881093
BEGINAT->m_groupData.pNextWindow = pWindow;
10891094
pWindow->m_groupData.pNextWindow = ENDAT;
10901095
pWindow->m_groupData.head = false;
1096+
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
10911097
return;
10921098
}
10931099

src/layout/IHyprLayout.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ void IHyprLayout::onWindowRemoved(PHLWINDOW pWindow) {
4949
g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE);
5050

5151
if (!pWindow->m_groupData.pNextWindow.expired()) {
52-
if (pWindow->m_groupData.pNextWindow.lock() == pWindow)
52+
if (pWindow->m_groupData.pNextWindow.lock() == pWindow) {
5353
pWindow->m_groupData.pNextWindow.reset();
54-
else {
54+
pWindow->updateWindowDecos();
55+
} else {
5556
// find last window and update
5657
PHLWINDOW PWINDOWPREV = pWindow->getGroupPrevious();
5758
const auto WINDOWISVISIBLE = pWindow->getGroupCurrent() == pWindow;
@@ -226,9 +227,6 @@ bool IHyprLayout::onWindowCreatedAutoGroup(PHLWINDOW pWindow) {
226227
pWindow->updateWindowDecos();
227228
recalculateWindow(pWindow);
228229

229-
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
230-
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
231-
232230
return true;
233231
}
234232

@@ -355,9 +353,6 @@ void IHyprLayout::onEndDragWindow() {
355353
pWindow->setGroupCurrent(DRAGGINGWINDOW);
356354
DRAGGINGWINDOW->applyGroupRules();
357355
DRAGGINGWINDOW->updateWindowDecos();
358-
359-
if (!DRAGGINGWINDOW->getDecorationByType(DECORATION_GROUPBAR))
360-
DRAGGINGWINDOW->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(DRAGGINGWINDOW));
361356
}
362357
}
363358
}

src/managers/KeybindManager.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,9 +2942,6 @@ void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowIn
29422942
g_pCompositor->focusWindow(pWindow);
29432943
pWindow->warpCursor();
29442944

2945-
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
2946-
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
2947-
29482945
g_pEventManager->postEvent(SHyprIPCEvent{"moveintogroup", std::format("{:x}", (uintptr_t)pWindow.get())});
29492946
}
29502947

0 commit comments

Comments
 (0)