diff options
author | Simon Ser <contact@emersion.fr> | 2022-08-11 09:09:37 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-08-11 09:13:08 +0200 |
commit | 8c3c6987dbdffa74eb1fee901b4ab1d73641e29f (patch) | |
tree | dbccfd033f49a911dfef83c594bf408d6c4ea6d1 /backend | |
parent | f24409468213d363bcc7dca3130c78619ee1a138 (diff) |
backend/wayland: fix touch device not added on startup
We were firing the new_input signal on backend initialization,
before the compositor had the chance to add a listener for it.
Mimick what's done for wl_keyboard: if the backend hasn't been
started, delay wl_touch initialization.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3473
Diffstat (limited to 'backend')
-rw-r--r-- | backend/wayland/backend.c | 4 | ||||
-rw-r--r-- | backend/wayland/seat.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 07df6912..2980324f 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -424,6 +424,10 @@ static bool backend_start(struct wlr_backend *backend) { init_seat_keyboard(seat); } + if (seat->wl_touch) { + init_seat_touch(seat); + } + if (wl->tablet_manager) { init_seat_tablet(seat); } diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c index d1c75b39..655f9dad 100644 --- a/backend/wayland/seat.c +++ b/backend/wayland/seat.c @@ -212,7 +212,7 @@ static const struct wlr_touch_impl touch_impl = { .name = "wl-touch", }; -static void init_seat_touch(struct wlr_wl_seat *seat) { +void init_seat_touch(struct wlr_wl_seat *seat) { assert(seat->wl_touch); char name[128] = {0}; @@ -333,7 +333,9 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, wlr_log(WLR_DEBUG, "seat '%s' offering touch", seat->name); seat->wl_touch = wl_seat_get_touch(wl_seat); - init_seat_touch(seat); + if (backend->started) { + init_seat_touch(seat); + } } if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && seat->wl_touch != NULL) { wlr_log(WLR_DEBUG, "seat '%s' dropping touch", seat->name); |