3107efb73e4474c4a271405e7f8093220f3b399c
- Author
- outfoxxed <outfoxxed@outfoxxed.me>
- Committer
- outfoxxed <outfoxxed@outfoxxed.me>
- Date
Message
Wrap raiseFocus to the lowest window from the root
Diff
1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
2index eeaa1750ac16bb29dc21b4cf5fb165215eb15b70..dde6aece2b020c5847a9dcb100b6592196898113 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -1620,9 +1620,16 @@ void Hy3Layout::raiseFocus(int workspace) {
6 auto* node = this->getWorkspaceFocusedNode(workspace);
7 if (node == nullptr) return;
8
9- if (node->parent != nullptr && node->parent->parent != nullptr) {
10+ if (node->parent != nullptr) {
11 node->parent->focus();
12 node->parent->updateDecos();
13+ } else {
14+ // trace focus as far as possible
15+ while (node->data.type == Hy3NodeData::Group && node->data.as_group.focused_child != nullptr) {
16+ node = node->data.as_group.focused_child;
17+ }
18+
19+ node->focus();
20 }
21 }
22
23@@ -1697,7 +1704,7 @@ bool Hy3Layout::shouldRenderSelected(CWindow* window) {
24 if (focused == nullptr) return false;
25
26 switch (focused->data.type) {
27- case Hy3NodeData::Window: return false;
28+ case Hy3NodeData::Window: return focused->data.as_window == window;
29 case Hy3NodeData::Group:
30 auto* node = this->getNodeFromWindow(window);
31 if (node == nullptr) return false;