From d99df236c5749b363b7735d81617b9c606e4a803 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Wed, 31 May 2023 22:43:30 -0700 Subject: [PATCH] Force root recalc when selection changes Fixes bugs related to window hidden state and tab groups --- src/Hy3Layout.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp index 82dc6ef..8e9b953 100644 --- a/src/Hy3Layout.cpp +++ b/src/Hy3Layout.cpp @@ -882,11 +882,9 @@ void Hy3Layout::onWindowFocusChange(CWindow* window) { auto* node = this->getNodeFromWindow(window); if (node == nullptr) return; - if (node->parent != nullptr && node->parent->data.as_group.layout == Hy3GroupLayout::Tabbed) { - node->parent->recalcSizePosRecursive(); - } - node->markFocused(); + while (node->parent != nullptr) node = node->parent; + node->recalcSizePosRecursive(); } bool Hy3Layout::isWindowTiled(CWindow* window) { @@ -1347,6 +1345,8 @@ void Hy3Layout::shiftFocus(int workspace, ShiftDirection direction) { Hy3Node* target; if ((target = this->shiftOrGetFocus(*node, direction, false, false))) { target->focus(); + while (target->parent != nullptr) target = target->parent; + target->recalcSizePosRecursive(); } } @@ -1384,7 +1384,6 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(Hy3Node& node, ShiftDirection direction, boo auto& group = break_parent->data.as_group; // must be a group in order to be a parent - if (shiftMatchesLayout(group.layout, direction)) { // group has the correct orientation