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

commitac33cac1d923eee099feb81ed6f181391ab29989
parent78130df88e
authorLeon Henrik Plickat <[email protected]>
date2022-01-29 15:40
Cursor: update image if needed on xcursor theme change

 river/Cursor.zig | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/river/Cursor.zig b/river/Cursor.zig
index 19b9762..acc19eb 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -188,7 +188,8 @@ pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
     }
 
     // If this cursor belongs to the default seat, set the xcursor environment
-    // variables and the xwayland cursor theme.
+    // variables as well as the xwayland cursor theme and update the cursor
+    // image if necessary.
     if (self.seat == server.input_manager.defaultSeat()) {
         const size_str = try std.fmt.allocPrintZ(util.gpa, "{}", .{size});
         defer util.gpa.free(size_str);
@@ -211,6 +212,10 @@ pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
                 @intCast(i32, image.hotspot_y),
             );
         }
+
+        if (self.image != .unknown) {
+            self.xcursor_manager.setCursorImage(@tagName(self.image), self.wlr_cursor);
+        }
     }
 }