a5626177b6bff4196d993d1855c22a7870fa3664

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
GitHub <noreply@github.com>
Date

Message

Merge pull request #52 from eriedaberrie/master

Fix over-correction of borders that are now window decorations

Diff

 1diff --git a/flake.lock b/flake.lock
 2index 44ebbf501b7c58c18db1148ff76d3b6bbe92fefb..d7a752d8faef26fb2ac2b5e6196e5c8906ec2391 100644
 3--- a/flake.lock
 4+++ b/flake.lock
 5@@ -9,11 +9,11 @@
 6         "xdph": "xdph"
 7       },
 8       "locked": {
 9-        "lastModified": 1701737536,
10-        "narHash": "sha256-xSmfHhhCL9mAta5jKfcbJxYjCoD2MdLPBMjBUWvYAJI=",
11+        "lastModified": 1702236723,
12+        "narHash": "sha256-zIEnimM1vhsFkz+Kubb8kJ6YgHuLe56pALOSJc6CMVY=",
13         "owner": "hyprwm",
14         "repo": "Hyprland",
15-        "rev": "3bb9c7c5cf4f2ee30bf821501499f2308d616f94",
16+        "rev": "167f2ed3b2bb18ceeabb831ac80b655ef8e16867",
17         "type": "github"
18       },
19       "original": {
20diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
21index 9cd184e36693dd38820df9a8200a36f3c4be0ca7..6ad2d070562c0c555883fca42845b5e5a1f8af1d 100644
22--- a/src/Hy3Layout.cpp
23+++ b/src/Hy3Layout.cpp
24@@ -1441,7 +1441,6 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
25 	}
26 
27 	// clang-format off
28-	static const auto* border_size = &HyprlandAPI::getConfigValue(PHANDLE, "general:border_size")->intValue;
29 	static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
30 	static const auto* single_window_no_gaps = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:no_gaps_when_only")->intValue;
31 	// clang-format on
32@@ -1462,9 +1461,6 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
33 	window->m_vSize = node->size;
34 	window->m_vPosition = node->position;
35 
36-	auto calcPos = window->m_vPosition + Vector2D(*border_size, *border_size);
37-	auto calcSize = window->m_vSize - Vector2D(2 * *border_size, 2 * *border_size);
38-
39 	auto only_node = root_node->data.as_group.children.size() == 1
40 	              && root_node->data.as_group.children.front()->data.type == Hy3NodeType::Window;
41 
42@@ -1491,6 +1487,9 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
43 		window->m_sSpecialRenderData.border = true;
44 		window->m_sSpecialRenderData.decorate = true;
45 
46+		auto calcPos = window->m_vPosition;
47+		auto calcSize = window->m_vSize;
48+
49 		auto gaps_offset_topleft = Vector2D(*gaps_in, *gaps_in) + node->gap_topleft_offset;
50 		auto gaps_offset_bottomright = Vector2D(*gaps_in * 2, *gaps_in * 2)
51 		                             + node->gap_bottomright_offset + node->gap_topleft_offset;
52@@ -1500,7 +1499,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
53 
54 		const auto reserved_area = window->getFullWindowReservedArea();
55 		calcPos = calcPos + reserved_area.topLeft;
56-		calcSize = calcSize - (reserved_area.topLeft - reserved_area.bottomRight);
57+		calcSize = calcSize - (reserved_area.topLeft + reserved_area.bottomRight);
58 
59 		CBox wb = {calcPos, calcSize};
60 		wb.round();