river: add -no-xwayland cli flag

Add a cli flag to disable xwayland at runtime even if river has been
built with xwayland support.
This commit is contained in:
Hugo Machet
2024-02-19 11:30:26 +01:00
committed by Isaac Freund
parent ec9a1b4303
commit 7f1f9152f2
5 changed files with 42 additions and 21 deletions

View File

@ -249,17 +249,19 @@ pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
if (theme) |t| if (c.setenv("XCURSOR_THEME", t, 1) < 0) return error.OutOfMemory;
if (build_options.xwayland) {
try xcursor_manager.load(1);
const wlr_xcursor = xcursor_manager.getXcursor("left_ptr", 1).?;
const image = wlr_xcursor.images[0];
server.xwayland.setCursor(
image.buffer,
image.width * 4,
image.width,
image.height,
@intCast(image.hotspot_x),
@intCast(image.hotspot_y),
);
if (server.xwayland) |xwayland| {
try xcursor_manager.load(1);
const wlr_xcursor = xcursor_manager.getXcursor("left_ptr", 1).?;
const image = wlr_xcursor.images[0];
xwayland.setCursor(
image.buffer,
image.width * 4,
image.width,
image.height,
@intCast(image.hotspot_x),
@intCast(image.hotspot_y),
);
}
}
}
@ -937,6 +939,7 @@ fn updateFocusFollowsCursorTarget(self: *Self) void {
},
.xwayland_override_redirect => {
assert(build_options.xwayland);
assert(server.xwayland != null);
self.focus_follows_cursor_target = null;
},
}