diff options
-rw-r--r-- | backend/multi/backend.c | 7 | ||||
-rw-r--r-- | include/backend/multi.h | 2 | ||||
-rw-r--r-- | include/wlr/backend/multi.h | 2 | ||||
-rw-r--r-- | rootston/main.c | 7 |
4 files changed, 15 insertions, 3 deletions
diff --git a/backend/multi/backend.c b/backend/multi/backend.c index e6be4a20..c000342b 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -42,7 +42,6 @@ static void subbackend_state_destroy(struct subbackend_state *sub) { static void multi_backend_destroy(struct wlr_backend *wlr_backend) { struct wlr_multi_backend *backend = (struct wlr_multi_backend *)wlr_backend; - wl_list_remove(&backend->display_destroy.link); struct subbackend_state *sub, *next; wl_list_for_each_safe(sub, next, &backend->backends, link) { // XXX do we really want to take ownership over added backends? @@ -190,3 +189,9 @@ struct wlr_session *wlr_multi_get_session(struct wlr_backend *_backend) { } return NULL; } + +bool wlr_multi_is_empty(struct wlr_backend *_backend) { + assert(wlr_backend_is_multi(_backend)); + struct wlr_multi_backend *backend = (struct wlr_multi_backend *)_backend; + return wl_list_length(&backend->backends) < 1; +} diff --git a/include/backend/multi.h b/include/backend/multi.h index f0e50fc0..e283139c 100644 --- a/include/backend/multi.h +++ b/include/backend/multi.h @@ -10,8 +10,6 @@ struct wlr_multi_backend { struct wlr_backend backend; struct wl_list backends; - - struct wl_listener display_destroy; }; #endif diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h index 35f7c165..d9914efc 100644 --- a/include/wlr/backend/multi.h +++ b/include/wlr/backend/multi.h @@ -16,4 +16,6 @@ bool wlr_backend_is_multi(struct wlr_backend *backend); struct wlr_session *wlr_multi_get_session(struct wlr_backend *base); +bool wlr_multi_is_empty(struct wlr_backend *backend); + #endif diff --git a/rootston/main.c b/rootston/main.c index aa20dbba..2f913272 100644 --- a/rootston/main.c +++ b/rootston/main.c @@ -5,6 +5,7 @@ #include <wayland-server.h> #include <wlr/backend.h> #include <wlr/backend/headless.h> +#include <wlr/backend/multi.h> #include <wlr/render.h> #include <wlr/render/gles2.h> #include <wlr/util/log.h> @@ -32,6 +33,12 @@ int main(int argc, char **argv) { assert(server.backend = wlr_backend_autocreate(server.wl_display)); + if (wlr_multi_is_empty(server.backend)) { + wlr_log(L_ERROR, "could not start backend"); + wlr_backend_destroy(server.backend); + return 1; + } + assert(server.renderer = wlr_gles2_renderer_create(server.backend)); server.data_device_manager = wlr_data_device_manager_create(server.wl_display); |