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); diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 5baaac9d..3a0b1327 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -144,6 +144,8 @@ void init_seat_pointer(struct wlr_wl_seat *seat); void finish_seat_pointer(struct wlr_wl_seat *seat); void create_pointer(struct wlr_wl_seat *seat, struct wlr_wl_output *output); +void init_seat_touch(struct wlr_wl_seat *seat); + void init_seat_tablet(struct wlr_wl_seat *seat); void finish_seat_tablet(struct wlr_wl_seat *seat);