build: handle wlroots built without xwayland support

This commit is contained in:
Isaac Freund 2022-12-24 17:38:02 +01:00
parent 096e175cec
commit 05c9194eba
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
3 changed files with 14 additions and 7 deletions

2
deps/zig-wlroots vendored

@ -1 +1 @@
Subproject commit 199463a741061511561f6c139d49d4b00212d5bf Subproject commit b485332edb2bfc8db42d474a019e7df835a7d1be

View File

@ -1125,11 +1125,16 @@ fn warp(self: *Self) void {
.width = view.current.box.width, .width = view.current.box.width,
.height = view.current.box.height, .height = view.current.box.height,
}, },
.xwayland_override_redirect => |or_window| wlr.Box{ .xwayland_override_redirect => |or_window| blk: {
.x = or_window.xwayland_surface.x, assert(build_options.xwayland);
.y = or_window.xwayland_surface.y, // TODO(zig): remove this line when updating to the self hosted compiler.
.width = or_window.xwayland_surface.width, if (!build_options.xwayland) return;
.height = or_window.xwayland_surface.height, break :blk wlr.Box{
.x = or_window.xwayland_surface.x,
.y = or_window.xwayland_surface.y,
.width = or_window.xwayland_surface.width,
.height = or_window.xwayland_surface.height,
};
}, },
}, },
}; };

View File

@ -49,7 +49,7 @@ const PointerConstraint = @import("PointerConstraint.zig");
pub const FocusTarget = union(enum) { pub const FocusTarget = union(enum) {
view: *View, view: *View,
xwayland_override_redirect: *XwaylandOverrideRedirect, xwayland_override_redirect: if (build_options.xwayland) *XwaylandOverrideRedirect else void,
layer: *LayerSurface, layer: *LayerSurface,
lock_surface: *LockSurface, lock_surface: *LockSurface,
none: void, none: void,
@ -221,6 +221,8 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
.view => |target_view| target_view.surface.?, .view => |target_view| target_view.surface.?,
.xwayland_override_redirect => |target_override_redirect| blk: { .xwayland_override_redirect => |target_override_redirect| blk: {
assert(build_options.xwayland); assert(build_options.xwayland);
// TODO(zig): remove this line when updating to the self hosted compiler.
if (!build_options.xwayland) return;
break :blk target_override_redirect.xwayland_surface.surface; break :blk target_override_redirect.xwayland_surface.surface;
}, },
.layer => |target_layer| target_layer.wlr_layer_surface.surface, .layer => |target_layer| target_layer.wlr_layer_surface.surface,