Cursor: actually set xcursor_name

This commit is contained in:
MaxVerevkin 2024-01-04 19:03:37 +02:00 committed by Isaac Freund
parent c86f460135
commit 9f0e0f2c0a
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -276,12 +276,17 @@ pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
} }
if (self.xcursor_name) |name| { 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 { fn clearFocus(self: *Self) void {
self.wlr_cursor.setXcursor(self.xcursor_manager, "left_ptr"); self.setXcursor("left_ptr");
self.seat.wlr_seat.pointerNotifyClearFocus(); 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.seat.wlr_seat.pointerNotifyClearFocus();
cursor.wlr_cursor.setXcursor(cursor.xcursor_manager, xcursor_name); cursor.setXcursor(xcursor_name);
server.root.applyPending(); server.root.applyPending();
} }