code: refactor Server.start()
This was needlessly verbose
This commit is contained in:
parent
189d9f2d8b
commit
582164ce41
1 changed files with 5 additions and 19 deletions
|
@ -149,27 +149,13 @@ pub fn deinit(self: *Self) void {
|
||||||
self.config.deinit();
|
self.config.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create the socket, set WAYLAND_DISPLAY, and start the backend
|
/// Create the socket, start the backend, and setup the environment
|
||||||
pub fn start(self: Self) !void {
|
pub fn start(self: Self) !void {
|
||||||
// Add a Unix socket to the Wayland display.
|
const socket = c.wl_display_add_socket_auto(self.wl_display) orelse return error.CantAddSocket;
|
||||||
const socket = c.wl_display_add_socket_auto(self.wl_display) orelse
|
if (!c.river_wlr_backend_start(self.wlr_backend)) return error.CantStartBackend;
|
||||||
return error.CantAddSocket;
|
if (c.setenv("WAYLAND_DISPLAY", socket, 1) < 0) return error.CantSetEnv;
|
||||||
|
|
||||||
// Start the backend. This will enumerate outputs and inputs, become the DRM
|
|
||||||
// master, etc
|
|
||||||
if (!c.river_wlr_backend_start(self.wlr_backend)) {
|
|
||||||
return error.CantStartBackend;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the WAYLAND_DISPLAY environment variable to our socket
|
|
||||||
if (c.setenv("WAYLAND_DISPLAY", socket, 1) == -1) {
|
|
||||||
return error.CantSetEnv;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (build_options.xwayland) {
|
if (build_options.xwayland) {
|
||||||
if (c.setenv("DISPLAY", &self.wlr_xwayland.display_name, 1) == -1) {
|
if (c.setenv("DISPLAY", &self.wlr_xwayland.display_name, 1) < 0) return error.CantSetEnv;
|
||||||
return error.CantSetEnv;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue