From 13c5b7baaf949d06e45189ba316d5cce8a9d4235 Mon Sep 17 00:00:00 2001 From: Ronald M Zielaznicki Date: Thu, 24 Oct 2024 23:55:03 -0400 Subject: [PATCH 1/2] change(core/Linux): features_incomplete_message to use log.warn --- src/core/Linux.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/Linux.zig b/src/core/Linux.zig index 2f9e6182a5..a1fc770675 100644 --- a/src/core/Linux.zig +++ b/src/core/Linux.zig @@ -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; }; @@ -107,7 +107,7 @@ pub fn init( 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; }; @@ -210,7 +210,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} \\ @@ -222,7 +222,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: From 628cc8a5bbc67d6c8d02fabd7e8ca212b35a4367 Mon Sep 17 00:00:00 2001 From: Ronald M Zielaznicki Date: Thu, 24 Oct 2024 23:59:23 -0400 Subject: [PATCH 2/2] add(core/linux/Wayland): error return when decoration manager interface is not defined --- src/core/Linux.zig | 1 + src/core/linux/Wayland.zig | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/core/Linux.zig b/src/core/Linux.zig index a1fc770675..87bfb16e61 100644 --- a/src/core/Linux.zig +++ b/src/core/Linux.zig @@ -103,6 +103,7 @@ 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", diff --git a/src/core/linux/Wayland.zig b/src/core/linux/Wayland.zig index 1c35d21d98..87ccb83f19 100644 --- a/src/core/linux/Wayland.zig +++ b/src/core/linux/Wayland.zig @@ -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);