summaryrefslogtreecommitdiff
path: root/src/layout/IHyprLayout.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2023-02-19 21:07:32 +0000
committerGitHub <noreply@github.com>2023-02-19 21:07:32 +0000
commite5a4c0c986f72813e8822f31ed3d5fa6be1b6c13 (patch)
tree8ce0ad44055c63e905303f49da61c9f44316170a /src/layout/IHyprLayout.cpp
parent2363cc2572c8b1f99a3ac5ff4104067b0503a302 (diff)
Group/Tab Rework (#1580)
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
-rw-r--r--src/layout/IHyprLayout.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index d62556d5..60a0e2ff 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -24,6 +24,36 @@ void IHyprLayout::onWindowRemoved(CWindow* pWindow) {
if (pWindow->m_bIsFullscreen)
g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL);
+ if (pWindow->m_sGroupData.pNextWindow) {
+ if (pWindow->m_sGroupData.pNextWindow == pWindow)
+ pWindow->m_sGroupData.pNextWindow = nullptr;
+ else {
+ // find last window and update
+ CWindow* curr = pWindow;
+ const auto CURRWASVISIBLE = curr->getGroupCurrent() == curr;
+
+ while (curr->m_sGroupData.pNextWindow != pWindow)
+ curr = curr->m_sGroupData.pNextWindow;
+
+ if (CURRWASVISIBLE)
+ curr->setGroupCurrent(curr);
+
+ curr->m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow;
+
+ pWindow->m_sGroupData.pNextWindow = nullptr;
+
+ if (pWindow->m_sGroupData.head) {
+ pWindow->m_sGroupData.head = false;
+ curr->m_sGroupData.head = true;
+ }
+
+ if (pWindow == m_pLastTiledWindow)
+ m_pLastTiledWindow = nullptr;
+
+ return;
+ }
+ }
+
if (pWindow->m_bIsFloating) {
onWindowRemovedFloating(pWindow);
} else {