Fix tab bar not being updated with group changes

Closes #27
This commit is contained in:
outfoxxed 2023-10-23 02:31:38 -07:00
parent 07c98ab654
commit 0862855b87
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E

View file

@ -822,6 +822,7 @@ void Hy3Layout::makeGroupOn(
if (group.children.size() == 1) { if (group.children.size() == 1) {
group.setLayout(layout); group.setLayout(layout);
group.setEphemeral(ephemeral); group.setEphemeral(ephemeral);
node->parent->updateTabBarRecursive();
node->parent->recalcSizePosRecursive(); node->parent->recalcSizePosRecursive();
return; return;
} }
@ -860,6 +861,7 @@ void Hy3Layout::changeGroupOn(Hy3Node& node, Hy3GroupLayout layout) {
auto& group = node.parent->data.as_group; auto& group = node.parent->data.as_group;
group.setLayout(layout); group.setLayout(layout);
node.parent->updateTabBarRecursive();
node.parent->recalcSizePosRecursive(); node.parent->recalcSizePosRecursive();
} }
@ -910,6 +912,7 @@ void Hy3Layout::shiftNode(Hy3Node& node, ShiftDirection direction, bool once, bo
auto* node2 = node.parent; auto* node2 = node.parent;
Hy3Node::swapData(node, *node2); Hy3Node::swapData(node, *node2);
node2->layout->nodes.remove(node); node2->layout->nodes.remove(node);
node2->updateTabBarRecursive();
node2->recalcSizePosRecursive(); node2->recalcSizePosRecursive();
} }
} else { } else {
@ -928,8 +931,8 @@ void Hy3Layout::shiftFocus(int workspace, ShiftDirection direction, bool visible
auto* node = this->getWorkspaceFocusedNode(workspace); auto* node = this->getWorkspaceFocusedNode(workspace);
if (node == nullptr) return; if (node == nullptr) return;
Hy3Node* target; auto* target = this->shiftOrGetFocus(*node, direction, false, false, visible);
if ((target = this->shiftOrGetFocus(*node, direction, false, false, visible))) { if (target != nullptr) {
target->focus(); target->focus();
while (target->parent != nullptr) target = target->parent; while (target->parent != nullptr) target = target->parent;
target->recalcSizePosRecursive(); target->recalcSizePosRecursive();
@ -1701,6 +1704,7 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(
Hy3Node::swallowGroups(old_parent); Hy3Node::swallowGroups(old_parent);
} }
old_parent->updateTabBarRecursive();
old_parent->recalcSizePosRecursive(); old_parent->recalcSizePosRecursive();
} }
@ -1711,6 +1715,7 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(
target_parent = target_parent->parent; target_parent = target_parent->parent;
} }
node.updateTabBarRecursive();
node.focus(); node.focus();
if (target_parent != target_group && target_parent != nullptr) if (target_parent != target_group && target_parent != nullptr)