backend/multi: take wl_event_loop instead of wl_display

master
Simon Ser 1 year ago committed by Kirill Primak
parent 54f9944b48
commit f27808b8d9

@ -344,7 +344,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
} }
struct wlr_session *session = NULL; struct wlr_session *session = NULL;
struct wlr_backend *multi = wlr_multi_backend_create(display); struct wl_event_loop *loop = wl_display_get_event_loop(display);
struct wlr_backend *multi = wlr_multi_backend_create(loop);
if (!multi) { if (!multi) {
wlr_log(WLR_ERROR, "could not allocate multibackend"); wlr_log(WLR_ERROR, "could not allocate multibackend");
return NULL; return NULL;

@ -48,7 +48,7 @@ static void subbackend_state_destroy(struct subbackend_state *sub) {
static void multi_backend_destroy(struct wlr_backend *wlr_backend) { static void multi_backend_destroy(struct wlr_backend *wlr_backend) {
struct wlr_multi_backend *backend = multi_backend_from_backend(wlr_backend); struct wlr_multi_backend *backend = multi_backend_from_backend(wlr_backend);
wl_list_remove(&backend->display_destroy.link); wl_list_remove(&backend->event_loop_destroy.link);
wlr_backend_finish(wlr_backend); wlr_backend_finish(wlr_backend);
@ -105,13 +105,13 @@ static const struct wlr_backend_impl backend_impl = {
.get_buffer_caps = multi_backend_get_buffer_caps, .get_buffer_caps = multi_backend_get_buffer_caps,
}; };
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_event_loop_destroy(struct wl_listener *listener, void *data) {
struct wlr_multi_backend *backend = struct wlr_multi_backend *backend =
wl_container_of(listener, backend, display_destroy); wl_container_of(listener, backend, event_loop_destroy);
multi_backend_destroy((struct wlr_backend*)backend); multi_backend_destroy((struct wlr_backend*)backend);
} }
struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) { struct wlr_backend *wlr_multi_backend_create(struct wl_event_loop *loop) {
struct wlr_multi_backend *backend = calloc(1, sizeof(*backend)); struct wlr_multi_backend *backend = calloc(1, sizeof(*backend));
if (!backend) { if (!backend) {
wlr_log(WLR_ERROR, "Backend allocation failed"); wlr_log(WLR_ERROR, "Backend allocation failed");
@ -124,8 +124,8 @@ struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) {
wl_signal_init(&backend->events.backend_add); wl_signal_init(&backend->events.backend_add);
wl_signal_init(&backend->events.backend_remove); wl_signal_init(&backend->events.backend_remove);
backend->display_destroy.notify = handle_display_destroy; backend->event_loop_destroy.notify = handle_event_loop_destroy;
wl_display_add_destroy_listener(display, &backend->display_destroy); wl_event_loop_add_destroy_listener(loop, &backend->event_loop_destroy);
return &backend->backend; return &backend->backend;
} }

@ -10,7 +10,7 @@ struct wlr_multi_backend {
struct wl_list backends; struct wl_list backends;
struct wl_listener display_destroy; struct wl_listener event_loop_destroy;
struct { struct {
struct wl_signal backend_add; struct wl_signal backend_add;

@ -15,7 +15,7 @@
* Creates a multi-backend. Multi-backends wrap an arbitrary number of backends * Creates a multi-backend. Multi-backends wrap an arbitrary number of backends
* and aggregate their new_output/new_input signals. * and aggregate their new_output/new_input signals.
*/ */
struct wlr_backend *wlr_multi_backend_create(struct wl_display *display); struct wlr_backend *wlr_multi_backend_create(struct wl_event_loop *loop);
/** /**
* Adds the given backend to the multi backend. This should be done before the * Adds the given backend to the multi backend. This should be done before the
* new backend is started. * new backend is started.

Loading…
Cancel
Save