mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
tablet: stop using wlr_list
This commit is contained in:
parent
e6cb11d882
commit
5888c96da8
9 changed files with 37 additions and 22 deletions
|
@ -85,7 +85,8 @@ struct wlr_tablet_pad *create_libinput_tablet_pad(
|
|||
libinput_device_tablet_pad_get_num_strips(libinput_dev);
|
||||
|
||||
struct udev_device *udev = libinput_device_get_udev_device(libinput_dev);
|
||||
wlr_list_push(&wlr_tablet_pad->paths, strdup(udev_device_get_syspath(udev)));
|
||||
char **dst = wl_array_add(&wlr_tablet_pad->paths, sizeof(char *));
|
||||
*dst = strdup(udev_device_get_syspath(udev));
|
||||
|
||||
int groups = libinput_device_tablet_pad_get_num_mode_groups(libinput_dev);
|
||||
for (int i = 0; i < groups; ++i) {
|
||||
|
|
|
@ -84,15 +84,18 @@ struct wlr_tablet *create_libinput_tablet(
|
|||
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_tool");
|
||||
return NULL;
|
||||
}
|
||||
struct wlr_tablet *wlr_tablet = &libinput_tablet->wlr_tablet;
|
||||
|
||||
wlr_list_init(&wlr_tablet->paths);
|
||||
struct wlr_tablet *wlr_tablet = &libinput_tablet->wlr_tablet;
|
||||
wlr_tablet_init(wlr_tablet, &tablet_impl);
|
||||
|
||||
struct udev_device *udev = libinput_device_get_udev_device(libinput_dev);
|
||||
wlr_list_push(&wlr_tablet->paths, strdup(udev_device_get_syspath(udev)));
|
||||
char **dst = wl_array_add(&wlr_tablet->paths, sizeof(char *));
|
||||
*dst = strdup(udev_device_get_syspath(udev));
|
||||
|
||||
wlr_tablet->name = strdup(libinput_device_get_name(libinput_dev));
|
||||
|
||||
wl_list_init(&libinput_tablet->tools);
|
||||
|
||||
wlr_tablet_init(wlr_tablet, &tablet_impl);
|
||||
return wlr_tablet;
|
||||
}
|
||||
|
||||
|
|
|
@ -336,7 +336,8 @@ static void handle_tablet_pad_path(void *data,
|
|||
struct wlr_wl_input_device *dev = data;
|
||||
struct wlr_tablet_pad *tablet_pad = dev->wlr_input_device.tablet_pad;
|
||||
|
||||
wlr_list_push(&tablet_pad->paths, strdup(path));
|
||||
char **dst = wl_array_add(&tablet_pad->paths, sizeof(char *));
|
||||
*dst = strdup(path);
|
||||
}
|
||||
|
||||
static void handle_tablet_pad_buttons(void *data,
|
||||
|
@ -854,7 +855,8 @@ static void handle_tablet_path(void *data, struct zwp_tablet_v2 *zwp_tablet_v2,
|
|||
struct wlr_wl_input_device *dev = data;
|
||||
struct wlr_tablet *tablet = dev->wlr_input_device.tablet;
|
||||
|
||||
wlr_list_push(&tablet->paths, strdup(path));
|
||||
char **dst = wl_array_add(&tablet->paths, sizeof(char *));
|
||||
*dst = strdup(path);
|
||||
}
|
||||
|
||||
static void handle_tablet_done(void *data, struct zwp_tablet_v2 *zwp_tablet_v2) {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <stdint.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_list.h>
|
||||
|
||||
/*
|
||||
* NOTE: the wlr tablet pad implementation does not currently support tablets
|
||||
|
@ -37,7 +36,7 @@ struct wlr_tablet_pad {
|
|||
size_t strip_count;
|
||||
|
||||
struct wl_list groups; // wlr_tablet_pad_group::link
|
||||
struct wlr_list paths; // char *
|
||||
struct wl_array paths; // char *
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <stdint.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_list.h>
|
||||
|
||||
/*
|
||||
* Copy+Paste from libinput, but this should neither use libinput, nor
|
||||
|
@ -71,7 +70,7 @@ struct wlr_tablet {
|
|||
} events;
|
||||
|
||||
char *name;
|
||||
struct wlr_list paths; // char *
|
||||
struct wl_array paths; // char *
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue