]> git.mdlowis.com Git - proto/labwc.git/commitdiff
input: track tablets and tablet-pads at seat
authorJens Peters <jp7677@gmail.com>
Tue, 4 Jun 2024 18:14:30 +0000 (20:14 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 13 Jun 2024 20:23:37 +0000 (21:23 +0100)
include/input/tablet-pad.h
include/input/tablet.h
include/labwc.h
src/input/tablet-pad.c
src/input/tablet.c
src/seat.c

index 4600a6fe83ede882619d48b3f00da74ef356a47f..c17b2f7f9beef3ed6ede34fb9024e4e73b4102a4 100644 (file)
@@ -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);
index 73eb2de222409ba65005c675dec74cf7caf545b9..e7ed395aec44a2f65d5d02a5dfa198f2df1ed1ac 100644 (file)
@@ -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);
index 419a5ee0811a73a2222385feebaec259f4d33e4a..e3f1ad2309dd718c9f4e29d82417f23d30c344be 100644 (file)
@@ -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;
index a155de87ac350580df5bfec4cda1df0afc851dd8..2afa5e1258d49d135d586e1b67b51f04c299a9b5 100644 (file)
@@ -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);
 }
index 74a72488c87365a5c86c5b72c9f6b6f35d5c5ca0..8ba1fda7599652762c500ad527ab97fe4a6a2fb2 100644 (file)
@@ -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);
 }
index 5eca16a3b1c2f72b7f16ef3fe5ad554cbd632f47..edeaf819dd5ef27562c517602cebfbbecee56d09 100644 (file)
@@ -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);
 }