diff options
author | Simon Ser <contact@emersion.fr> | 2023-11-23 13:58:36 +0100 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2024-01-25 15:05:36 +0000 |
commit | ed0bba581bdf0dd24e48de69ef51cf2420a50289 (patch) | |
tree | 2bdc2979226d99283aa6ad821fc1fe5dc87ce7dc /backend | |
parent | f5e8fa48f3cf6dc8522191bb56670503de41fa4c (diff) |
backend/wayland: take wl_event_loop instead of wl_display
Diffstat (limited to 'backend')
-rw-r--r-- | backend/backend.c | 3 | ||||
-rw-r--r-- | backend/wayland/backend.c | 16 | ||||
-rw-r--r-- | backend/wayland/output.c | 5 |
3 files changed, 11 insertions, 13 deletions
diff --git a/backend/backend.c b/backend/backend.c index fbd7bd16..9b384068 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -194,7 +194,8 @@ static struct wlr_auto_backend_monitor *auto_backend_monitor_create( } static struct wlr_backend *attempt_wl_backend(struct wl_display *display) { - struct wlr_backend *backend = wlr_wl_backend_create(display, NULL); + struct wl_event_loop *loop = wl_display_get_event_loop(display); + struct wlr_backend *backend = wlr_wl_backend_create(loop, NULL); if (backend == NULL) { return NULL; } diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index ebf36a8b..78803ffc 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -480,7 +480,7 @@ static void backend_destroy(struct wlr_backend *backend) { wlr_backend_finish(backend); - wl_list_remove(&wl->local_display_destroy.link); + wl_list_remove(&wl->event_loop_destroy.link); wl_event_source_remove(wl->remote_display_src); @@ -561,13 +561,12 @@ bool wlr_backend_is_wl(struct wlr_backend *b) { return b->impl == &backend_impl; } -static void handle_display_destroy(struct wl_listener *listener, void *data) { - struct wlr_wl_backend *wl = - wl_container_of(listener, wl, local_display_destroy); +static void handle_event_loop_destroy(struct wl_listener *listener, void *data) { + struct wlr_wl_backend *wl = wl_container_of(listener, wl, event_loop_destroy); backend_destroy(&wl->backend); } -struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, +struct wlr_backend *wlr_wl_backend_create(struct wl_event_loop *loop, struct wl_display *remote_display) { wlr_log(WLR_INFO, "Creating wayland backend"); @@ -579,7 +578,7 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, wlr_backend_init(&wl->backend, &backend_impl); - wl->local_display = display; + wl->event_loop = loop; wl_list_init(&wl->outputs); wl_list_init(&wl->seats); wl_list_init(&wl->buffers); @@ -644,7 +643,6 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, zwp_linux_dmabuf_feedback_v1_destroy(linux_dmabuf_feedback_v1); } - struct wl_event_loop *loop = wl_display_get_event_loop(wl->local_display); int fd = wl_display_get_fd(wl->remote_display); wl->remote_display_src = wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE, dispatch_events, wl); @@ -666,8 +664,8 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, wl->drm_fd = -1; } - wl->local_display_destroy.notify = handle_display_destroy; - wl_display_add_destroy_listener(display, &wl->local_display_destroy); + wl->event_loop_destroy.notify = handle_event_loop_destroy; + wl_event_loop_add_destroy_listener(loop, &wl->event_loop_destroy); const char *token = getenv("XDG_ACTIVATION_TOKEN"); if (token != NULL) { diff --git a/backend/wayland/output.c b/backend/wayland/output.c index ee82ff95..3df269c9 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -774,7 +774,7 @@ static struct wlr_wl_output *output_create(struct wlr_wl_backend *backend, wlr_output_state_set_custom_mode(&state, 1280, 720, 0); wlr_output_init(wlr_output, &backend->backend, &output_impl, - wl_display_get_event_loop(backend->local_display), &state); + backend->event_loop, &state); wlr_output_state_finish(&state); wlr_output->adaptive_sync_status = WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED; @@ -871,9 +871,8 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { &xdg_toplevel_listener, output); wl_surface_commit(output->surface); - struct wl_event_loop *event_loop = wl_display_get_event_loop(backend->local_display); while (!output->configured) { - int ret = wl_event_loop_dispatch(event_loop, -1); + int ret = wl_event_loop_dispatch(backend->event_loop, -1); if (ret < 0) { wlr_log(WLR_ERROR, "wl_event_loop_dispatch() failed"); goto error; |