c0437b27a30569aeafcab7d6f02a0fc14b6ebd77
- Author
- nnra6864 <nnra2210@gmail.com>
- Committer
- outfoxxed <outfoxxed@outfoxxed.me>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/flake.lock b/flake.lock
2index 1e3387e22cf5aee1e5f0452dffed1d601ed7c8ac..9c334bbacf35110e31e8b827e26f3586756f8119 100644
3--- a/flake.lock
4+++ b/flake.lock
5@@ -20,11 +20,11 @@
6 ]
7 },
8 "locked": {
9- "lastModified": 1762356719,
10- "narHash": "sha256-qwd/xdoOya1m8FENle+4hWnydCtlXUWLAW/Auk6WL7s=",
11+ "lastModified": 1763922789,
12+ "narHash": "sha256-XnkWjCpeXfip9tqYdL0b0zzBDjq+dgdISvEdSVGdVyA=",
13 "owner": "hyprwm",
14 "repo": "aquamarine",
15- "rev": "6d0b3567584691bf9d8fedb5d0093309e2f979c7",
16+ "rev": "a20a0e67a33b6848378a91b871b89588d3a12573",
17 "type": "github"
18 },
19 "original": {
20@@ -36,11 +36,11 @@
21 "flake-compat": {
22 "flake": false,
23 "locked": {
24- "lastModified": 1747046372,
25- "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
26+ "lastModified": 1761588595,
27+ "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
28 "owner": "edolstra",
29 "repo": "flake-compat",
30- "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
31+ "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
32 "type": "github"
33 },
34 "original": {
35@@ -116,11 +116,11 @@
36 ]
37 },
38 "locked": {
39- "lastModified": 1762462052,
40- "narHash": "sha256-6roLYzcDf4V38RUMSqycsOwAnqfodL6BmhRkUtwIgdA=",
41+ "lastModified": 1763733840,
42+ "narHash": "sha256-JnET78yl5RvpGuDQy3rCycOCkiKoLr5DN1fPhRNNMco=",
43 "owner": "hyprwm",
44 "repo": "hyprgraphics",
45- "rev": "ffc999d980c7b3bca85d3ebd0a9fbadf984a8162",
46+ "rev": "8f1bec691b2d198c60cccabca7a94add2df4ed1a",
47 "type": "github"
48 },
49 "original": {
50@@ -145,17 +145,17 @@
51 "xdph": "xdph"
52 },
53 "locked": {
54- "lastModified": 1763427561,
55- "narHash": "sha256-jARAMSNHOZ5RNYlBZ2wlE2pdujedylA5QDBuaQs3Vrk=",
56+ "lastModified": 1764110666,
57+ "narHash": "sha256-prU18d3zNddHZsdqh5o8vLVNONDgxVloFhXZgUxO4CI=",
58 "owner": "hyprwm",
59 "repo": "hyprland",
60- "rev": "edc311544a54a06ce4acb759b4d9a30853695452",
61+ "rev": "40d8fa84919c6d0e9fcb1536f4bc09710d4c031c",
62 "type": "github"
63 },
64 "original": {
65 "owner": "hyprwm",
66 "repo": "hyprland",
67- "rev": "edc311544a54a06ce4acb759b4d9a30853695452",
68+ "rev": "40d8fa84919c6d0e9fcb1536f4bc09710d4c031c",
69 "type": "github"
70 }
71 },
72@@ -192,11 +192,11 @@
73 ]
74 },
75 "locked": {
76- "lastModified": 1762755186,
77- "narHash": "sha256-ZjjETUHtoEhVN7JI1Cbt3p/KcXpK8ZQaPHx7UkG1OgA=",
78+ "lastModified": 1763727565,
79+ "narHash": "sha256-vRff/2R1U1jzPBy4OODqh2kfUzmizW/nfV2ROzTDIKo=",
80 "owner": "hyprwm",
81 "repo": "hyprland-guiutils",
82- "rev": "66356e20a8ed348aa49c1b9ceace786e224225b3",
83+ "rev": "7724d3a12a0453e7aae05f2ef39474219f05a4b4",
84 "type": "github"
85 },
86 "original": {
87@@ -246,11 +246,11 @@
88 ]
89 },
90 "locked": {
91- "lastModified": 1763254292,
92- "narHash": "sha256-JNgz3Fz2KMzkT7aR72wsgu/xNeJB//LSmdilh8Z/Zao=",
93+ "lastModified": 1763819661,
94+ "narHash": "sha256-0jLarTR/BLWdGlboM86bPVP2zKJNI2jvo3JietnDkOM=",
95 "owner": "hyprwm",
96 "repo": "hyprlang",
97- "rev": "deea98d5b61d066bdc7a68163edd2c4bd28d3a6b",
98+ "rev": "a318deec0c12409ec39c68d2be8096b636dc2a5c",
99 "type": "github"
100 },
101 "original": {
102@@ -298,11 +298,11 @@
103 ]
104 },
105diff --git a/flake.nix b/flake.nix
106index 59c5524bae8dc778630ed6ff7f470d77809f867b..0a9eaf00d3f7855b2ebd46f95b6754c6d032536b 100644
107--- a/flake.nix
108+++ b/flake.nix
109@@ -1,6 +1,6 @@
110 {
111 inputs = {
112- hyprland.url = "github:hyprwm/hyprland/edc311544a54a06ce4acb759b4d9a30853695452";
113+ hyprland.url = "github:hyprwm/hyprland/40d8fa84919c6d0e9fcb1536f4bc09710d4c031c";
114 };
115
116 outputs = { self, hyprland, ... }: let
117diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
118index 7d5c380e105e0f3a4ddafd2b61c303a28a6c78fe..0e120100fe83a848feeca71a9b078ca64a4e7d71 100644
119--- a/src/Hy3Layout.cpp
120+++ b/src/Hy3Layout.cpp
121@@ -5,6 +5,7 @@
122
123 #include <dlfcn.h>
124 #include <hyprland/src/Compositor.hpp>
125+#include <hyprland/src/desktop/state/FocusState.hpp>
126 #include <hyprland/src/config/ConfigManager.hpp>
127 #include <hyprland/src/desktop/DesktopTypes.hpp>
128 #include <hyprland/src/desktop/Workspace.hpp>
129@@ -33,8 +34,8 @@
130 PHLWORKSPACE workspace_for_action(bool allow_fullscreen) {
131 if (g_pLayoutManager->getCurrentLayout() != g_Hy3Layout.get()) return nullptr;
132
133- auto workspace = g_pCompositor->m_lastMonitor->m_activeSpecialWorkspace;
134- if (!valid(workspace)) workspace = g_pCompositor->m_lastMonitor->m_activeWorkspace;
135+ auto workspace = Desktop::focusState()->monitor()->m_activeSpecialWorkspace;
136+ if (!valid(workspace)) workspace = Desktop::focusState()->monitor()->m_activeWorkspace;
137
138 if (!valid(workspace)) return nullptr;
139 if (!allow_fullscreen && workspace->m_hasFullscreenWindow) return nullptr;
140@@ -144,7 +145,7 @@ void Hy3Layout::insertNode(Hy3Node& node) {
141 }
142
143 if (opening_after == nullptr) {
144- auto last_window = g_pCompositor->m_lastWindow;
145+ auto last_window = Desktop::focusState()->window();
146 if (last_window != nullptr && last_window->m_workspace == node.workspace
147 && !last_window->m_isFloating
148 && (node.data.is_window() || last_window != node.data.as_window())
149@@ -412,7 +413,7 @@ ShiftDirection reverse(ShiftDirection direction) {
150 }
151
152 void Hy3Layout::resizeActiveWindow(const Vector2D& delta, eRectCorner corner, PHLWINDOW pWindow) {
153- auto window = pWindow ? pWindow : g_pCompositor->m_lastWindow.lock();
154+ auto window = pWindow ? pWindow : Desktop::focusState()->window();
155 if (!valid(window)) return;
156
157 auto* node = this->getNodeFromWindow(window.get());
158@@ -943,7 +944,7 @@ void Hy3Layout::shiftFocus(
159 bool visible,
160 bool warp
161 ) {
162- auto current_window = g_pCompositor->m_lastWindow.lock();
163+ auto current_window = Desktop::focusState()->window();
164
165 if (current_window != nullptr) {
166 if (current_window->m_workspace->m_hasFullscreenWindow) {
167@@ -956,7 +957,7 @@ void Hy3Layout::shiftFocus(
168
169 if (next_window != nullptr) {
170 g_pInputManager->unconstrainMouse();
171- g_pCompositor->focusWindow(next_window);
172+ Desktop::focusState()->fullWindowFocus(next_window);
173 if (warp) Hy3Layout::warpCursorToBox(next_window->m_position, next_window->m_size);
174 }
175 return;
176@@ -989,7 +990,7 @@ Hy3Node* Hy3Layout::focusMonitor(ShiftDirection direction) {
177
178 if (next_monitor) {
179 bool found = false;
180- g_pCompositor->setActiveMonitor(next_monitor);
181+ Desktop::focusState()->rawMonitorFocus(next_monitor);
182 auto next_workspace = next_monitor->m_activeWorkspace;
183
184 if (next_workspace) {
185@@ -1017,7 +1018,7 @@ bool Hy3Layout::shiftMonitor(Hy3Node& node, ShiftDirection direction, bool follo
186 auto next_monitor = g_pCompositor->getMonitorInDirection(getShiftDirectionChar(direction));
187
188 if (next_monitor) {
189- g_pCompositor->setActiveMonitor(next_monitor);
190+ Desktop::focusState()->rawMonitorFocus(next_monitor);
191 auto next_workspace = next_monitor->m_activeWorkspace;
192 if (next_workspace) {
193 moveNodeToWorkspace(node.workspace.get(), next_workspace->m_name, follow, false);
194@@ -1028,7 +1029,7 @@ bool Hy3Layout::shiftMonitor(Hy3Node& node, ShiftDirection direction, bool follo
195 }
196
197 void Hy3Layout::toggleFocusLayer(const CWorkspace* workspace, bool warp) {
198- auto current_window = g_pCompositor->m_lastWindow.lock();
199+ auto current_window = Desktop::focusState()->window();
200 if (!current_window) return;
201
202 PHLWINDOW target;
203@@ -1040,7 +1041,7 @@ void Hy3Layout::toggleFocusLayer(const CWorkspace* workspace, bool warp) {
204
205 if (!target) return;
206
207- g_pCompositor->focusWindow(target);
208+ Desktop::focusState()->fullWindowFocus(target);
209
210 if (warp) {
211 Hy3Layout::warpCursorWithFocus(target->middle());
212@@ -1048,7 +1049,7 @@ void Hy3Layout::toggleFocusLayer(const CWorkspace* workspace, bool warp) {
213 }
214
215 void Hy3Layout::warpCursor() {
216- auto current_window = g_pCompositor->m_lastWindow.lock();
217+ auto current_window = Desktop::focusState()->window();
218
219 if (current_window != nullptr) {
220 if (current_window != nullptr) {
221diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
222index 4bd66d0974080d5e7202a5631b8627c68ae33167..74c751b5a669478f154c2a02c62c513b8b1c6288 100644
223--- a/src/Hy3Node.cpp
224+++ b/src/Hy3Node.cpp
225@@ -4,6 +4,7 @@
226
227 #include <bits/ranges_util.h>
228 #include <hyprland/src/Compositor.hpp>
229+#include <hyprland/src/desktop/state/FocusState.hpp>
230 #include <hyprland/src/config/ConfigManager.hpp>
231 #include <hyprland/src/defines.hpp>
232 #include <hyprland/src/plugins/PluginAPI.hpp>
233@@ -176,12 +177,12 @@ void Hy3Node::focus(bool warp) {
234 case Hy3NodeType::Window: {
235 auto window = this->data.as_window();
236 window->setHidden(false);
237- g_pCompositor->focusWindow(window);
238+ Desktop::focusState()->fullWindowFocus(window);
239 if (warp) Hy3Layout::warpCursorToBox(window->m_position, window->m_size);
240 break;
241 }
242 case Hy3NodeType::Group: {
243- g_pCompositor->focusWindow(nullptr);
244+ Desktop::focusState()->fullWindowFocus(nullptr);
245 this->raiseToTop();
246
247 if (warp) Hy3Layout::warpCursorToBox(this->position, this->size);
248@@ -218,7 +219,7 @@ PHLWINDOW Hy3Node::bringToTop() {
249
250 void Hy3Node::focusWindow() {
251 auto window = this->bringToTop();
252- if (window != nullptr) g_pCompositor->focusWindow(window);
253+ if (window != nullptr) Desktop::focusState()->fullWindowFocus(window);
254 }
255
256 void markGroupFocusedRecursive(Hy3GroupData& group) {
257diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
258index 93cf7f5cd593bce35d69136a0825a06d88a9caa1..b3df4ab99bb18c9da26807ff5decc817696e0f8a 100644
259--- a/src/TabGroup.cpp
260+++ b/src/TabGroup.cpp
261@@ -6,6 +6,7 @@
262 #include <cairo/cairo.h>
263 #include <hyprgraphics/color/Color.hpp>
264 #include <hyprland/src/Compositor.hpp>
265+#include <hyprland/src/desktop/state/FocusState.hpp>
266 #include <hyprland/src/config/ConfigManager.hpp>
267 #include <hyprland/src/desktop/DesktopTypes.hpp>
268 #include <hyprland/src/desktop/Workspace.hpp>
269@@ -524,7 +525,7 @@ exitloop:
270 auto active = parent_focused && (parent_group.focused_child == *node || parent_group.group_focused);
271 entry->setActive(active);
272
273- auto& last_monitor = g_pCompositor->m_lastMonitor;
274+ auto last_monitor = Desktop::focusState()->monitor();
275 entry->setMonitorActive(active && (!last_monitor || (*node)->getMonitor() == last_monitor.get()));
276
277 entry->setUrgent((*node)->isUrgent());