Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wayland should error when no server side decoration #1292

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/core/Linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn init(
error.FailedToConnectToDisplay => "Failed to connect to X11 display",
else => "An unknown error occured while trying to connect to X11",
};
log.err("{s}\nFalling back to Wayland\n", .{err_msg});
log.err("{s}\n\nFalling back to Wayland\n", .{err_msg});
linux.backend = .{ .wayland = try Wayland.init(linux, core, options) };
break :blk;
};
Expand All @@ -103,11 +103,12 @@ pub fn init(
.wayland => blk: {
const wayland = Wayland.init(linux, core, options) catch |err| {
const err_msg = switch (err) {
error.NoServerSideDecorationSupport => "Server Side Decorations aren't supported",
error.LibraryNotFound => "Missing Wayland library",
error.FailedToConnectToDisplay => "Failed to connect to Wayland display",
else => "An unknown error occured while trying to connect to Wayland",
};
log.err("{s}\nFalling back to X11\n", .{err_msg});
log.err("{s}\n\nFalling back to X11\n", .{err_msg});
linux.backend = .{ .x11 = try X11.init(linux, core, options) };
break :blk;
};
Expand Down Expand Up @@ -210,7 +211,7 @@ pub fn deinitLinuxGamemode() void {
/// Used to inform users that some features are not present. Remove when features are complete.
fn warnAboutIncompleteFeatures(backend: BackendEnum, missing_features_x11: []const []const u8, missing_features_wayland: []const []const u8, alloc: std.mem.Allocator) !void {
const features_incomplete_message =
\\WARNING: You are using the {s} backend, which is currently experimental as we continue to rewrite Mach in Zig instead of using C libraries like GLFW/etc. The following features are expected to not work:
\\You are using the {s} backend, which is currently experimental as we continue to rewrite Mach in Zig instead of using C libraries like GLFW/etc. The following features are expected to not work:
\\
\\{s}
\\
Expand All @@ -222,7 +223,7 @@ fn warnAboutIncompleteFeatures(backend: BackendEnum, missing_features_x11: []con
.wayland => try generateFeatureBulletPoints(missing_features_wayland, alloc),
};
defer bullet_points.deinit();
log.info(features_incomplete_message, .{ @tagName(backend), bullet_points.items });
log.warn(features_incomplete_message, .{ @tagName(backend), bullet_points.items });
}

/// Turn an array of strings into a single, bullet-pointed string, like this:
Expand Down
4 changes: 4 additions & 0 deletions src/core/linux/Wayland.zig
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ pub fn init(
//Round trip to get all initial output events
_ = wl.libwaylandclient.wl_display_roundtrip(wl.display);

if (wl.interfaces.zxdg_decoration_manager_v1 == null) {
return error.NoServerSideDecorationSupport;
}

//Setup surface
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);
Expand Down
Loading