cffbfbe63d11a089d0264f12dbdb1869bd3e7cfd

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

Message

Fix window lastFocusedChild not being updated

Diff

 1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
 2index 42ad550c3eb3f8c610d9809f5d44cf4fd00d6ad2..bc17624cc38ef1d97f9b6031e6d2e2db03211985 100644
 3--- a/src/Hy3Layout.cpp
 4+++ b/src/Hy3Layout.cpp
 5@@ -551,10 +551,15 @@ CWindow* Hy3Layout::getNextWindowCandidate(CWindow* window) {
 6 
 7 void Hy3Layout::onWindowFocusChange(CWindow* window) {
 8 	Debug::log(LOG, "Switched windows from %p to %p", this->lastActiveWindow, window);
 9+	this->lastActiveWindow = window;
10 	auto* node = this->getNodeFromWindow(this->lastActiveWindow);
11-	if (node != nullptr) Debug::log(LOG, "Switched focused node to %p (parent: %p)", node, node->parent);
12+	if (node == nullptr) return;
13+	Debug::log(LOG, "Switched focused node to %p (parent: %p)", node, node->parent);
14 
15-	this->lastActiveWindow = window;
16+	while (node->parent != nullptr) {
17+		node->parent->data.as_group.lastFocusedChild = node;
18+		node = node->parent;
19+	}
20 }
21 
22 bool Hy3Layout::isWindowTiled(CWindow* window) {