bfd56ab9403f6a571a4761c2187909352ee70938
- Author
- outfoxxed <outfoxxed@outfoxxed.me>
- Committer
- outfoxxed <outfoxxed@outfoxxed.me>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
2index 5a7973df084b41c9a909343f4d951709a1ab306b..cb386ffbbe6efde9ff49a6ea33b8b6ea17e1fdf0 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -238,8 +238,10 @@ void Hy3Layout::onWindowRemovedTiling(CWindow* window) {
6 g_pCompositor->setWindowFullscreen(window, false, FULLSCREEN_FULL);
7 }
8
9- auto* parent = node->removeFromParentRecursive();
10+ Hy3Node* expand_actor = nullptr;
11+ auto* parent = node->removeFromParentRecursive(&expand_actor);
12 this->nodes.remove(*node);
13+ if (expand_actor != nullptr) expand_actor->recalcSizePosRecursive();
14
15 auto& group = parent->data.as_group;
16
17@@ -1554,7 +1556,7 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(
18 target_group->data.as_group.children.insert(insert, &node);
19
20 // must happen AFTER `insert` is used
21- auto* old_parent = node.removeFromParentRecursive();
22+ auto* old_parent = node.removeFromParentRecursive(nullptr);
23 node.parent = target_group;
24 node.size_ratio = 1.0;
25
26diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
27index 9e68cc253b3157c7c5a9a8321d0b926e211af6dc..19a8ee15200e54626ad354ae8db6e423308252de 100644
28--- a/src/Hy3Node.cpp
29+++ b/src/Hy3Node.cpp
30@@ -307,7 +307,7 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
31 && (group->focused_child->data.type == Hy3NodeType::Window
32 || group->focused_child->data.as_group.expand_focused == ExpandFocusType::NotExpanded);
33
34- auto child_count = group->children.size() - (directly_contains_expanded ? 1 : 0);
35+ auto child_count = group->children.size();
36 double ratio_mul = group->layout != Hy3GroupLayout::Tabbed
37 ? child_count <= 0 ? 0 : constraint / child_count
38 : 0;
39@@ -323,29 +323,41 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
40 g_pHyprRenderer->damageBox(&box);
41 }
42
43- for (auto* child: group->children) {
44- if (expand_focused && child == group->focused_child) {
45- child->position = tpos;
46- child->size = tsize;
47- child->setHidden(hidden);
48+ if (group->expand_focused == ExpandFocusType::Latch) {
49+ auto* expanded_node = group->focused_child;
50
51- child->gap_pos_offset = gap_pos_offset;
52- child->gap_size_offset = gap_size_offset;
53+ while (expanded_node != nullptr && expanded_node->data.type == Hy3NodeType::Group
54+ && expanded_node->data.as_group.expand_focused != ExpandFocusType::NotExpanded)
55+ {
56+ expanded_node = expanded_node->data.as_group.focused_child;
57+ }
58
59- child->recalcSizePosRecursive(no_animation);
60+ if (expanded_node == nullptr) {
61+ Debug::log(ERR, "indiect expand target is missing");
62+ return;
63+ }
64+
65+ expanded_node->position = tpos;
66+ expanded_node->size = tsize;
67+ expanded_node->setHidden(this->hidden);
68
69+ expanded_node->gap_pos_offset = gap_pos_offset;
70+ expanded_node->gap_size_offset = gap_size_offset;
71+
72+ expanded_node->recalcSizePosRecursive(no_animation);
73+ }
74+
75+ for (auto* child: group->children) {
76+ if (directly_contains_expanded && child == group->focused_child) {
77 switch (group->layout) {
78- case Hy3GroupLayout::SplitH: offset += child->size.x; break;
79- case Hy3GroupLayout::SplitV: offset += child->size.y; break;
80+ case Hy3GroupLayout::SplitH: offset += child->size_ratio * ratio_mul; break;
81+ case Hy3GroupLayout::SplitV: offset += child->size_ratio * ratio_mul; break;
82 case Hy3GroupLayout::Tabbed: break;
83 }
84
85 continue;
86 }
87
88- if (expand_focused && child == group->focused_child) continue;
89- auto was_hidden = child->hidden;
90-
91 switch (group->layout) {
92 case Hy3GroupLayout::SplitH:
93 child->position.x = tpos.x + offset;
94@@ -354,7 +366,6 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
95 child->position.y = tpos.y;
96 child->size.y = tsize.y;
97 child->hidden = this->hidden || expand_focused;
98- // child->setHidden(this->hidden || expand_focused);
99
100 if (group->children.size() == 1) {
101 child->gap_pos_offset = gap_pos_offset;
102@@ -374,7 +385,7 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
103 child->gap_size_offset = Vector2D(0, gap_size_offset.y);
104 }
105
106- child->recalcSizePosRecursive(no_animation || was_hidden);
107+ child->recalcSizePosRecursive(no_animation);
108 break;
109 case Hy3GroupLayout::SplitV:
110 child->position.y = tpos.y + offset;
111@@ -383,7 +394,6 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
112 child->position.x = tpos.x;
113 child->size.x = tsize.x;
114 child->hidden = this->hidden || expand_focused;
115- // child->setHidden(this->hidden || expand_focused);
116
117 if (group->children.size() == 1) {
118 child->gap_pos_offset = gap_pos_offset;
119@@ -403,18 +413,17 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
120 child->gap_size_offset = Vector2D(gap_size_offset.x, 0);
121 }
122
123- child->recalcSizePosRecursive(no_animation || was_hidden);
124+ child->recalcSizePosRecursive(no_animation);
125 break;
126 case Hy3GroupLayout::Tabbed:
127 child->position = tpos;
128 child->size = tsize;
129 child->hidden = this->hidden || expand_focused || group->focused_child != child;
130diff --git a/src/Hy3Node.hpp b/src/Hy3Node.hpp
131index 29d84f024d7091fb51fc89b3c697d9b95e9fa512..89da918f289ea8c3b27ae0b972ab98e528eabe29 100644
132--- a/src/Hy3Node.hpp
133+++ b/src/Hy3Node.hpp
134@@ -112,7 +112,8 @@ struct Hy3Node {
135 // Remove this node from its parent, deleting the parent if it was
136 // the only child and recursing if the parent was the only child of it's
137 // parent.
138- Hy3Node* removeFromParentRecursive();
139+ // expand actor should be recalc'd if set
140+ Hy3Node* removeFromParentRecursive(Hy3Node** expand_actor);
141
142 // Replace this node with a group, returning this node's new address.
143 Hy3Node* intoGroup(Hy3GroupLayout, GroupEphemeralityOption);