aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-11-23 14:03:14 +0100
committerKirill Primak <vyivel@eclair.cafe>2024-01-25 15:05:36 +0000
commitb62ac611c8825f83c992843e3832474eaa2e4b72 (patch)
treee9cd0501f7faf0f595d2276f58dbbf8b820eda11 /backend
parented0bba581bdf0dd24e48de69ef51cf2420a50289 (diff)
backend/x11: take wl_event_loop instead of wl_display
Diffstat (limited to 'backend')
-rw-r--r--backend/backend.c3
-rw-r--r--backend/x11/backend.c18
-rw-r--r--backend/x11/output.c3
3 files changed, 11 insertions, 13 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 9b384068..8a6ca7a5 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -211,7 +211,8 @@ static struct wlr_backend *attempt_wl_backend(struct wl_display *display) {
static struct wlr_backend *attempt_x11_backend(struct wl_display *display,
const char *x11_display) {
#if WLR_HAS_X11_BACKEND
- struct wlr_backend *backend = wlr_x11_backend_create(display, x11_display);
+ struct wl_event_loop *loop = wl_display_get_event_loop(display);
+ struct wlr_backend *backend = wlr_x11_backend_create(loop, x11_display);
if (backend == NULL) {
return NULL;
}
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index c650712f..3c963a28 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -192,7 +192,7 @@ static void backend_destroy(struct wlr_backend *backend) {
if (x11->event_source) {
wl_event_source_remove(x11->event_source);
}
- wl_list_remove(&x11->display_destroy.link);
+ wl_list_remove(&x11->event_loop_destroy.link);
wlr_drm_format_set_finish(&x11->primary_dri3_formats);
wlr_drm_format_set_finish(&x11->primary_shm_formats);
@@ -230,9 +230,8 @@ bool wlr_backend_is_x11(struct wlr_backend *backend) {
return backend->impl == &backend_impl;
}
-static void handle_display_destroy(struct wl_listener *listener, void *data) {
- struct wlr_x11_backend *x11 =
- wl_container_of(listener, x11, display_destroy);
+static void handle_event_loop_destroy(struct wl_listener *listener, void *data) {
+ struct wlr_x11_backend *x11 = wl_container_of(listener, x11, event_loop_destroy);
backend_destroy(&x11->backend);
}
@@ -391,7 +390,7 @@ static void x11_get_argb32(struct wlr_x11_backend *x11) {
free(reply);
}
-struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
+struct wlr_backend *wlr_x11_backend_create(struct wl_event_loop *loop,
const char *x11_display) {
wlr_log(WLR_INFO, "Creating X11 backend");
@@ -401,7 +400,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
}
wlr_backend_init(&x11->backend, &backend_impl);
- x11->wl_display = display;
+ x11->event_loop = loop;
wl_list_init(&x11->outputs);
x11->xcb = xcb_connect(x11_display, NULL);
@@ -561,9 +560,8 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
free(xi_reply);
int fd = xcb_get_file_descriptor(x11->xcb);
- struct wl_event_loop *ev = wl_display_get_event_loop(display);
uint32_t events = WL_EVENT_READABLE | WL_EVENT_ERROR | WL_EVENT_HANGUP;
- x11->event_source = wl_event_loop_add_fd(ev, fd, events, x11_event, x11);
+ x11->event_source = wl_event_loop_add_fd(loop, fd, events, x11_event, x11);
if (!x11->event_source) {
wlr_log(WLR_ERROR, "Could not create event source");
goto error_display;
@@ -644,8 +642,8 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
wlr_keyboard_init(&x11->keyboard, &x11_keyboard_impl,
x11_keyboard_impl.name);
- x11->display_destroy.notify = handle_display_destroy;
- wl_display_add_destroy_listener(display, &x11->display_destroy);
+ x11->event_loop_destroy.notify = handle_event_loop_destroy;
+ wl_event_loop_add_destroy_listener(loop, &x11->event_loop_destroy);
// Create an empty pixmap to be used as the cursor. The
// default GC foreground is 0, and that is what it will be
diff --git a/backend/x11/output.c b/backend/x11/output.c
index db63f82f..0c4966c6 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -575,8 +575,7 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
wlr_output_state_init(&state);
wlr_output_state_set_custom_mode(&state, 1024, 768, 0);
- wlr_output_init(wlr_output, &x11->backend, &output_impl,
- wl_display_get_event_loop(x11->wl_display), &state);
+ wlr_output_init(wlr_output, &x11->backend, &output_impl, x11->event_loop, &state);
wlr_output_state_finish(&state);
size_t output_num = ++last_output_num;