internal: set value and goal for window size and position on setGroupCurrent (#11120)

This commit is contained in:
MightyPlaza
2025-07-20 15:00:17 +00:00
committed by GitHub
parent 503fc458d8
commit d4de69381e
3 changed files with 16 additions and 18 deletions

View File

@@ -1045,8 +1045,10 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_lastWindow.lock(); const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_lastWindow.lock();
const auto PWINDOWSIZE = PCURRENT->m_realSize->goal(); const auto PWINDOWSIZE = PCURRENT->m_realSize->value();
const auto PWINDOWPOS = PCURRENT->m_realPosition->goal(); const auto PWINDOWPOS = PCURRENT->m_realPosition->value();
const auto PWINDOWSIZEGOAL = PCURRENT->m_realSize->goal();
const auto PWINDOWPOSGOAL = PCURRENT->m_realPosition->goal();
const auto PWINDOWLASTFLOATINGSIZE = PCURRENT->m_lastFloatingSize; const auto PWINDOWLASTFLOATINGSIZE = PCURRENT->m_lastFloatingSize;
const auto PWINDOWLASTFLOATINGPOSITION = PCURRENT->m_lastFloatingPosition; const auto PWINDOWLASTFLOATINGPOSITION = PCURRENT->m_lastFloatingPosition;
@@ -1058,8 +1060,14 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
g_pLayoutManager->getCurrentLayout()->replaceWindowDataWith(PCURRENT, pWindow); g_pLayoutManager->getCurrentLayout()->replaceWindowDataWith(PCURRENT, pWindow);
pWindow->m_realPosition->setValueAndWarp(PWINDOWPOS); if (PCURRENT->m_isFloating) {
pWindow->m_realSize->setValueAndWarp(PWINDOWSIZE); pWindow->m_realPosition->setValueAndWarp(PWINDOWPOSGOAL);
pWindow->m_realSize->setValueAndWarp(PWINDOWSIZEGOAL);
pWindow->sendWindowSize();
}
pWindow->m_realPosition->setValue(PWINDOWPOS);
pWindow->m_realSize->setValue(PWINDOWSIZE);
if (FULLSCREEN) if (FULLSCREEN)
g_pCompositor->setWindowFullscreenInternal(pWindow, MODE); g_pCompositor->setWindowFullscreenInternal(pWindow, MODE);
@@ -1081,13 +1089,11 @@ void CWindow::insertWindowToGroup(PHLWINDOW pWindow) {
const auto BEGINAT = m_self.lock(); const auto BEGINAT = m_self.lock();
const auto ENDAT = m_groupData.pNextWindow.lock(); const auto ENDAT = m_groupData.pNextWindow.lock();
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
if (!pWindow->m_groupData.pNextWindow.lock()) { if (!pWindow->m_groupData.pNextWindow.lock()) {
BEGINAT->m_groupData.pNextWindow = pWindow; BEGINAT->m_groupData.pNextWindow = pWindow;
pWindow->m_groupData.pNextWindow = ENDAT; pWindow->m_groupData.pNextWindow = ENDAT;
pWindow->m_groupData.head = false; pWindow->m_groupData.head = false;
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
return; return;
} }

View File

@@ -49,9 +49,10 @@ void IHyprLayout::onWindowRemoved(PHLWINDOW pWindow) {
g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE); g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE);
if (!pWindow->m_groupData.pNextWindow.expired()) { if (!pWindow->m_groupData.pNextWindow.expired()) {
if (pWindow->m_groupData.pNextWindow.lock() == pWindow) if (pWindow->m_groupData.pNextWindow.lock() == pWindow) {
pWindow->m_groupData.pNextWindow.reset(); pWindow->m_groupData.pNextWindow.reset();
else { pWindow->updateWindowDecos();
} else {
// find last window and update // find last window and update
PHLWINDOW PWINDOWPREV = pWindow->getGroupPrevious(); PHLWINDOW PWINDOWPREV = pWindow->getGroupPrevious();
const auto WINDOWISVISIBLE = pWindow->getGroupCurrent() == pWindow; const auto WINDOWISVISIBLE = pWindow->getGroupCurrent() == pWindow;
@@ -226,9 +227,6 @@ bool IHyprLayout::onWindowCreatedAutoGroup(PHLWINDOW pWindow) {
pWindow->updateWindowDecos(); pWindow->updateWindowDecos();
recalculateWindow(pWindow); recalculateWindow(pWindow);
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
return true; return true;
} }
@@ -355,9 +353,6 @@ void IHyprLayout::onEndDragWindow() {
pWindow->setGroupCurrent(DRAGGINGWINDOW); pWindow->setGroupCurrent(DRAGGINGWINDOW);
DRAGGINGWINDOW->applyGroupRules(); DRAGGINGWINDOW->applyGroupRules();
DRAGGINGWINDOW->updateWindowDecos(); DRAGGINGWINDOW->updateWindowDecos();
if (!DRAGGINGWINDOW->getDecorationByType(DECORATION_GROUPBAR))
DRAGGINGWINDOW->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(DRAGGINGWINDOW));
} }
} }
} }

View File

@@ -2942,9 +2942,6 @@ void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowIn
g_pCompositor->focusWindow(pWindow); g_pCompositor->focusWindow(pWindow);
pWindow->warpCursor(); pWindow->warpCursor();
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
g_pEventManager->postEvent(SHyprIPCEvent{"moveintogroup", std::format("{:x}", (uintptr_t)pWindow.get())}); g_pEventManager->postEvent(SHyprIPCEvent{"moveintogroup", std::format("{:x}", (uintptr_t)pWindow.get())});
} }