Skip to content

set value and goal for window size and position on setGroupCurrent #11120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,10 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {

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

const auto PWINDOWSIZE = PCURRENT->m_realSize->goal();
const auto PWINDOWPOS = PCURRENT->m_realPosition->goal();
const auto PWINDOWSIZE = PCURRENT->m_realSize->value();
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 PWINDOWLASTFLOATINGPOSITION = PCURRENT->m_lastFloatingPosition;

Expand All @@ -1054,8 +1056,14 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {

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

pWindow->m_realPosition->setValueAndWarp(PWINDOWPOS);
pWindow->m_realSize->setValueAndWarp(PWINDOWSIZE);
if (PCURRENT->m_isFloating) {
pWindow->m_realPosition->setValueAndWarp(PWINDOWPOSGOAL);
pWindow->m_realSize->setValueAndWarp(PWINDOWSIZEGOAL);
pWindow->sendWindowSize();
}

pWindow->m_realPosition->setValue(PWINDOWPOS);
pWindow->m_realSize->setValue(PWINDOWSIZE);

if (FULLSCREEN)
g_pCompositor->setWindowFullscreenInternal(pWindow, MODE);
Expand All @@ -1077,13 +1085,11 @@ void CWindow::insertWindowToGroup(PHLWINDOW pWindow) {
const auto BEGINAT = m_self.lock();
const auto ENDAT = m_groupData.pNextWindow.lock();

if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));

if (!pWindow->m_groupData.pNextWindow.lock()) {
BEGINAT->m_groupData.pNextWindow = pWindow;
pWindow->m_groupData.pNextWindow = ENDAT;
pWindow->m_groupData.head = false;
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
return;
}

Expand Down
11 changes: 3 additions & 8 deletions src/layout/IHyprLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ void IHyprLayout::onWindowRemoved(PHLWINDOW pWindow) {
g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE);

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();
else {
pWindow->updateWindowDecos();
} else {
// find last window and update
PHLWINDOW PWINDOWPREV = pWindow->getGroupPrevious();
const auto WINDOWISVISIBLE = pWindow->getGroupCurrent() == pWindow;
Expand Down Expand Up @@ -226,9 +227,6 @@ bool IHyprLayout::onWindowCreatedAutoGroup(PHLWINDOW pWindow) {
pWindow->updateWindowDecos();
recalculateWindow(pWindow);

if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));

return true;
}

Expand Down Expand Up @@ -355,9 +353,6 @@ void IHyprLayout::onEndDragWindow() {
pWindow->setGroupCurrent(DRAGGINGWINDOW);
DRAGGINGWINDOW->applyGroupRules();
DRAGGINGWINDOW->updateWindowDecos();

if (!DRAGGINGWINDOW->getDecorationByType(DECORATION_GROUPBAR))
DRAGGINGWINDOW->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(DRAGGINGWINDOW));
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2942,9 +2942,6 @@ void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowIn
g_pCompositor->focusWindow(pWindow);
pWindow->warpCursor();

if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));

g_pEventManager->postEvent(SHyprIPCEvent{"moveintogroup", std::format("{:x}", (uintptr_t)pWindow.get())});
}

Expand Down
Loading