diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-11-11 11:58:43 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-11-11 11:58:43 -0500 |
commit | 7eafcc75f6f8abd2346e0d72b063bc10ce24378f (patch) | |
tree | ce8a4cebdf5bc484643ec78f3cf59e0943ce50e8 /sway/server.c | |
parent | 0ba6554c4f6c923274062862d895240eea4de350 (diff) |
Initialize outputs from backend and add to tree
Diffstat (limited to 'sway/server.c')
-rw-r--r-- | sway/server.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/sway/server.c b/sway/server.c index 4a74cfb5..b7ce4612 100644 --- a/sway/server.c +++ b/sway/server.c @@ -27,23 +27,14 @@ bool server_init(struct sway_server *server) { server->data_device_manager = wlr_data_device_manager_create(server->wl_display); - const char *socket = wl_display_add_socket_auto(server->wl_display); - if (!socket) { - sway_log_errno(L_ERROR, "Unable to open wayland socket"); - wlr_backend_destroy(server->backend); - return false; - } + server->output_add.notify = output_add_notify; + wl_signal_add(&server->backend->events.output_add, &server->output_add); - sway_log(L_INFO, "Running compositor on wayland display '%s'", socket); - setenv("_WAYLAND_DISPLAY", socket, true); - - if (!wlr_backend_start(server->backend)) { - sway_log(L_ERROR, "Failed to start backend"); + server->socket = wl_display_add_socket_auto(server->wl_display); + if (!sway_assert(server->socket, "Unable to open wayland socket")) { wlr_backend_destroy(server->backend); return false; } - - setenv("WAYLAND_DISPLAY", socket, true); return true; } @@ -51,3 +42,16 @@ void server_fini(struct sway_server *server) { // TODO WLR: tear down more stuff wlr_backend_destroy(server->backend); } + +void server_run(struct sway_server *server) { + sway_log(L_INFO, "Running compositor on wayland display '%s'", + server->socket); + setenv("_WAYLAND_DISPLAY", server->socket, true); + if (!sway_assert(wlr_backend_start(server->backend), + "Failed to start backend")) { + wlr_backend_destroy(server->backend); + return; + } + setenv("WAYLAND_DISPLAY", server->socket, true); + wl_display_run(server->wl_display); +} |