Diff
1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
2index ace91d31d46e5341e69d86e027695bbf46d4ac73..f634eaa68d6b12f55ac865d38301492bc0bacdb1 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -1514,10 +1514,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
6 return;
7 }
8
9- // clang-format off
10- static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
11 static const auto no_gaps_when_only = ConfigValue<Hyprlang::INT>("plugin:hy3:no_gaps_when_only");
12- // clang-format on
13
14 if (!valid(window) || !window->m_bIsMapped) {
15 hy3_log(
16@@ -1544,14 +1541,15 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
17 && root_node->data.as_group().children.front()->data.is_window();
18
19 if (!window->m_pWorkspace->m_bIsSpecialWorkspace
20- && ((*no_gaps_when_only != 0 && (only_node || window->isFullscreen()))
21- || window->isEffectiveInternalFSMode(FSMODE_FULLSCREEN)))
22+ && ((*no_gaps_when_only != 0 && (only_node || window->isFullscreen()))
23+ || window->isEffectiveInternalFSMode(FSMODE_FULLSCREEN)))
24 {
25 window->m_sWindowData.decorate = CWindowOverridableVar(
26 true,
27 PRIORITY_LAYOUT
28 ); // a little curious but copying what dwindle does
29- window->m_sWindowData.noBorder = CWindowOverridableVar(*no_gaps_when_only != 2, PRIORITY_LAYOUT);
30+ window->m_sWindowData.noBorder =
31+ CWindowOverridableVar(*no_gaps_when_only != 2, PRIORITY_LAYOUT);
32 window->m_sWindowData.noRounding = CWindowOverridableVar(true, PRIORITY_LAYOUT);
33 window->m_sWindowData.noShadow = CWindowOverridableVar(true, PRIORITY_LAYOUT);
34
35@@ -1564,25 +1562,8 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
36
37 g_pXWaylandManager->setWindowSize(window, window->m_vRealSize.goal());
38 } else {
39- auto calcPos = window->m_vPosition;
40- auto calcSize = window->m_vSize;
41-
42- auto gaps_offset_topleft =
43- Vector2D((int) gaps_in->left, (int) gaps_in->top) + node->gap_topleft_offset;
44-
45- auto gaps_offset_bottomright =
46- Vector2D((int) (gaps_in->left + gaps_in->right), (int) (gaps_in->top + gaps_in->bottom))
47- + node->gap_bottomright_offset + node->gap_topleft_offset;
48-
49- calcPos = calcPos + gaps_offset_topleft;
50- calcSize = calcSize - gaps_offset_bottomright;
51-
52- const auto reserved_area = window->getFullWindowReservedArea();
53- calcPos = calcPos + reserved_area.topLeft;
54- calcSize = calcSize - (reserved_area.topLeft + reserved_area.bottomRight);
55-
56- CBox wb = {calcPos, calcSize};
57- wb.round();
58+ auto reserved = window->getFullWindowReservedArea();
59+ auto wb = node->getStandardWindowArea({-reserved.topLeft, -reserved.bottomRight});
60
61 window->m_vRealPosition = wb.pos();
62 window->m_vRealSize = wb.size();
63diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
64index 113d3db97a42ddb0415fbbc57955f4349f1443d4..448f29bb6ad1bfbf23cb1cec91b0428c1c6474af 100644
65--- a/src/Hy3Node.cpp
66+++ b/src/Hy3Node.cpp
67@@ -627,6 +627,26 @@ void Hy3Node::setHidden(bool hidden) {
68 }
69 }
70
71+CBox Hy3Node::getStandardWindowArea(SBoxExtents extents) {
72+ static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
73+
74+ SBoxExtents inner_gap_extents;
75+ inner_gap_extents.topLeft = {(int) -gaps_in->left, (int) -gaps_in->top};
76+ inner_gap_extents.bottomRight = {(int) -gaps_in->right, (int) -gaps_in->bottom};
77+
78+ SBoxExtents combined_outer_extents;
79+ combined_outer_extents.topLeft = -this->gap_topleft_offset;
80+ combined_outer_extents.bottomRight = -this->gap_bottomright_offset;
81+
82+ auto area = CBox(this->position, this->size);
83+ area.addExtents(inner_gap_extents);
84+ area.addExtents(combined_outer_extents);
85+ area.addExtents(extents);
86+
87+ area.round();
88+ return area;
89+}
90+
91 Hy3Node* Hy3Node::findNodeForTabGroup(Hy3TabGroup& tab_group) {
92 if (this->data.is_group()) {
93 if (this->hidden) return nullptr;
94diff --git a/src/Hy3Node.hpp b/src/Hy3Node.hpp
95index 2d3969e8e134e6a1824253fb72ae49f2338508e9..ac4ca50a70ae5b4a661facc29179413a3c168df2 100644
96--- a/src/Hy3Node.hpp
97+++ b/src/Hy3Node.hpp
98@@ -115,6 +115,7 @@ struct Hy3Node {
99 std::string getTitle();
100 bool isUrgent();
101 void setHidden(bool);
102+ CBox getStandardWindowArea(SBoxExtents extents = SBoxExtents());
103
104 Hy3Node* findNodeForTabGroup(Hy3TabGroup&);
105 void appendAllWindows(std::vector<PHLWINDOW>&);
106diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
107index ab5741db9e6dce384599cb55114231df2c8e6dc4..33b6281aa15dcb3b14fdbfd5df35ae94c7c30ae1 100644
108--- a/src/TabGroup.cpp
109+++ b/src/TabGroup.cpp
110@@ -414,19 +414,12 @@ Hy3TabGroup::Hy3TabGroup(Hy3Node& node) {
111 }
112
113 void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
114- static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
115- static const auto gaps_out = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_out");
116 static const auto bar_height = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:height");
117
118- auto& gaps = node.parent == nullptr ? gaps_out : gaps_in;
119- auto tpos = node.position + Vector2D((int) gaps->left, (int) gaps->top) + node.gap_topleft_offset;
120+ auto windowBox = node.getStandardWindowArea();
121
122- // clang-format off
123- auto tsize = Vector2D(
124- node.size.x - node.gap_bottomright_offset.x - node.gap_topleft_offset.x - (gaps->left + gaps->right),
125- *bar_height
126- );
127- // clang-format on
128+ auto tpos = windowBox.pos();
129+ auto tsize = Vector2D(windowBox.size().x, *bar_height);
130
131 this->hidden = node.hidden;
132 if (this->pos.goal() != tpos) {