diff options
author | Simon Ser <contact@emersion.fr> | 2023-11-23 13:50:32 +0100 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2024-01-25 15:05:36 +0000 |
commit | f5e8fa48f3cf6dc8522191bb56670503de41fa4c (patch) | |
tree | cfcecf9f7c6d9f8724424e2a89df098778ee3d9b /backend/libinput | |
parent | 682dbf36e53a36b09a2cc37ef6bdaf21fa8d35b5 (diff) |
backend/libinput: drop wl_display argument
We can grab the event loop from the wlr_session instead.
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/backend.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 35a86583..97f17244 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -115,12 +115,10 @@ static bool backend_start(struct wlr_backend *wlr_backend) { } } - struct wl_event_loop *event_loop = - wl_display_get_event_loop(backend->display); if (backend->input_event) { wl_event_source_remove(backend->input_event); } - backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd, + backend->input_event = wl_event_loop_add_fd(backend->session->event_loop, libinput_fd, WL_EVENT_READABLE, handle_libinput_readable, backend); if (!backend->input_event) { wlr_log(WLR_ERROR, "Failed to create input event on event loop"); @@ -144,7 +142,6 @@ static void backend_destroy(struct wlr_backend *wlr_backend) { wlr_backend_finish(wlr_backend); - wl_list_remove(&backend->display_destroy.link); wl_list_remove(&backend->session_destroy.link); wl_list_remove(&backend->session_signal.link); @@ -186,14 +183,7 @@ static void handle_session_destroy(struct wl_listener *listener, void *data) { backend_destroy(&backend->backend); } -static void handle_display_destroy(struct wl_listener *listener, void *data) { - struct wlr_libinput_backend *backend = - wl_container_of(listener, backend, display_destroy); - backend_destroy(&backend->backend); -} - -struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, - struct wlr_session *session) { +struct wlr_backend *wlr_libinput_backend_create(struct wlr_session *session) { struct wlr_libinput_backend *backend = calloc(1, sizeof(*backend)); if (!backend) { wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno)); @@ -204,7 +194,6 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, wl_list_init(&backend->devices); backend->session = session; - backend->display = display; backend->session_signal.notify = session_signal; wl_signal_add(&session->events.active, &backend->session_signal); @@ -212,9 +201,6 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, backend->session_destroy.notify = handle_session_destroy; wl_signal_add(&session->events.destroy, &backend->session_destroy); - backend->display_destroy.notify = handle_display_destroy; - wl_display_add_destroy_listener(display, &backend->display_destroy); - return &backend->backend; } |