6938d88ae0884683fb5788ec0c4e8a1cc5980587
- 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 cb386ffbbe6efde9ff49a6ea33b8b6ea17e1fdf0..d627af406d01c511158be0f1349d6f6286f50233 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -320,16 +320,16 @@ void Hy3Layout::recalculateMonitor(const int& monitor_id) {
6 // clang-format on
7
8 int outer_gaps = -(*gaps_in - *gaps_out);
9- auto gap_pos_offset = Vector2D(outer_gaps, outer_gaps);
10- auto gap_size_offset = Vector2D(outer_gaps * 2, outer_gaps * 2);
11+ auto gap_topleft_offset = Vector2D(outer_gaps, outer_gaps);
12+ auto gap_bottomright_offset = Vector2D(outer_gaps, outer_gaps);
13 Debug::log(LOG, "FS gaps: %d", outer_gaps);
14
15 Hy3Node fakeNode = {
16 .data = window,
17 .position = monitor->vecPosition + monitor->vecReservedTopLeft,
18 .size = monitor->vecSize - monitor->vecReservedTopLeft - monitor->vecReservedBottomRight,
19- .gap_pos_offset = gap_pos_offset,
20- .gap_size_offset = gap_size_offset,
21+ .gap_topleft_offset = gap_topleft_offset,
22+ .gap_bottomright_offset = gap_bottomright_offset,
23 .workspace_id = window->m_iWorkspaceID,
24 };
25
26@@ -629,8 +629,8 @@ void Hy3Layout::fullscreenRequestForWindow(
27 .data = window,
28 .position = monitor->vecPosition + monitor->vecReservedTopLeft,
29 .size = monitor->vecSize - monitor->vecReservedTopLeft - monitor->vecReservedBottomRight,
30- .gap_pos_offset = gap_pos_offset,
31- .gap_size_offset = gap_size_offset,
32+ .gap_topleft_offset = gap_pos_offset,
33+ .gap_bottomright_offset = gap_size_offset,
34 .workspace_id = window->m_iWorkspaceID,
35 };
36
37@@ -909,7 +909,7 @@ Hy3Node* findTabBarAt(Hy3Node& node, Vector2D pos, Hy3Node** focused_node) {
38 if (node.data.as_group.layout == Hy3GroupLayout::Tabbed
39 && node.data.as_group.tab_bar != nullptr)
40 {
41- if (pos.y < node.position.y + node.gap_pos_offset.y + inset) {
42+ if (pos.y < node.position.y + node.gap_topleft_offset.y + inset) {
43 auto& children = node.data.as_group.children;
44 auto& tab_bar = *node.data.as_group.tab_bar;
45
46@@ -1333,8 +1333,9 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
47 window->m_sSpecialRenderData.border = true;
48 window->m_sSpecialRenderData.decorate = true;
49
50- auto gaps_offset_topleft = Vector2D(*gaps_in, *gaps_in) + node->gap_pos_offset;
51- auto gaps_offset_bottomright = Vector2D(*gaps_in * 2, *gaps_in * 2) + node->gap_size_offset;
52+ auto gaps_offset_topleft = Vector2D(*gaps_in, *gaps_in) + node->gap_topleft_offset;
53+ auto gaps_offset_bottomright = Vector2D(*gaps_in * 2, *gaps_in * 2)
54+ + node->gap_bottomright_offset + node->gap_topleft_offset;
55
56 calcPos = calcPos + gaps_offset_topleft;
57 calcSize = calcSize - gaps_offset_bottomright;
58diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
59index 19a8ee15200e54626ad354ae8db6e423308252de..3c8f99aab338fecff3f0cb0a9654b9fa7ec3a850 100644
60--- a/src/Hy3Node.cpp
61+++ b/src/Hy3Node.cpp
62@@ -269,16 +269,16 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
63 // clang-format on
64
65 int outer_gaps = 0;
66- Vector2D gap_pos_offset;
67- Vector2D gap_size_offset;
68+ Vector2D gap_topleft_offset;
69+ Vector2D gap_bottomright_offset;
70 if (this->parent == nullptr) {
71 outer_gaps = -(*gaps_in - *gaps_out);
72
73- gap_pos_offset = Vector2D(outer_gaps, outer_gaps);
74- gap_size_offset = Vector2D(outer_gaps * 2, outer_gaps * 2);
75+ gap_topleft_offset = Vector2D(outer_gaps, outer_gaps);
76+ gap_bottomright_offset = Vector2D(outer_gaps, outer_gaps);
77 } else {
78- gap_pos_offset = this->gap_pos_offset;
79- gap_size_offset = this->gap_size_offset;
80+ gap_topleft_offset = this->gap_topleft_offset;
81+ gap_bottomright_offset = this->gap_bottomright_offset;
82 }
83
84 auto tpos = this->position;
85@@ -296,8 +296,12 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
86
87 double constraint;
88 switch (group->layout) {
89- case Hy3GroupLayout::SplitH: constraint = tsize.x - gap_size_offset.x; break;
90- case Hy3GroupLayout::SplitV: constraint = tsize.y - gap_size_offset.y; break;
91+ case Hy3GroupLayout::SplitH:
92+ constraint = tsize.x - gap_topleft_offset.x - gap_bottomright_offset.x;
93+ break;
94+ case Hy3GroupLayout::SplitV:
95+ constraint = tsize.y - gap_topleft_offset.y - gap_bottomright_offset.y;
96+ break;
97 case Hy3GroupLayout::Tabbed: break;
98 }
99
100@@ -341,8 +345,8 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
101 expanded_node->size = tsize;
102 expanded_node->setHidden(this->hidden);
103
104- expanded_node->gap_pos_offset = gap_pos_offset;
105- expanded_node->gap_size_offset = gap_size_offset;
106+ expanded_node->gap_topleft_offset = gap_topleft_offset;
107+ expanded_node->gap_bottomright_offset = gap_bottomright_offset;
108
109 expanded_node->recalcSizePosRecursive(no_animation);
110 }
111@@ -368,21 +372,22 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
112 child->hidden = this->hidden || expand_focused;
113
114 if (group->children.size() == 1) {
115- child->gap_pos_offset = gap_pos_offset;
116- child->gap_size_offset = gap_size_offset;
117- if (this->parent != nullptr) child->gap_size_offset.x += *group_inset;
118- child->size.x += gap_size_offset.x;
119+ child->gap_topleft_offset = gap_topleft_offset;
120+ child->gap_bottomright_offset = gap_bottomright_offset;
121+ child->size.x = tsize.x;
122+ if (this->parent != nullptr) child->gap_bottomright_offset.x += *group_inset;
123 } else if (child == group->children.front()) {
124- child->gap_pos_offset = gap_pos_offset;
125- child->gap_size_offset = Vector2D(0, gap_size_offset.y);
126- offset += gap_pos_offset.x;
127+ child->gap_topleft_offset = gap_topleft_offset;
128+ child->gap_bottomright_offset = Vector2D(0, gap_bottomright_offset.y);
129+ child->size.x += gap_topleft_offset.x;
130+ offset += gap_topleft_offset.x;
131 } else if (child == group->children.back()) {
132- child->gap_pos_offset = Vector2D(0, gap_pos_offset.y);
133- child->gap_size_offset = gap_size_offset;
134- child->size.x += gap_size_offset.x;
135+ child->gap_topleft_offset = Vector2D(0, gap_topleft_offset.y);
136+ child->gap_bottomright_offset = gap_bottomright_offset;
137+ child->size.x += gap_bottomright_offset.x;
138 } else {
139- child->gap_pos_offset = Vector2D(0, gap_pos_offset.y);
140- child->gap_size_offset = Vector2D(0, gap_size_offset.y);
141+ child->gap_topleft_offset = Vector2D(0, gap_topleft_offset.y);
142+ child->gap_bottomright_offset = Vector2D(0, gap_bottomright_offset.y);
143 }
144
145 child->recalcSizePosRecursive(no_animation);
146@@ -396,21 +401,22 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
147 child->hidden = this->hidden || expand_focused;
148
149 if (group->children.size() == 1) {
150- child->gap_pos_offset = gap_pos_offset;
151- child->gap_size_offset = gap_size_offset;
152- if (this->parent != nullptr) child->gap_size_offset.y += *group_inset;
153- child->size.y += gap_size_offset.y;
154+ child->gap_topleft_offset = gap_topleft_offset;
155+ child->gap_bottomright_offset = gap_bottomright_offset;
156+ child->size.y = tsize.y;
157+ if (this->parent != nullptr) child->gap_bottomright_offset.y += *group_inset;
158 } else if (child == group->children.front()) {
159- child->gap_pos_offset = gap_pos_offset;
160- child->gap_size_offset = Vector2D(gap_size_offset.x, 0);
161- offset += gap_pos_offset.y;
162diff --git a/src/Hy3Node.hpp b/src/Hy3Node.hpp
163index 89da918f289ea8c3b27ae0b972ab98e528eabe29..111d8cdf3746349b9075b01fc0fd628d417c295d 100644
164--- a/src/Hy3Node.hpp
165+++ b/src/Hy3Node.hpp
166@@ -79,8 +79,8 @@ struct Hy3Node {
167 Hy3NodeData data;
168 Vector2D position;
169 Vector2D size;
170- Vector2D gap_pos_offset;
171- Vector2D gap_size_offset;
172+ Vector2D gap_topleft_offset;
173+ Vector2D gap_bottomright_offset;
174 float size_ratio = 1.0;
175 int workspace_id = -1;
176 bool hidden = false;
177diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
178index 923291642f12e5f7a965461adbf212f18a008b00..6d3504ae48a71039d23ccbe181ed45d4655621f0 100644
179--- a/src/TabGroup.cpp
180+++ b/src/TabGroup.cpp
181@@ -456,8 +456,8 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
182 = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:height")->intValue;
183
184 auto gaps = node.parent == nullptr ? *gaps_out : *gaps_in;
185- auto tpos = node.position + Vector2D(gaps, gaps) + node.gap_pos_offset;
186- auto tsize = Vector2D(node.size.x - node.gap_size_offset.x - gaps * 2, *bar_height);
187+ auto tpos = node.position + Vector2D(gaps, gaps) + node.gap_topleft_offset;
188+ auto tsize = Vector2D(node.size.x - node.gap_bottomright_offset.x - gaps * 2, *bar_height);
189
190 this->hidden = node.hidden;
191 if (this->pos.goalv() != tpos) {