diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-07-17 20:40:33 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-07-17 20:40:33 +0200 |
| commit | 627ab7ec8adb653f99cb91c6142b371eb572a55e (patch) | |
| tree | 2bb0a1539e48bec95ffc4820fd2f069b640a4ef8 | |
| parent | 43bcce9afe70e321fdfd96a24ec10ee21ed099c3 (diff) | |
| download | river-627ab7ec8adb653f99cb91c6142b371eb572a55e.tar.gz river-627ab7ec8adb653f99cb91c6142b371eb572a55e.tar.xz | |
cursor: ensure theme loaded on output creation
| -rw-r--r-- | river/Cursor.zig | 3 | ||||
| -rw-r--r-- | river/Output.zig | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/river/Cursor.zig b/river/Cursor.zig index a8d2a21..90b9225 100644 --- a/river/Cursor.zig +++ b/river/Cursor.zig @@ -118,7 +118,8 @@ pub fn deinit(self: *Self) void { } /// Set the cursor theme for the given seat, as well as the xwayland theme if -/// this is the default seat. +/// this is the default seat. Either argument may be null, in which case a +/// default will be used. pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void { const server = self.seat.input_manager.server; const size = _size orelse default_size; diff --git a/river/Output.zig b/river/Output.zig index fdefb0f..86e8514 100644 --- a/river/Output.zig +++ b/river/Output.zig @@ -142,6 +142,15 @@ pub fn init(self: *Self, root: *Root, wlr_output: *c.wlr_output) !void { // layout. This automatically creates an output global on the wl_display. c.wlr_output_layout_add_auto(root.wlr_output_layout, wlr_output); + // Ensure that a cursor image at the output's scale factor is loaded + // for each seat. + var it = root.server.input_manager.seats.first; + while (it) |node| : (it = node.next) { + const seat = &node.data; + if (!c.wlr_xcursor_manager_load(seat.cursor.wlr_xcursor_manager, wlr_output.scale)) + log.err(.cursor, "failed to load xcursor theme at scale {}", .{wlr_output.scale}); + } + var width: c_int = undefined; var height: c_int = undefined; c.wlr_output_effective_resolution(wlr_output, &width, &height); |
