mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-04 20:55:58 +01:00
rootston: handle backend creation failed
This commit is contained in:
parent
ca6a0ef1bb
commit
ee39dff1e7
4 changed files with 15 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@ struct wlr_multi_backend {
|
|||
struct wlr_backend backend;
|
||||
|
||||
struct wl_list backends;
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue