cursor: ensure theme loaded on output creation
This commit is contained in:
parent
43bcce9afe
commit
627ab7ec8a
@ -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
|
/// 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 {
|
pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
|
||||||
const server = self.seat.input_manager.server;
|
const server = self.seat.input_manager.server;
|
||||||
const size = _size orelse default_size;
|
const size = _size orelse default_size;
|
||||||
|
@ -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.
|
// layout. This automatically creates an output global on the wl_display.
|
||||||
c.wlr_output_layout_add_auto(root.wlr_output_layout, wlr_output);
|
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 width: c_int = undefined;
|
||||||
var height: c_int = undefined;
|
var height: c_int = undefined;
|
||||||
c.wlr_output_effective_resolution(wlr_output, &width, &height);
|
c.wlr_output_effective_resolution(wlr_output, &width, &height);
|
||||||
|
Loading…
Reference in New Issue
Block a user