diff --git a/include/input/tablet-pad.h b/include/input/tablet-pad.h index 4600a6fe..c17b2f7f 100644 --- a/include/input/tablet-pad.h +++ b/include/input/tablet-pad.h @@ -25,6 +25,7 @@ struct drawing_tablet_pad { struct wl_listener button; struct wl_listener destroy; } handlers; + struct wl_list link; /* seat.tablet_pads */ }; void tablet_pad_init(struct seat *seat, struct wlr_input_device *wlr_input_device); diff --git a/include/input/tablet.h b/include/input/tablet.h index 73eb2de2..e7ed395a 100644 --- a/include/input/tablet.h +++ b/include/input/tablet.h @@ -28,6 +28,7 @@ struct drawing_tablet { struct wl_listener button; struct wl_listener destroy; } handlers; + struct wl_list link; /* seat.tablets */ }; void tablet_init(struct seat *seat, struct wlr_input_device *wlr_input_device); diff --git a/include/labwc.h b/include/labwc.h index 419a5ee0..e3f1ad23 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -193,7 +193,9 @@ struct seat { struct wl_listener touch_motion; struct wl_listener touch_frame; + struct wl_list tablets; struct wl_list tablet_tools; + struct wl_list tablet_pads; struct wl_listener constraint_commit; struct wl_listener pressed_surface_destroy; diff --git a/src/input/tablet-pad.c b/src/input/tablet-pad.c index a155de87..2afa5e12 100644 --- a/src/input/tablet-pad.c +++ b/src/input/tablet-pad.c @@ -30,6 +30,7 @@ handle_destroy(struct wl_listener *listener, void *data) struct drawing_tablet_pad *pad = wl_container_of(listener, pad, handlers.destroy); + wl_list_remove(&pad->link); wl_list_remove(&pad->handlers.button.link); wl_list_remove(&pad->handlers.destroy.link); free(pad); @@ -45,4 +46,5 @@ tablet_pad_init(struct seat *seat, struct wlr_input_device *wlr_device) pad->tablet->data = pad; CONNECT_SIGNAL(pad->tablet, &pad->handlers, button); CONNECT_SIGNAL(wlr_device, &pad->handlers, destroy); + wl_list_insert(&seat->tablet_pads, &pad->link); } diff --git a/src/input/tablet.c b/src/input/tablet.c index 74a72488..8ba1fda7 100644 --- a/src/input/tablet.c +++ b/src/input/tablet.c @@ -510,6 +510,7 @@ handle_destroy(struct wl_listener *listener, void *data) struct drawing_tablet *tablet = wl_container_of(listener, tablet, handlers.destroy); + wl_list_remove(&tablet->link); wl_list_remove(&tablet->handlers.tip.link); wl_list_remove(&tablet->handlers.button.link); wl_list_remove(&tablet->handlers.proximity.link); @@ -547,4 +548,5 @@ tablet_init(struct seat *seat, struct wlr_input_device *wlr_device) CONNECT_SIGNAL(tablet->tablet, &tablet->handlers, tip); CONNECT_SIGNAL(tablet->tablet, &tablet->handlers, button); CONNECT_SIGNAL(wlr_device, &tablet->handlers, destroy); + wl_list_insert(&seat->tablets, &tablet->link); } diff --git a/src/seat.c b/src/seat.c index 5eca16a3..edeaf819 100644 --- a/src/seat.c +++ b/src/seat.c @@ -553,7 +553,9 @@ seat_init(struct server *server) } wlr_cursor_attach_output_layout(seat->cursor, server->output_layout); + wl_list_init(&seat->tablets); wl_list_init(&seat->tablet_tools); + wl_list_init(&seat->tablet_pads); input_handlers_init(seat); }