Cursor: update image if needed on xcursor theme change

This commit is contained in:
Leon Henrik Plickat 2022-01-29 15:40:29 +01:00 committed by GitHub
parent 363efd3e79
commit 214ad65b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
}
}