1376a4f3d02fc17987c18dea1814a7aa90bf92c3
- Author
- outfoxxed <outfoxxed@outfoxxed.me>
- 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 0356e87f1e8683565479254da386290d19b69f1a..dce26e35ab820f17bef5154f1d76063e06a6219c 100644
3--- a/flake.lock
4+++ b/flake.lock
5@@ -9,11 +9,11 @@
6 "xdph": "xdph"
7 },
8 "locked": {
9- "lastModified": 1693851147,
10- "narHash": "sha256-kkI7FXwKufOmNIIQQHr868tneIV8ggqupBA0EJ/jAuI=",
11+ "lastModified": 1694074808,
12+ "narHash": "sha256-gFHAGWaGh5ZM144wPSYJ6EXam3xmyS2wLwjLhjd7OKU=",
13 "owner": "hyprwm",
14 "repo": "Hyprland",
15- "rev": "4ddcda93f5887792a953332bf1b487e4b2c3b4ed",
16+ "rev": "0be6b03ee972fcc4921984f3b68469a2ee121511",
17 "type": "github"
18 },
19 "original": {
20@@ -49,11 +49,11 @@
21 },
22 "nixpkgs": {
23 "locked": {
24- "lastModified": 1693158576,
25- "narHash": "sha256-aRTTXkYvhXosGx535iAFUaoFboUrZSYb1Ooih/auGp0=",
26+ "lastModified": 1693844670,
27+ "narHash": "sha256-t69F2nBB8DNQUWHD809oJZJVE+23XBrth4QZuVd6IE0=",
28 "owner": "NixOS",
29 "repo": "nixpkgs",
30- "rev": "a999c1cc0c9eb2095729d5aa03e0d8f7ed256780",
31+ "rev": "3c15feef7770eb5500a4b8792623e2d6f598c9c1",
32 "type": "github"
33 },
34 "original": {
35@@ -118,11 +118,11 @@
36 ]
37 },
38 "locked": {
39- "lastModified": 1691841170,
40- "narHash": "sha256-RCTm1/MVWYPnReMgyp7tr2ogGYo/pvw38jZaFwemgPU=",
41+ "lastModified": 1694025408,
42+ "narHash": "sha256-oJNhGfZH8Z2w3ztXdzsYVg32//cWEcPVDM3+tp/ZVfU=",
43 "owner": "hyprwm",
44 "repo": "xdg-desktop-portal-hyprland",
45- "rev": "57a3a41ba6b358109e4fc25c6a4706b5f7d93c6b",
46+ "rev": "022469529c8bc95acf222dc5a62389b04c8b1205",
47 "type": "github"
48 },
49 "original": {
50diff --git a/flake.nix b/flake.nix
51index 34c543b4901f7712e763ac8783e25739884b6b46..3be3c6c176b184756a14ae005150b540ad2937cc 100644
52--- a/flake.nix
53+++ b/flake.nix
54@@ -7,8 +7,10 @@
55 inherit (hyprland.inputs) nixpkgs;
56 hyprlandSystems = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system});
57 in {
58- packages = hyprlandSystems (system: pkgs: rec {
59- hy3 = pkgs.stdenv.mkDerivation {
60+ packages = hyprlandSystems (system: pkgs: let
61+ hyprlandPackage = hyprland.packages.${system}.hyprland;
62+ in rec {
63+ hy3 = hyprlandPackage.stdenv.mkDerivation {
64 pname = "hy3";
65 version = "0.1";
66 src = ./.;
67@@ -16,10 +18,10 @@
68 nativeBuildInputs = with pkgs; [ cmake pkg-config ];
69
70 buildInputs = with pkgs; [
71- hyprland.packages.${system}.hyprland.dev
72+ hyprlandPackage.dev
73 pango
74 cairo
75- ] ++ hyprland.packages.${system}.hyprland.buildInputs;
76+ ] ++ hyprlandPackage.buildInputs;
77
78 # no noticeable impact on performance and greatly assists debugging
79 cmakeBuildType = "Debug";
80@@ -37,7 +39,9 @@
81 });
82
83 devShells = hyprlandSystems (system: pkgs: {
84- default = pkgs.mkShell {
85+ default = pkgs.mkShell.override {
86+ stdenv = pkgs.gcc13Stdenv;
87+ } {
88 name = "hy3";
89
90 nativeBuildInputs = with pkgs; [
91diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
92index b51a2f83faa0685d4a7ae9023d94c6be554b3dd3..5c6a376b564a72d90c3e05d5877d621b0d9f6658 100644
93--- a/src/Hy3Layout.cpp
94+++ b/src/Hy3Layout.cpp
95@@ -68,16 +68,21 @@ void Hy3Layout::onWindowCreated(CWindow* window) {
96 }
97
98 void Hy3Layout::onWindowCreatedTiling(CWindow* window) {
99+ hy3_log(
100+ TRACE,
101+ "onWindowCreatedTiling called with window {:x} (floating: {})",
102+ (uintptr_t) window,
103+ window->m_bIsFloating
104+ );
105 if (window->m_bIsFloating) return;
106
107 auto* existing = this->getNodeFromWindow(window);
108 if (existing != nullptr) {
109- Debug::log(
110- WARN,
111- "Attempted to add a window(%p) that is already tiled(as %p) to the "
112- "layout",
113- window,
114- existing
115+ hy3_log(
116+ ERR,
117+ "onWindowCreatedTiling called with a window ({:x}) that is already tiled (node: {:x})",
118+ (uintptr_t) window,
119+ (uintptr_t) existing
120 );
121 return;
122 }
123@@ -136,17 +141,17 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window) {
124 }
125
126 if (opening_into->data.type != Hy3NodeType::Group) {
127- Debug::log(ERR, "opening_into node %p was not of type Group", opening_into);
128+ hy3_log(ERR, "opening_into node ({:x}) was not a group node", (uintptr_t) opening_into);
129 errorNotif();
130 return;
131 }
132
133 if (opening_into->workspace_id != window->m_iWorkspaceID) {
134- Debug::log(
135+ hy3_log(
136 WARN,
137- "opening_into node %p has workspace %d which does not match the "
138- "opening window (workspace %d)",
139- opening_into,
140+ "opening_into node ({:x}) is on workspace {} which does not match the new window "
141+ "(workspace {})",
142+ (uintptr_t) opening_into,
143 opening_into->workspace_id,
144 window->m_iWorkspaceID
145 );
146@@ -198,24 +203,17 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window) {
147 children.insert(iter2, &node);
148 }
149
150- Debug::log(
151+ hy3_log(
152 LOG,
153- "opened new window %p(node: %p) on window %p in %p",
154- window,
155- &node,
156- opening_after,
157- opening_into
158+ "tiled window ({:x} as node {:x}) after node {:x} in node {:x}",
159+ (uintptr_t) window,
160+ (uintptr_t) &node,
161+ (uintptr_t) opening_after,
162+ (uintptr_t) opening_into
163 );
164
165 node.markFocused();
166 opening_into->recalcSizePosRecursive();
167- Debug::log(
168- LOG,
169- "opening_into (%p) contains new child (%p)? %d",
170- opening_into,
171- &node,
172- opening_into->data.as_group.hasChild(&node)
173- );
174 }
175
176 void Hy3Layout::onWindowRemovedTiling(CWindow* window) {
177@@ -223,12 +221,16 @@ void Hy3Layout::onWindowRemovedTiling(CWindow* window) {
178 = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:node_collapse_policy")->intValue;
179
180 auto* node = this->getNodeFromWindow(window);
181- Debug::log(LOG, "remove tiling %p (window %p)", node, window);
182
183- if (node == nullptr) {
184- Debug::log(ERR, "onWindowRemovedTiling node null?");
185- return;
186- }
187+ if (node == nullptr) return;
188+
189+ hy3_log(
190+ LOG,
191+ "removing window ({:x} as node {:x}) from node {:x}",
192+ (uintptr_t) window,
193+ (uintptr_t) node,
194+ (uintptr_t) node->parent
195diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
196index 4c44880d004a3cbfa96a3f900827c422c9f46f43..2a47b8ea421d2119492437894ae9b875f4845c40 100644
197--- a/src/Hy3Node.cpp
198+++ b/src/Hy3Node.cpp
199@@ -31,7 +31,6 @@ Hy3GroupData::~Hy3GroupData() {
200 }
201
202 bool Hy3GroupData::hasChild(Hy3Node* node) {
203- Debug::log(LOG, "Searching for child %p of %p", this, node);
204 for (auto child: this->children) {
205 if (child == node) return true;
206
207@@ -88,13 +87,6 @@ Hy3NodeData::Hy3NodeData(Hy3GroupData group): type(Hy3NodeType::Group) {
208 }
209
210 Hy3NodeData::Hy3NodeData(Hy3NodeData&& from): type(from.type) {
211- Debug::log(
212- LOG,
213- "Move CTor type matches? %d is group? %d",
214- this->type == from.type,
215- this->type == Hy3NodeType::Group
216- );
217-
218 switch (from.type) {
219 case Hy3NodeType::Window: this->as_window = from.as_window; break;
220 case Hy3NodeType::Group: new (&this->as_group) Hy3GroupData(std::move(from.as_group)); break;
221@@ -126,13 +118,6 @@ Hy3NodeData& Hy3NodeData::operator=(Hy3GroupLayout layout) {
222 }
223
224 Hy3NodeData& Hy3NodeData::operator=(Hy3NodeData&& from) {
225- Debug::log(
226- LOG,
227- "operator= type matches? %d is group? %d",
228- this->type == from.type,
229- this->type == Hy3NodeType::Group
230- );
231-
232 if (this->type == Hy3NodeType::Group) {
233 this->as_group.~Hy3GroupData();
234 }
235@@ -235,15 +220,6 @@ Hy3Node* Hy3Node::getFocusedNode(bool ignore_group_focus, bool stop_at_expanded)
236 switch (this->data.type) {
237 case Hy3NodeType::Window: return this;
238 case Hy3NodeType::Group:
239- Debug::log(
240- LOG,
241- "focusing %p, gf: %d, ef: %d (stop: %d)",
242- this,
243- this->data.as_group.group_focused,
244- this->data.as_group.expand_focused,
245- stop_at_expanded
246- );
247-
248 if (this->data.as_group.focused_child == nullptr
249 || (!ignore_group_focus && this->data.as_group.group_focused)
250 || (stop_at_expanded && this->data.as_group.expand_focused != ExpandFocusType::NotExpanded))
251@@ -360,7 +336,12 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
252 }
253
254 if (expanded_node == nullptr) {
255- Debug::log(ERR, "indiect expand target is missing");
256+ hy3_log(
257+ ERR,
258+ "recalcSizePosRecursive: unable to find expansion target of latch node {:x}",
259+ (uintptr_t) this
260+ );
261+ errorNotif();
262 return;
263 }
264
265@@ -673,7 +654,7 @@ std::string Hy3Node::debugNode() {
266 Hy3Node* Hy3Node::removeFromParentRecursive(Hy3Node** expand_actor) {
267 Hy3Node* parent = this;
268
269- Debug::log(LOG, "Recursively removing parent nodes of %p", parent);
270+ hy3_log(TRACE, "removing parent nodes of {:x} recursively", (uintptr_t) parent);
271
272 if (this->parent != nullptr) {
273 auto& actor = this->getExpandActor();
274@@ -685,14 +666,7 @@ Hy3Node* Hy3Node::removeFromParentRecursive(Hy3Node** expand_actor) {
275
276 while (parent != nullptr) {
277 if (parent->parent == nullptr) {
278- Debug::log(ERR, "* UAF DEBUGGING - %p's parent is null, its the root group", parent);
279-
280- if (parent == this) {
281- Debug::log(ERR, "* UAF DEBUGGING - returning nullptr as this == root group");
282- } else {
283- Debug::log(ERR, "* UAF DEBUGGING - deallocing %p and returning nullptr", parent);
284- parent->layout->nodes.remove(*parent);
285- }
286+ if (parent != this) parent->layout->nodes.remove(*parent);
287 return nullptr;
288 }
289
290@@ -712,12 +686,12 @@ Hy3Node* Hy3Node::removeFromParentRecursive(Hy3Node** expand_actor) {
291 }
292
293 if (!group.children.remove(child)) {
294- Debug::log(
295+ hy3_log(
296 ERR,
297- "Was unable to remove child node %p from parent %p. Child likely has "
298- "a false parent pointer.",
299diff --git a/src/SelectionHook.cpp b/src/SelectionHook.cpp
300index a99f0b6fa7806ecfe79ce6976c903944612cab77..29bffc0b12f2a19ef4be111701300c97c9e8db19 100644
301--- a/src/SelectionHook.cpp
302+++ b/src/SelectionHook.cpp
303@@ -8,7 +8,6 @@ inline CFunctionHook* g_LastSelectionHook = nullptr;
304
305 void hook_updateDecos(void* thisptr, CWindow* window) {
306 bool explicitly_selected = g_Hy3Layout->shouldRenderSelected(window);
307- Debug::log(LOG, "update decos for %p - selected: %d", window, explicitly_selected);
308
309 auto* lastWindow = g_pCompositor->m_pLastWindow;
310 if (explicitly_selected) {
311@@ -28,12 +27,14 @@ void init() {
312
313 if (decoUpdateCandidates.size() != 1) {
314 g_LastSelectionHook = nullptr;
315- Debug::log(
316+
317+ hy3_log(
318 ERR,
319- "Expected one matching function to hook for "
320- "\"updateWindowAnimatedDecorationValues\", found %d",
321+ "expected one matching function to hook for"
322+ "\"updateWindowAnimatedDecorationValues\", found {}",
323 decoUpdateCandidates.size()
324 );
325+
326 HyprlandAPI::addNotificationV2(
327 PHANDLE,
328 {
329diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
330index 6d3504ae48a71039d23ccbe181ed45d4655621f0..bbfcc5b12f6b78aa29a8ec8dbc460d824b40c2d5 100644
331--- a/src/TabGroup.cpp
332+++ b/src/TabGroup.cpp
333@@ -449,7 +449,6 @@ Hy3TabGroup::Hy3TabGroup(Hy3Node& node) {
334 }
335
336 void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
337- Debug::log(LOG, "updated tab bar for %p", &node);
338 static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
339 static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
340 static const auto* bar_height
341diff --git a/src/globals.hpp b/src/globals.hpp
342index 856f1936573d8add87f9c7d1b76e9e2a9e515a97..87b62962ef30d561ee23667ce67aad44fa1088a0 100644
343--- a/src/globals.hpp
344+++ b/src/globals.hpp
345@@ -1,4 +1,8 @@
346+#pragma once
347+
348 #include "Hy3Layout.hpp"
349+#include "log.hpp"
350+
351 #include <hyprland/src/plugins/PluginAPI.hpp>
352
353 inline HANDLE PHANDLE = nullptr;
354diff --git a/src/log.hpp b/src/log.hpp
355new file mode 100644
356index 0000000000000000000000000000000000000000..60c30a1382be7b19a57458ac3e8336e6ce67d307
357--- /dev/null
358+++ b/src/log.hpp
359@@ -0,0 +1,8 @@
360+#pragma once
361+
362+#include <hyprland/src/debug/Log.hpp>
363+
364+template <typename... Args>
365+void hy3_log(LogLevel level, const std::string& fmt, Args&&... args) {
366+ Debug::log(level, "[hy3] " + fmt, args...);
367+}