0a41a2ab5f0d5562c4ffae9cef4648c450a248a1

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

fixup: account for window rules rewrite

Diff

This diff is truncated to protect this page.

  1diff --git a/flake.lock b/flake.lock
  2index b301a2ce7b13667209a142a1572e4e3ea134716e..1e3387e22cf5aee1e5f0452dffed1d601ed7c8ac 100644
  3--- a/flake.lock
  4+++ b/flake.lock
  5@@ -20,11 +20,11 @@
  6         ]
  7       },
  8       "locked": {
  9-        "lastModified": 1760101617,
 10-        "narHash": "sha256-8jf/3ZCi+B7zYpIyV04+3wm72BD7Z801IlOzsOACR7I=",
 11+        "lastModified": 1762356719,
 12+        "narHash": "sha256-qwd/xdoOya1m8FENle+4hWnydCtlXUWLAW/Auk6WL7s=",
 13         "owner": "hyprwm",
 14         "repo": "aquamarine",
 15-        "rev": "1826a9923881320306231b1c2090379ebf9fa4f8",
 16+        "rev": "6d0b3567584691bf9d8fedb5d0093309e2f979c7",
 17         "type": "github"
 18       },
 19       "original": {
 20@@ -116,11 +116,11 @@
 21         ]
 22       },
 23       "locked": {
 24-        "lastModified": 1760445448,
 25-        "narHash": "sha256-fXGjL6dw31FPFRrmIemzGiNSlfvEJTJNsmadZi+qNhI=",
 26+        "lastModified": 1762462052,
 27+        "narHash": "sha256-6roLYzcDf4V38RUMSqycsOwAnqfodL6BmhRkUtwIgdA=",
 28         "owner": "hyprwm",
 29         "repo": "hyprgraphics",
 30-        "rev": "50fb9f069219f338a11cf0bcccb9e58357d67757",
 31+        "rev": "ffc999d980c7b3bca85d3ebd0a9fbadf984a8162",
 32         "type": "github"
 33       },
 34       "original": {
 35@@ -134,8 +134,8 @@
 36         "aquamarine": "aquamarine",
 37         "hyprcursor": "hyprcursor",
 38         "hyprgraphics": "hyprgraphics",
 39+        "hyprland-guiutils": "hyprland-guiutils",
 40         "hyprland-protocols": "hyprland-protocols",
 41-        "hyprland-qtutils": "hyprland-qtutils",
 42         "hyprlang": "hyprlang",
 43         "hyprutils": "hyprutils",
 44         "hyprwayland-scanner": "hyprwayland-scanner",
 45@@ -145,22 +145,43 @@
 46         "xdph": "xdph"
 47       },
 48       "locked": {
 49-        "lastModified": 1761869718,
 50-        "narHash": "sha256-jLfwwlPGpnGRAtVDyoGj9FgH2D9hWwyEu0yHkflG2EI=",
 51+        "lastModified": 1763427561,
 52+        "narHash": "sha256-jARAMSNHOZ5RNYlBZ2wlE2pdujedylA5QDBuaQs3Vrk=",
 53         "owner": "hyprwm",
 54         "repo": "hyprland",
 55-        "rev": "8e9add2afda58d233a75e4c5ce8503b24fa59ceb",
 56+        "rev": "edc311544a54a06ce4acb759b4d9a30853695452",
 57         "type": "github"
 58       },
 59       "original": {
 60         "owner": "hyprwm",
 61         "repo": "hyprland",
 62-        "rev": "8e9add2afda58d233a75e4c5ce8503b24fa59ceb",
 63+        "rev": "edc311544a54a06ce4acb759b4d9a30853695452",
 64         "type": "github"
 65       }
 66     },
 67-    "hyprland-protocols": {
 68+    "hyprland-guiutils": {
 69       "inputs": {
 70+        "aquamarine": [
 71+          "hyprland",
 72+          "aquamarine"
 73+        ],
 74+        "hyprgraphics": [
 75+          "hyprland",
 76+          "hyprgraphics"
 77+        ],
 78+        "hyprlang": [
 79+          "hyprland",
 80+          "hyprlang"
 81+        ],
 82+        "hyprtoolkit": "hyprtoolkit",
 83+        "hyprutils": [
 84+          "hyprland",
 85+          "hyprutils"
 86+        ],
 87+        "hyprwayland-scanner": [
 88+          "hyprland",
 89+          "hyprwayland-scanner"
 90+        ],
 91         "nixpkgs": [
 92           "hyprland",
 93           "nixpkgs"
 94@@ -171,62 +192,48 @@
 95         ]
 96       },
 97       "locked": {
 98-        "lastModified": 1759610243,
 99-        "narHash": "sha256-+KEVnKBe8wz+a6dTLq8YDcF3UrhQElwsYJaVaHXJtoI=",
100+        "lastModified": 1762755186,
101+        "narHash": "sha256-ZjjETUHtoEhVN7JI1Cbt3p/KcXpK8ZQaPHx7UkG1OgA=",
102         "owner": "hyprwm",
103-        "repo": "hyprland-protocols",
104-        "rev": "bd153e76f751f150a09328dbdeb5e4fab9d23622",
105diff --git a/flake.nix b/flake.nix
106index b38c0e105e00ee20da069bb51ccefe3511f423c0..59c5524bae8dc778630ed6ff7f470d77809f867b 100644
107--- a/flake.nix
108+++ b/flake.nix
109@@ -1,6 +1,6 @@
110 {
111   inputs = {
112-    hyprland.url = "github:hyprwm/hyprland/8e9add2afda58d233a75e4c5ce8503b24fa59ceb";
113+    hyprland.url = "github:hyprwm/hyprland/edc311544a54a06ce4acb759b4d9a30853695452";
114   };
115 
116   outputs = { self, hyprland, ... }: let
117diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
118index 697ce308b361c4d46d2fb164f7521cc87f35fea8..1199e1a904f252aff46afd53c97fbb1f56d157b6 100644
119--- a/src/Hy3Layout.cpp
120+++ b/src/Hy3Layout.cpp
121@@ -8,6 +8,7 @@
122 #include <hyprland/src/config/ConfigManager.hpp>
123 #include <hyprland/src/desktop/DesktopTypes.hpp>
124 #include <hyprland/src/desktop/Workspace.hpp>
125+#include <hyprland/src/desktop/rule/Engine.hpp>
126 #include <hyprland/src/managers/LayoutManager.hpp>
127 #include <hyprland/src/managers/PointerManager.hpp>
128 #include <hyprland/src/managers/SeatManager.hpp>
129@@ -25,6 +26,8 @@
130 #include "src/SharedDefs.hpp"
131 #include "src/desktop/WLSurface.hpp"
132 #include "src/desktop/Window.hpp"
133+#include "src/desktop/rule/Rule.hpp"
134+#include "src/desktop/types/OverridableVar.hpp"
135 #include "src/devices/IPointer.hpp"
136 
137 PHLWORKSPACE workspace_for_action(bool allow_fullscreen) {
138@@ -296,7 +299,7 @@ void Hy3Layout::onWindowRemovedTiling(PHLWINDOW window) {
139 	    (uintptr_t) node->parent
140 	);
141 
142-	window->unsetWindowData(PRIORITY_LAYOUT);
143+	window->m_ruleApplicator->resetProps(Desktop::Rule::RULE_PROP_ALL, Desktop::Types::PRIORITY_LAYOUT);
144 
145 	if (window->isFullscreen()) {
146 		g_pCompositor->setWindowFullscreenInternal(window, FSMODE_NONE);
147@@ -494,8 +497,7 @@ void Hy3Layout::fullscreenRequestForWindow(
148 
149 	const auto& monitor = window->m_monitor;
150 
151-	window->updateDynamicRules();
152-	window->updateWindowDecos();
153+	Desktop::Rule::ruleEngine()->updateAllRules();
154 
155 	if (target_mode == FSMODE_NONE) {
156 		auto* node = this->getNodeFromWindow(window.get());
157@@ -508,7 +510,7 @@ void Hy3Layout::fullscreenRequestForWindow(
158 			*window->m_realPosition = window->m_lastFloatingPosition;
159 			*window->m_realSize = window->m_lastFloatingSize;
160 
161-			window->unsetWindowData(PRIORITY_LAYOUT);
162+			window->m_ruleApplicator->resetProps(Desktop::Rule::RULE_PROP_ALL, Desktop::Types::PRIORITY_LAYOUT);
163 		}
164 	} else {
165 		// save position and size if floating
166@@ -638,7 +640,7 @@ PHLWINDOW Hy3Layout::findFloatingWindowCandidate(const CWindow* from) {
167 	for (auto& w: g_pCompositor->m_windows | std::views::reverse) {
168 		if (w->m_isMapped && !w->isHidden() && w->m_isFloating && !w->isX11OverrideRedirect()
169 		    && w->m_workspace == from->m_workspace && !w->m_X11ShouldntFocus
170-		    && !w->m_windowData.noFocus.valueOrDefault() && w.get() != from)
171+		    && !w->m_ruleApplicator->noFocus().valueOrDefault() && w.get() != from)
172 		{
173 			return w;
174 		}
175@@ -1055,8 +1057,7 @@ void changeNodeWorkspaceRecursive(Hy3Node& node, PHLWORKSPACE workspace) {
176 		window->moveToWorkspace(workspace);
177 		window->m_monitor = workspace->m_monitor;
178 		window->updateToplevel();
179-		window->updateDynamicRules();
180-		window->uncacheWindowDecos();
181+		Desktop::Rule::ruleEngine()->updateAllRules();
182 	} else {
183 		for (auto* child: node.data.as_group().children) {
184 			changeNodeWorkspaceRecursive(*child, workspace);
185@@ -1697,7 +1698,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
186 		return;
187 	}
188 
189-	window->unsetWindowData(PRIORITY_LAYOUT);
190+	window->m_ruleApplicator->resetProps(Desktop::Rule::RULE_PROP_ALL, Desktop::Types::PRIORITY_LAYOUT);
191 
192 	auto nodeBox = CBox(node->position, node->size);
193 	nodeBox.round();
194@@ -1712,15 +1713,6 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
195 	    && ((*no_gaps_when_only != 0 && (only_node || window->isFullscreen()))
196 	        || window->isEffectiveInternalFSMode(FSMODE_FULLSCREEN)))
197 	{
198-		window->m_windowData.decorate = CWindowOverridableVar(
199-		    true,
200-		    PRIORITY_LAYOUT
201-		); // a little curious but copying what dwindle does
202-		window->m_windowData.noBorder =
203-		    CWindowOverridableVar(*no_gaps_when_only != 2, PRIORITY_LAYOUT);
204-		window->m_windowData.noRounding = CWindowOverridableVar(true, PRIORITY_LAYOUT);
205-		window->m_windowData.noShadow = CWindowOverridableVar(true, PRIORITY_LAYOUT);
206-
207 		window->updateWindowDecos();
208 
209 		const auto reserved = window->getFullWindowReservedArea();
210diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
211index f2adc5f2c80f62513b035abbfe30452b5e645a96..4bd66d0974080d5e7202a5631b8627c68ae33167 100644
212--- a/src/Hy3Node.cpp
213+++ b/src/Hy3Node.cpp
214@@ -587,7 +587,7 @@ void Hy3Node::updateTabBarRecursive() {
215 void Hy3Node::updateDecos() {
216 	switch (this->data.type()) {
217 	case Hy3NodeType::Window:
218-		g_pCompositor->updateWindowAnimatedDecorationValues(this->data.as_window());
219+		this->data.as_window()->updateDecorationValues();
220 		break;
221 	case Hy3NodeType::Group:
222 		for (auto* child: this->data.as_group().children) {
223diff --git a/src/SelectionHook.cpp b/src/SelectionHook.cpp
224index 5e6c0bd4a5dafae8b09025f253cb3f8ca9f96bf3..a726e58e4b3e7ff359ecd924cb31759388491472 100644
225--- a/src/SelectionHook.cpp
226+++ b/src/SelectionHook.cpp
227@@ -6,15 +6,16 @@
228 namespace selection_hook {
229 inline CFunctionHook* g_LastSelectionHook = nullptr;
230 
231-void hook_updateDecos(void* thisptr, PHLWINDOW window) {
232-	bool explicitly_selected = g_Hy3Layout->shouldRenderSelected(window.get());
233+void hook_updateDecos(void* thisptr) {
234+	auto* window = static_cast<CWindow*>(thisptr);
235+	bool explicitly_selected = g_Hy3Layout->shouldRenderSelected(window);
236 
237 	auto lastWindow = g_pCompositor->m_lastWindow;
238 	if (explicitly_selected) {
239-		g_pCompositor->m_lastWindow = window;
240+		g_pCompositor->m_lastWindow = window->m_self;
241 	}
242 
243-	((void (*)(void*, PHLWINDOW)) g_LastSelectionHook->m_original)(thisptr, window);
244+	((void (*)(void*)) g_LastSelectionHook->m_original)(thisptr);
245 
246 	if (explicitly_selected) {
247 		g_pCompositor->m_lastWindow = lastWindow;
248@@ -23,7 +24,7 @@ void hook_updateDecos(void* thisptr, PHLWINDOW window) {
249 
250 void init() {
251 	static const auto decoUpdateCandidates =
252-	    HyprlandAPI::findFunctionsByName(PHANDLE, "updateWindowAnimatedDecorationValues");
253+	    HyprlandAPI::findFunctionsByName(PHANDLE, "updateDecorationValues");
254 
255 	if (decoUpdateCandidates.size() != 1) {
256 		g_LastSelectionHook = nullptr;
257@@ -31,7 +32,7 @@ void init() {
258 		hy3_log(
259 		    ERR,
260 		    "expected one matching function to hook for"
261-		    "\"updateWindowAnimatedDecorationValues\", found {}",
262+		    "\"updateDecorationValues\", found {}",
263 		    decoUpdateCandidates.size()
264 		);
265 
266@@ -40,7 +41,7 @@ void init() {
267 		    {
268 		        {"text",
269 		         "Failed to load function hooks: "
270-		         "\"updateWindowAnimatedDecorationValues\""},
271+		         "\"updateDecorationValues\""},
272 		        {"time", (uint64_t) 10000},
273 		        {"color", CHyprColor(1.0, 0.0, 0.0, 1.0)},
274 		        {"icon", ICON_ERROR},