92972487803d6c2cf33a54873b44c0eadf580302

Author
chrisruff <chrisruff@live.ca>
Committer
chrisruff <chrisruff@live.ca>
Date

Message

Merge remote-tracking branch 'upstream/master' into feat-multi-monitor

Diff

This diff is truncated to protect this page.

  1diff --git a/CMakeLists.txt b/CMakeLists.txt
  2index e4e83ac4a0734e84212dae66fe5f8dd366a95891..832d21fb7b0298e122daa95f8d386285975410f3 100644
  3--- a/CMakeLists.txt
  4+++ b/CMakeLists.txt
  5@@ -11,7 +11,7 @@ if(CMAKE_EXPORT_COMPILE_COMMANDS)
  6 endif()
  7 
  8 find_package(PkgConfig REQUIRED)
  9-pkg_check_modules(DEPS REQUIRED hyprland pixman-1 libdrm pango pangocairo)
 10+pkg_check_modules(DEPS REQUIRED hyprland pixman-1 libdrm pango pangocairo libinput wayland-client xkbcommon)
 11 
 12 add_library(hy3 SHARED
 13 	src/main.cpp
 14diff --git a/README.md b/README.md
 15index a0b94997b3ba9fe1c278e6d208e67c9f3c061524..69e6f67d4b96c65efb7dd916314ca279d0b3570f 100644
 16--- a/README.md
 17+++ b/README.md
 18@@ -69,7 +69,7 @@ Assuming you use hyprland's home manager module, you can easily integrate hy3 by
 19 
 20     hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1&ref={version}";
 21     # where {version} is the hyprland release version
 22-    # or "github:hyprwm/Hyprland" to follow the development branch
 23+    # or "github:hyprwm/Hyprland?submodules=1" to follow the development branch
 24 
 25     hy3 = {
 26       url = "github:outfoxxed/hy3?ref=hl{version}"; # where {version} is the hyprland release version
 27diff --git a/flake.lock b/flake.lock
 28index a929c200cb388c82dd577da38a23f86f67803069..a2ad6ea8be247ad77ea04873776b69902bd5afca 100644
 29--- a/flake.lock
 30+++ b/flake.lock
 31@@ -1,5 +1,38 @@
 32 {
 33   "nodes": {
 34+    "aquamarine": {
 35+      "inputs": {
 36+        "hyprutils": [
 37+          "hyprland",
 38+          "hyprutils"
 39+        ],
 40+        "hyprwayland-scanner": [
 41+          "hyprland",
 42+          "hyprwayland-scanner"
 43+        ],
 44+        "nixpkgs": [
 45+          "hyprland",
 46+          "nixpkgs"
 47+        ],
 48+        "systems": [
 49+          "hyprland",
 50+          "systems"
 51+        ]
 52+      },
 53+      "locked": {
 54+        "lastModified": 1722347739,
 55+        "narHash": "sha256-rAoh+K6KG+b1DwSWtqRVocdojnH6nGk6q07mNltoUSM=",
 56+        "owner": "hyprwm",
 57+        "repo": "aquamarine",
 58+        "rev": "7c3565f9bedc7cb601cc0baa14792247e4dc1d5a",
 59+        "type": "github"
 60+      },
 61+      "original": {
 62+        "owner": "hyprwm",
 63+        "repo": "aquamarine",
 64+        "type": "github"
 65+      }
 66+    },
 67     "hyprcursor": {
 68       "inputs": {
 69         "hyprlang": [
 70@@ -16,11 +49,11 @@
 71         ]
 72       },
 73       "locked": {
 74-        "lastModified": 1717181720,
 75-        "narHash": "sha256-yv+QZWsusu/NWjydkxixHC2g+tIJ9v+xkE2EiVpJj6g=",
 76+        "lastModified": 1721330371,
 77+        "narHash": "sha256-aYlHTWylczLt6ERJyg6E66Y/XSCbVL7leVcRuJmVbpI=",
 78         "owner": "hyprwm",
 79         "repo": "hyprcursor",
 80-        "rev": "9e27a2c2ceb1e0b85bd55b0afefad196056fe87c",
 81+        "rev": "4493a972b48f9c3014befbbf381ed5fff91a65dc",
 82         "type": "github"
 83       },
 84       "original": {
 85@@ -31,6 +64,7 @@
 86     },
 87     "hyprland": {
 88       "inputs": {
 89+        "aquamarine": "aquamarine",
 90         "hyprcursor": "hyprcursor",
 91         "hyprlang": "hyprlang",
 92         "hyprutils": "hyprutils",
 93@@ -40,16 +74,16 @@
 94         "xdph": "xdph"
 95       },
 96       "locked": {
 97-        "lastModified": 1718272446,
 98-        "narHash": "sha256-hLnnNBWP1Qjs1I3fndMgp8rbWJruxdnGTq77A4Rv4R4=",
 99-        "rev": "9e781040d9067c2711ec2e9f5b47b76ef70762b3",
100-        "revCount": 4818,
101+        "lastModified": 1723058230,
102+        "narHash": "sha256-deu8zvgseDg2gQEnZiCda4TrbA6pleE9iItoZlsoMtE=",
103+        "rev": "9a09eac79b85c846e3a865a9078a3f8ff65a9259",
104+        "revCount": 5069,
105         "submodules": true,
106         "type": "git",
107         "url": "https://github.com/hyprwm/Hyprland"
108       },
109       "original": {
110-        "rev": "9e781040d9067c2711ec2e9f5b47b76ef70762b3",
111+        "rev": "9a09eac79b85c846e3a865a9078a3f8ff65a9259",
112         "submodules": true,
113         "type": "git",
114         "url": "https://github.com/hyprwm/Hyprland"
115@@ -69,11 +103,11 @@
116         ]
117       },
118       "locked": {
119-        "lastModified": 1691753796,
120-        "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=",
121+        "lastModified": 1721326555,
122+        "narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=",
123         "owner": "hyprwm",
124         "repo": "hyprland-protocols",
125-        "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03",
126+        "rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84",
127         "type": "github"
128       },
129       "original": {
130@@ -98,11 +132,11 @@
131diff --git a/flake.nix b/flake.nix
132index 0f81af8b85f83dcc10b734d840e1c69e77ae15c5..1a5258728ec44eaf91117f77b569d0e0437c2787 100644
133--- a/flake.nix
134+++ b/flake.nix
135@@ -1,6 +1,6 @@
136 {
137   inputs = {
138-    hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1&rev=9e781040d9067c2711ec2e9f5b47b76ef70762b3";
139+    hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1&rev=9a09eac79b85c846e3a865a9078a3f8ff65a9259";
140   };
141 
142   outputs = { self, hyprland, ... }: let
143@@ -10,12 +10,12 @@
144       (builtins.attrNames hyprland.packages)
145       (system: fn system nixpkgs.legacyPackages.${system});
146 
147-    props = builtins.fromJSON (builtins.readFile "${hyprland}/props.json");
148+    hyprlandVersion = nixpkgs.lib.removeSuffix "\n" (builtins.readFile "${hyprland}/VERSION");
149   in {
150     packages = hyprlandSystems (system: pkgs: rec {
151       hy3 = pkgs.callPackage ./default.nix {
152         hyprland = hyprland.packages.${system}.hyprland;
153-        hlversion = props.version;
154+        hlversion = hyprlandVersion;
155       };
156       default = hy3;
157     });
158@@ -23,13 +23,13 @@
159     devShells = hyprlandSystems (system: pkgs: {
160       default = import ./shell.nix {
161         inherit pkgs;
162-        hlversion = props.version;
163+        hlversion = hyprlandVersion;
164         hyprland = hyprland.packages.${system}.hyprland-debug;
165       };
166 
167       impure = import ./shell.nix {
168         pkgs = import <nixpkgs> {};
169-        hlversion = props.version;
170+        hlversion = hyprlandVersion;
171         hyprland = (pkgs.appendOverlays [ hyprland.overlays.hyprland-packages ]).hyprland-debug.overrideAttrs {
172           dontStrip = true;
173         };
174diff --git a/hyprpm.toml b/hyprpm.toml
175index e06f8fe5459ec4904ca47e1b6ac246ebf45fd1a8..7981cf2b8b99d6ca12f3a3e8484768c8140e0b45 100644
176--- a/hyprpm.toml
177+++ b/hyprpm.toml
178@@ -13,6 +13,8 @@ commit_pins = [
179 	["cba1ade848feac44b2eda677503900639581c3f4", "584a1b1e357412a1a4ac40dbc6c4e5adaa7ec59b"], # 0.40.0
180 	["ea2501d4556f84d3de86a4ae2f4b22a474555b9f", "b6a777d2714628d2cda8843aec73a700ef269899"], # 0.41.0
181 	["9e781040d9067c2711ec2e9f5b47b76ef70762b3", "b2c10c0f4d45aa6ef493f88c3eb0a20516fb9d2b"], # 0.41.1
182+	["918d8340afd652b011b937d29d5eea0be08467f5", "df75070f7fbc1a894fb309dcbb4573034634d036"], # 0.41.2
183+	["9a09eac79b85c846e3a865a9078a3f8ff65a9259", "93759c8032995eb566008537389543b3e1b4a65c"], # 0.42.0
184 ]
185 
186 [hy3]
187diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
188index 90d69691befd5cf352cfcb5c6c610db9f0ca7bf8..1b8a79384d291628286fb182cf5beb3d0c36e3a8 100644
189--- a/src/Hy3Layout.cpp
190+++ b/src/Hy3Layout.cpp
191@@ -12,6 +12,7 @@
192 #include "Hy3Node.hpp"
193 #include "SelectionHook.hpp"
194 #include "globals.hpp"
195+#include "src/desktop/Window.hpp"
196 
197 SP<HOOK_CALLBACK_FN> renderHookPtr;
198 SP<HOOK_CALLBACK_FN> windowTitleHookPtr;
199@@ -300,12 +301,10 @@ void Hy3Layout::onWindowRemovedTiling(PHLWINDOW window) {
200 	    (uintptr_t) node->parent
201 	);
202 
203-	window->m_sSpecialRenderData.rounding = true;
204-	window->m_sSpecialRenderData.border = true;
205-	window->m_sSpecialRenderData.decorate = true;
206+	window->unsetWindowData(PRIORITY_LAYOUT);
207 
208-	if (window->m_bIsFullscreen) {
209-		g_pCompositor->setWindowFullscreen(window, false, FULLSCREEN_FULL);
210+	if (window->isFullscreen()) {
211+		g_pCompositor->setWindowFullscreenInternal(window, FSMODE_NONE);
212 	}
213 
214 	Hy3Node* expand_actor = nullptr;
215@@ -493,24 +492,17 @@ void Hy3Layout::resizeActiveWindow(const Vector2D& delta, eRectCorner corner, PH
216 
217 void Hy3Layout::fullscreenRequestForWindow(
218     PHLWINDOW window,
219-    eFullscreenMode fullscreen_mode,
220-    bool on
221+    eFullscreenMode current_mode,
222+    eFullscreenMode target_mode
223 ) {
224-	if (on == window->m_bIsFullscreen || window->m_pWorkspace->m_bIsSpecialWorkspace) return;
225+	if (current_mode == target_mode || window->m_pWorkspace->m_bIsSpecialWorkspace) return;
226 
227 	const auto monitor = g_pCompositor->getMonitorFromID(window->m_iMonitorID);
228-	if (window->m_pWorkspace->m_bHasFullscreenWindow && on) return;
229-
230-	window->m_bIsFullscreen = on;
231-	window->m_pWorkspace->m_bHasFullscreenWindow = !window->m_pWorkspace->m_bHasFullscreenWindow;
232 
233 	window->updateDynamicRules();
234 	window->updateWindowDecos();
235 
236-	g_pEventManager->postEvent(SHyprIPCEvent {"fullscreen", std::to_string((int) on)});
237-	EMIT_HOOK_EVENT("fullscreen", window);
238-
239-	if (!window->m_bIsFullscreen) {
240+	if (target_mode == FSMODE_NONE) {
241 		auto* node = this->getNodeFromWindow(window);
242 
243 		if (node) {
244@@ -521,13 +513,9 @@ void Hy3Layout::fullscreenRequestForWindow(
245 			window->m_vRealPosition = window->m_vLastFloatingPosition;
246 			window->m_vRealSize = window->m_vLastFloatingSize;
247 
248-			window->m_sSpecialRenderData.rounding = true;
249-			window->m_sSpecialRenderData.border = true;
250-			window->m_sSpecialRenderData.decorate = true;
251+			window->unsetWindowData(PRIORITY_LAYOUT);
252 		}
253 	} else {
254-		window->m_pWorkspace->m_efFullscreenMode = fullscreen_mode;
255-
256 		// save position and size if floating
257 		if (window->m_bIsFloating) {
258 			window->m_vLastFloatingPosition = window->m_vRealPosition.goal();
259@@ -536,7 +524,7 @@ void Hy3Layout::fullscreenRequestForWindow(
260 			window->m_vSize = window->m_vRealSize.goal();
261 		}
262 
263-		if (fullscreen_mode == FULLSCREEN_FULL) {
264+		if (target_mode == FSMODE_FULLSCREEN) {
265 			window->m_vRealPosition = monitor->vecPosition;
266 			window->m_vRealSize = monitor->vecSize;
267 		} else {
268@@ -549,14 +537,14 @@ void Hy3Layout::fullscreenRequestForWindow(
269 
270 			// clang-format off
271 			auto gap_pos_offset = Vector2D(
272-			    -(gaps_in->left - gaps_out->left),
273-			    -(gaps_in->top - gaps_out->top)
274+					(int) -(gaps_in->left - gaps_out->left),
275+					(int) -(gaps_in->top - gaps_out->top)
276 			);
277 			// clang-format on
278 
279 			auto gap_size_offset = Vector2D(
280-			    -(gaps_in->left - gaps_out->left) + -(gaps_in->right - gaps_out->right),
281-			    -(gaps_in->top - gaps_out->top) + -(gaps_in->bottom - gaps_out->bottom)
282+					(int) (-(gaps_in->left - gaps_out->left) + -(gaps_in->right - gaps_out->right)),
283+					(int) (-(gaps_in->top - gaps_out->top) + -(gaps_in->bottom - gaps_out->bottom))
284 			);
285 
286 			Hy3Node fakeNode = {
287@@ -572,10 +560,7 @@ void Hy3Layout::fullscreenRequestForWindow(
288 		}
289 	}
290 
291diff --git a/src/Hy3Layout.hpp b/src/Hy3Layout.hpp
292index 7b3c79ce4e9df8d503556bb66b64a68540d3d2d9..75976c297252fbf57f5d805a4b10543516b376f9 100644
293--- a/src/Hy3Layout.hpp
294+++ b/src/Hy3Layout.hpp
295@@ -86,7 +86,7 @@ public:
296 	void recalculateWindow(PHLWINDOW) override;
297 	void resizeActiveWindow(const Vector2D& delta, eRectCorner corner, PHLWINDOW pWindow = nullptr)
298 	    override;
299-	void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool enable_fullscreen) override;
300+	void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode current_mode, eFullscreenMode target_mode) override;
301 	std::any layoutMessage(SLayoutMessageHeader header, std::string content) override;
302 	SWindowRenderLayoutHints requestRenderHints(PHLWINDOW) override;
303 	void switchWindows(PHLWINDOW, PHLWINDOW) override;
304diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
305index 5a9dd3d648499af2e3c4e7a44a6523eec3332627..113d3db97a42ddb0415fbbc57955f4349f1443d4 100644
306--- a/src/Hy3Node.cpp
307+++ b/src/Hy3Node.cpp
308@@ -5,8 +5,8 @@
309 #include <bits/ranges_util.h>
310 #include <hyprland/src/Compositor.hpp>
311 #include <hyprland/src/defines.hpp>
312-#include <hyprland/src/helpers/Box.hpp>
313 #include <hyprland/src/plugins/PluginAPI.hpp>
314+#include <hyprutils/math/Box.hpp>
315 
316 #include "Hy3Layout.hpp"
317 #include "Hy3Node.hpp"
318@@ -304,25 +304,23 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
319 	static const auto group_inset = ConfigValue<Hyprlang::INT>("plugin:hy3:group_inset");
320 	static const auto tab_bar_height = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:height");
321 	static const auto tab_bar_padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:padding");
322-	// clang-format on
323 
324-	// clang-format off
325 	auto gap_topleft_offset = Vector2D(
326-	    -(gaps_in->left - gaps_out->left),
327-	    -(gaps_in->top - gaps_out->top)
328+	    (int) -(gaps_in->left - gaps_out->left),
329+	    (int) -(gaps_in->top - gaps_out->top)
330 	);
331 
332 	auto gap_bottomright_offset = Vector2D(
333-	    -(gaps_in->right - gaps_out->right),
334-	    -(gaps_in->bottom - gaps_out->bottom)
335+			(int) -(gaps_in->right - gaps_out->right),
336+			(int) -(gaps_in->bottom - gaps_out->bottom)
337 	);
338 	// clang-format on
339 
340-	if (this->data.is_window() && this->data.as_window()->m_bIsFullscreen) {
341+	if (this->data.is_window() && this->data.as_window()->isFullscreen()) {
342 		auto window = this->data.as_window();
343 		auto* monitor = g_pCompositor->getMonitorFromID(this->workspace->m_iMonitorID);
344 
345-		if (this->workspace->m_efFullscreenMode == FULLSCREEN_FULL) {
346+		if (window->isEffectiveInternalFSMode(FSMODE_FULLSCREEN)) {
347 			window->m_vRealPosition = monitor->vecPosition;
348 			window->m_vRealSize = monitor->vecSize;
349 			return;
350@@ -447,16 +445,16 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
351 				if (this->parent != nullptr) child->gap_bottomright_offset.x += *group_inset;
352 			} else if (child == group.children.front()) {
353 				child->gap_topleft_offset = gap_topleft_offset;
354-				child->gap_bottomright_offset = Vector2D(0, gap_bottomright_offset.y);
355+				child->gap_bottomright_offset = Vector2D(0.0, gap_bottomright_offset.y);
356 				child->size.x += gap_topleft_offset.x;
357 				offset += gap_topleft_offset.x;
358 			} else if (child == group.children.back()) {
359-				child->gap_topleft_offset = Vector2D(0, gap_topleft_offset.y);
360+				child->gap_topleft_offset = Vector2D(0.0, gap_topleft_offset.y);
361 				child->gap_bottomright_offset = gap_bottomright_offset;
362 				child->size.x += gap_bottomright_offset.x;
363 			} else {
364-				child->gap_topleft_offset = Vector2D(0, gap_topleft_offset.y);
365-				child->gap_bottomright_offset = Vector2D(0, gap_bottomright_offset.y);
366+				child->gap_topleft_offset = Vector2D(0.0, gap_topleft_offset.y);
367+				child->gap_bottomright_offset = Vector2D(0.0, gap_bottomright_offset.y);
368 			}
369 
370 			child->recalcSizePosRecursive(no_animation);
371@@ -476,16 +474,16 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
372 				if (this->parent != nullptr) child->gap_bottomright_offset.y += *group_inset;
373 			} else if (child == group.children.front()) {
374 				child->gap_topleft_offset = gap_topleft_offset;
375-				child->gap_bottomright_offset = Vector2D(gap_bottomright_offset.x, 0);
376+				child->gap_bottomright_offset = Vector2D(gap_bottomright_offset.x, 0.0);
377 				child->size.y += gap_topleft_offset.y;
378 				offset += gap_topleft_offset.y;
379 			} else if (child == group.children.back()) {
380-				child->gap_topleft_offset = Vector2D(gap_topleft_offset.x, 0);
381+				child->gap_topleft_offset = Vector2D(gap_topleft_offset.x, 0.0);
382 				child->gap_bottomright_offset = gap_bottomright_offset;
383 				child->size.y += gap_bottomright_offset.y;
384 			} else {
385-				child->gap_topleft_offset = Vector2D(gap_topleft_offset.x, 0);
386-				child->gap_bottomright_offset = Vector2D(gap_bottomright_offset.x, 0);
387+				child->gap_topleft_offset = Vector2D(gap_topleft_offset.x, 0.0);
388+				child->gap_bottomright_offset = Vector2D(gap_bottomright_offset.x, 0.0);
389 			}
390 
391 			child->recalcSizePosRecursive(no_animation);
392diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
393index 2e384bf7be2c09363fa7e4cbebd492c520c1d671..ab5741db9e6dce384599cb55114231df2c8e6dc4 100644
394--- a/src/TabGroup.cpp
395+++ b/src/TabGroup.cpp
396@@ -4,15 +4,15 @@
397 #include <hyprland/src/Compositor.hpp>
398 #include <hyprland/src/desktop/DesktopTypes.hpp>
399 #include <hyprland/src/desktop/Workspace.hpp>
400-#include <hyprland/src/helpers/Box.hpp>
401 #include <hyprland/src/helpers/Color.hpp>
402 #include <hyprland/src/render/OpenGL.hpp>
403+#include <hyprland/src/render/Texture.hpp>
404 #include <hyprutils/memory/SharedPtr.hpp>
405+#include <hyprutils/math/Box.hpp>
406 #include <pango/pangocairo.h>
407 #include <pixman.h>
408 
409 #include "globals.hpp"
410-#include "src/render/Texture.hpp"
411 
412 Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_bar), node(node) {
413 	this->focused
414@@ -419,7 +419,7 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
415 	static const auto bar_height = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:height");
416 
417 	auto& gaps = node.parent == nullptr ? gaps_out : gaps_in;
418-	auto tpos = node.position + Vector2D(gaps->left, gaps->top) + node.gap_topleft_offset;
419+	auto tpos = node.position + Vector2D((int) gaps->left, (int) gaps->top) + node.gap_topleft_offset;
420 
421 	// clang-format off
422 	auto tsize = Vector2D(
423@@ -533,7 +533,7 @@ void Hy3TabGroup::renderTabBar() {
424 
425 	auto scaled_pos = Vector2D(std::round(pos.x * scale), std::round(pos.y * scale));
426 	auto scaled_size = Vector2D(std::round(size.x * scale), std::round(size.y * scale));
427-	wlr_box box = {scaled_pos.x, scaled_pos.y, scaled_size.x, scaled_size.y};
428+	CBox box = {scaled_pos.x, scaled_pos.y, scaled_size.x, scaled_size.y};
429 
430 	// monitor size is not scaled
431 	if (pos.x > monitor_size.x || pos.y > monitor_size.y || scaled_pos.x + scaled_size.x < 0