linux: implement better logging for when wayland fails or x11 is desired

This commit is contained in:
Joshua Holmes 2024-12-07 18:57:36 +00:00 committed by Emi Gutekanst
parent fdc3666a95
commit e8b1ef9b25

View file

@ -97,7 +97,8 @@ pub fn initWindow(
// Try to initialize the desired backend, falling back to the other if that one is not supported // Try to initialize the desired backend, falling back to the other if that one is not supported
switch (desired_backend) { switch (desired_backend) {
.x11 => { .x11 => {
return; log.err("\nX11 needs to be setup to work with the new object system, so it is not working at the moment. Using Wayland.\n", .{});
try Wayland.initWindow(core, window_id);
// X11.initWindow(core, window_id) catch |err| { // X11.initWindow(core, window_id) catch |err| {
// const err_msg = switch (err) { // const err_msg = switch (err) {
// error.LibraryNotFound => "Missing X11 library", // error.LibraryNotFound => "Missing X11 library",
@ -116,7 +117,9 @@ pub fn initWindow(
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",
}; };
log.err("{s}\n\nFalling back to X11\n", .{err_msg}); log.err("{s}\n\nCannot connect to Wayland. X11 is unavailable as a fallback while it is being reconfigured to work with the new object system. Failing...\n", .{err_msg});
return error.X11NotImplemented;
// log.err("{s}\n\nFalling back to X11\n", .{err_msg});
// try X11.initWindow(core, window_id); // try X11.initWindow(core, window_id);
}; };
}, },