bd3d973fbf165b46a39d3d45208066cf59a0c440

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

Fix unintentional group swallowing when closing a window

Diff

 1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
 2index c250424054279ad55a3dcca613dbcbbdc5d6a0b9..42ad550c3eb3f8c610d9809f5d44cf4fd00d6ad2 100644
 3--- a/src/Hy3Layout.cpp
 4+++ b/src/Hy3Layout.cpp
 5@@ -526,15 +526,20 @@ void Hy3Layout::onWindowRemovedTiling(CWindow* window) {
 6 
 7 	if (parent != nullptr) {
 8 		parent->recalcSizePosRecursive();
 9-	}
10 
11-	auto* target_parent = parent;
12-	while (target_parent != nullptr && swallowGroup(target_parent)) {
13-		target_parent = target_parent->parent;
14+		if (parent->data.as_group.children.size() == 1
15+				&& parent->data.as_group.children.front()->data.type == Hy3NodeData::Group)
16+		{
17+			auto* target_parent = parent;
18+			while (target_parent != nullptr && swallowGroup(target_parent)) {
19+				target_parent = target_parent->parent;
20+			}
21+
22+			if (target_parent != parent && target_parent != nullptr)
23+				target_parent->recalcSizePosRecursive();
24+		}
25 	}
26 
27-	if (target_parent != parent && target_parent != nullptr)
28-		target_parent->recalcSizePosRecursive();
29 }
30 
31 CWindow* Hy3Layout::getNextWindowCandidate(CWindow* window) {