diff --git a/libweston/backend-x11/x11.c b/libweston/backend-x11/x11.c index e1b95e71a..59b80f25a 100644 --- a/libweston/backend-x11/x11.c +++ b/libweston/backend-x11/x11.c @@ -1239,10 +1239,12 @@ x11_head_destroy(struct weston_head *base) static struct x11_output * x11_backend_find_output(struct x11_backend *b, xcb_window_t window) { - struct x11_output *output; + struct weston_output *base; - wl_list_for_each(output, &b->compositor->output_list, base.link) { - if (output->window == window) + wl_list_for_each(base, &b->compositor->output_list, link) { + struct x11_output *output = to_x11_output(base); + + if (output && output->window == window) return output; } @@ -1838,6 +1840,8 @@ x11_shutdown(struct weston_backend *base) { struct x11_backend *backend = to_x11_backend(base); + wl_list_remove(&backend->base.link); + wl_event_source_remove(backend->xcb_source); x11_input_destroy(backend); } @@ -1880,7 +1884,7 @@ x11_backend_create(struct weston_compositor *compositor, b->fullscreen = config->fullscreen; b->no_input = config->no_input; - compositor->backend = &b->base; + wl_list_insert(&compositor->backend_list, &b->base.link); b->base.supported_presentation_clocks = WESTON_PRESENTATION_CLOCKS_SOFTWARE; @@ -2009,6 +2013,11 @@ weston_backend_init(struct weston_compositor *compositor, return -1; } + if (compositor->renderer) { + weston_log("X11 backend must be the primary backend\n"); + return -1; + } + config_init_to_defaults(&config); memcpy(&config, config_base, config_base->struct_size);