Diff
1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
2index 5abdac295ac39be679252b343af056841ed37589..80d2d10b93a4c66f7b9e47ac6e2725d24438526c 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -114,12 +114,20 @@ void Hy3Node::recalcSizePosRecursive(bool force) {
6 static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
7
8 int outer_gaps = 0;
9+ Vector2D gap_pos_offset;
10+ Vector2D gap_size_offset;
11 if (this->parent == nullptr) {
12 outer_gaps = *gaps_out - *gaps_in;
13+
14+ gap_pos_offset = Vector2D(outer_gaps, outer_gaps);
15+ gap_size_offset = Vector2D(outer_gaps * 2, outer_gaps * 2);
16+ } else {
17+ gap_pos_offset = this->gap_pos_offset;
18+ gap_size_offset = this->gap_size_offset;
19 }
20
21- auto tpos = this->position + Vector2D(outer_gaps, outer_gaps);
22- auto tsize = this->size - Vector2D(outer_gaps * 2, outer_gaps * 2);
23+ auto tpos = this->position;
24+ auto tsize = this->size;
25
26 static const auto* tab_bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:height")->intValue;
27 static const auto* tab_bar_padding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
28@@ -143,16 +151,9 @@ void Hy3Node::recalcSizePosRecursive(bool force) {
29
30 switch (group->layout) {
31 case Hy3GroupLayout::SplitH:
32- child->position.x = tpos.x;
33- child->size.x = tsize.x;
34- child->position.y = tpos.y;
35- child->size.y = tsize.y;
36- break;
37 case Hy3GroupLayout::SplitV:
38- child->position.y = tpos.y;
39- child->size.y = tsize.y;
40- child->position.x = tpos.x;
41- child->size.x = tsize.x;
42+ child->position = tpos;
43+ child->size = tsize;
44 break;
45 case Hy3GroupLayout::Tabbed:
46 child->position.y = tpos.y + tab_height_offset;
47@@ -162,11 +163,13 @@ void Hy3Node::recalcSizePosRecursive(bool force) {
48 break;
49 }
50
51- child->setHidden(this->hidden);
52+ child->gap_pos_offset = gap_pos_offset;
53+ child->gap_size_offset = gap_size_offset;
54
55- this->updateTabBar();
56+ child->setHidden(this->hidden);
57
58 child->recalcSizePosRecursive(force);
59+ this->updateTabBar();
60 return;
61 }
62
63@@ -219,6 +222,9 @@ void Hy3Node::recalcSizePosRecursive(bool force) {
64 child->recalcSizePosRecursive(force);
65 break;
66 }
67+
68+ child->gap_pos_offset = gap_pos_offset;
69+ child->gap_size_offset = gap_pos_offset;
70 }
71
72 this->updateTabBar();
73@@ -705,10 +711,11 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool force) {
74 window->m_sSpecialRenderData.border = true;
75 window->m_sSpecialRenderData.decorate = true;
76
77- Vector2D gaps_offset(*gaps_in, *gaps_in);
78+ auto gaps_offset_topleft = Vector2D(*gaps_in, *gaps_in) + node->gap_pos_offset;
79+ auto gaps_offset_bottomright = Vector2D(*gaps_in * 2, *gaps_in * 2) + node->gap_size_offset;
80
81- calcPos = calcPos + gaps_offset;
82- calcSize = calcSize - (gaps_offset * 2);
83+ calcPos = calcPos + gaps_offset_topleft;
84+ calcSize = calcSize - gaps_offset_bottomright;
85
86 const auto reserved_area = window->getFullWindowReservedArea();
87 calcPos = calcPos + reserved_area.topLeft;
88diff --git a/src/Hy3Layout.hpp b/src/Hy3Layout.hpp
89index 112e50c400fd406f94c008dc2b3a13f26779ba4c..3545c6683862f3deb3bb3651351fbbab3240185f 100644
90--- a/src/Hy3Layout.hpp
91+++ b/src/Hy3Layout.hpp
92@@ -69,6 +69,8 @@ struct Hy3Node {
93 Hy3NodeData data;
94 Vector2D position;
95 Vector2D size;
96+ Vector2D gap_pos_offset;
97+ Vector2D gap_size_offset;
98 float size_ratio = 1.0;
99 int workspace_id = -1;
100 bool hidden = false;