tablet: stop using wlr_list

This commit is contained in:
Simon Ser 2021-07-01 10:09:35 +02:00 committed by Simon Zeni
parent e6cb11d882
commit 5888c96da8
9 changed files with 37 additions and 22 deletions

View file

@ -325,10 +325,12 @@ void add_tablet_pad_client(struct wlr_tablet_seat_client_v2 *seat,
if (pad->wlr_pad->button_count) {
zwp_tablet_pad_v2_send_buttons(client->resource, pad->wlr_pad->button_count);
}
for (size_t i = 0; i < pad->wlr_pad->paths.length; ++i) {
zwp_tablet_pad_v2_send_path(client->resource,
pad->wlr_pad->paths.items[i]);
const char *path;
wl_array_for_each(path, &pad->wlr_pad->paths) {
zwp_tablet_pad_v2_send_path(client->resource, path);
}
size_t i = 0;
struct wlr_tablet_pad_group *group;
client->group_count = pad->group_count;

View file

@ -113,10 +113,12 @@ void add_tablet_client(struct wlr_tablet_seat_client_v2 *seat,
}
zwp_tablet_v2_send_id(client->resource,
tablet->wlr_device->vendor, tablet->wlr_device->product);
for (size_t i = 0; i < tablet->wlr_tablet->paths.length; ++i) {
zwp_tablet_v2_send_path(client->resource,
tablet->wlr_tablet->paths.items[i]);
const char *path;
wl_array_for_each(path, &tablet->wlr_tablet->paths) {
zwp_tablet_v2_send_path(client->resource, path);
}
zwp_tablet_v2_send_done(client->resource);
client->client = seat->wl_client;

View file

@ -13,7 +13,7 @@ void wlr_tablet_pad_init(struct wlr_tablet_pad *pad,
wl_signal_init(&pad->events.attach_tablet);
wl_list_init(&pad->groups);
wlr_list_init(&pad->paths);
wl_array_init(&pad->paths);
}
void wlr_tablet_pad_destroy(struct wlr_tablet_pad *pad) {
@ -21,8 +21,11 @@ void wlr_tablet_pad_destroy(struct wlr_tablet_pad *pad) {
return;
}
wlr_list_for_each(&pad->paths, free);
wlr_list_finish(&pad->paths);
char *path;
wl_array_for_each(path, &pad->paths) {
free(path);
}
wl_array_release(&pad->paths);
if (pad->impl && pad->impl->destroy) {
pad->impl->destroy(pad);

View file

@ -11,6 +11,7 @@ void wlr_tablet_init(struct wlr_tablet *tablet,
wl_signal_init(&tablet->events.proximity);
wl_signal_init(&tablet->events.tip);
wl_signal_init(&tablet->events.button);
wl_array_init(&tablet->paths);
}
void wlr_tablet_destroy(struct wlr_tablet *tablet) {
@ -18,8 +19,11 @@ void wlr_tablet_destroy(struct wlr_tablet *tablet) {
return;
}
wlr_list_for_each(&tablet->paths, free);
wlr_list_finish(&tablet->paths);
char *path;
wl_array_for_each(path, &tablet->paths) {
free(path);
}
wl_array_release(&tablet->paths);
if (tablet->impl && tablet->impl->destroy) {
tablet->impl->destroy(tablet);