core: silently fail to connect to linux display and improve logging

This commit is contained in:
Joshua Holmes 2024-10-18 15:29:18 -07:00 committed by Stephen Gutekanst
parent 2f095fdc21
commit 0a5d817f54
3 changed files with 23 additions and 21 deletions

View file

@ -83,7 +83,7 @@ pub fn init(
.libxkbcommon = try LibXkbCommon.load(),
.libwaylandclient = libwaylandclient_global,
.interfaces = Interfaces{},
.display = libwaylandclient_global.wl_display_connect(null) orelse return error.FailedToConnectToWaylandDisplay,
.display = libwaylandclient_global.wl_display_connect(null) orelse return error.FailedToConnectToDisplay,
.title = try options.allocator.dupeZ(u8, options.title),
.size = &linux.size,
.modifiers = .{

View file

@ -99,8 +99,7 @@ pub fn init(
else => return err,
};
const display = libx11.XOpenDisplay(null) orelse {
std.log.err("X11: Cannot open display", .{});
return error.CannotOpenDisplay;
return error.FailedToConnectToDisplay;
};
const screen = c.DefaultScreen(display);
const visual = c.DefaultVisual(display, screen);