backend-x11: enable multi-backend support

Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine whether the backend is capable of being loaded simultaneously
with other backends.

The X11 backend can only be loaded as primary backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
This commit is contained in:
Philipp Zabel 2022-05-29 08:07:43 +02:00 committed by Derek Foreman
parent bb3b9374aa
commit 14c52a942b
1 changed files with 13 additions and 4 deletions

View File

@ -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);