git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit94b0280a3832133aed804ecd6cf598acf12e2f81
parentd6f6900fea
authorMaxVerevkin <[email protected]>
date2024-01-04 19:03
Cursor: actually set xcursor_name

 river/Cursor.zig | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/river/Cursor.zig b/river/Cursor.zig
index b288ee2..99a0e3b 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -276,12 +276,17 @@ pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
     }
 
     if (self.xcursor_name) |name| {
-        self.wlr_cursor.setXcursor(self.xcursor_manager, name);
+        self.setXcursor(name);
     }
 }
 
+pub fn setXcursor(self: *Self, name: [*:0]const u8) void {
+    self.wlr_cursor.setXcursor(self.xcursor_manager, name);
+    self.xcursor_name = name;
+}
+
 fn clearFocus(self: *Self) void {
-    self.wlr_cursor.setXcursor(self.xcursor_manager, "left_ptr");
+    self.setXcursor("left_ptr");
     self.seat.wlr_seat.pointerNotifyClearFocus();
 }
 
@@ -775,7 +780,7 @@ fn enterMode(cursor: *Self, mode: Mode, view: *View, xcursor_name: [*:0]const u8
     }
 
     cursor.seat.wlr_seat.pointerNotifyClearFocus();
-    cursor.wlr_cursor.setXcursor(cursor.xcursor_manager, xcursor_name);
+    cursor.setXcursor(xcursor_name);
 
     server.root.applyPending();
 }