add(core/linux/Wayland): error return when decoration manager interface is not defined

This commit is contained in:
Ronald M Zielaznicki 2024-10-24 23:59:23 -04:00 committed by Stephen Gutekanst
parent e6ba5e1461
commit 15a2cb1f0c
2 changed files with 5 additions and 0 deletions

View file

@ -103,6 +103,7 @@ pub fn init(
.wayland => blk: { .wayland => blk: {
const wayland = Wayland.init(linux, core, options) catch |err| { const wayland = Wayland.init(linux, core, options) catch |err| {
const err_msg = switch (err) { const err_msg = switch (err) {
error.NoServerSideDecorationSupport => "Server Side Decorations aren't supported",
error.LibraryNotFound => "Missing Wayland library", error.LibraryNotFound => "Missing Wayland library",
error.FailedToConnectToDisplay => "Failed to connect to Wayland display", error.FailedToConnectToDisplay => "Failed to connect to Wayland display",
else => "An unknown error occured while trying to connect to Wayland", else => "An unknown error occured while trying to connect to Wayland",

View file

@ -118,6 +118,10 @@ pub fn init(
//Round trip to get all initial output events //Round trip to get all initial output events
_ = wl.libwaylandclient.wl_display_roundtrip(wl.display); _ = wl.libwaylandclient.wl_display_roundtrip(wl.display);
if (wl.interfaces.zxdg_decoration_manager_v1 == null) {
return error.NoServerSideDecorationSupport;
}
//Setup surface //Setup surface
wl.surface = c.wl_compositor_create_surface(wl.interfaces.wl_compositor) orelse return error.UnableToCreateSurface; wl.surface = c.wl_compositor_create_surface(wl.interfaces.wl_compositor) orelse return error.UnableToCreateSurface;
wl.surface_descriptor = try options.allocator.create(gpu.Surface.DescriptorFromWaylandSurface); wl.surface_descriptor = try options.allocator.create(gpu.Surface.DescriptorFromWaylandSurface);