summaryrefslogtreecommitdiff
path: root/src/Window.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-02-19 22:19:40 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-02-19 22:19:40 +0000
commit40622a9e60fde4f99e75fec9c7754e78c0da7e16 (patch)
treee5ea90377331e1ed889c4f77383e0f7f42595aec /src/Window.cpp
parentdf2956b411bd9b8c3fbc750bfcc3e7268a59d739 (diff)
properly meld groups together
Diffstat (limited to 'src/Window.cpp')
-rw-r--r--src/Window.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Window.cpp b/src/Window.cpp
index 1ca35ab3..549133d5 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -531,6 +531,24 @@ void CWindow::insertWindowToGroup(CWindow* pWindow) {
const auto PHEAD = getGroupHead();
const auto PTAIL = getGroupTail();
+ if (pWindow->m_sGroupData.pNextWindow) {
+ std::vector<CWindow*> members;
+ CWindow* curr = pWindow;
+ do {
+ const auto PLAST = curr;
+ members.push_back(curr);
+ curr = curr->m_sGroupData.pNextWindow;
+ PLAST->m_sGroupData.pNextWindow = nullptr;
+ PLAST->m_sGroupData.head = false;
+ } while (curr != pWindow);
+
+ for (auto& w : members) {
+ insertWindowToGroup(w);
+ }
+
+ return;
+ }
+
PTAIL->m_sGroupData.pNextWindow = pWindow;
pWindow->m_sGroupData.pNextWindow = PHEAD;