tablet: stop using wlr_list
This commit is contained in:
parent
e6cb11d882
commit
5888c96da8
|
@ -85,7 +85,8 @@ struct wlr_tablet_pad *create_libinput_tablet_pad(
|
||||||
libinput_device_tablet_pad_get_num_strips(libinput_dev);
|
libinput_device_tablet_pad_get_num_strips(libinput_dev);
|
||||||
|
|
||||||
struct udev_device *udev = libinput_device_get_udev_device(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);
|
int groups = libinput_device_tablet_pad_get_num_mode_groups(libinput_dev);
|
||||||
for (int i = 0; i < groups; ++i) {
|
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");
|
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_tool");
|
||||||
return NULL;
|
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);
|
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));
|
wlr_tablet->name = strdup(libinput_device_get_name(libinput_dev));
|
||||||
|
|
||||||
wl_list_init(&libinput_tablet->tools);
|
wl_list_init(&libinput_tablet->tools);
|
||||||
|
|
||||||
wlr_tablet_init(wlr_tablet, &tablet_impl);
|
|
||||||
return wlr_tablet;
|
return wlr_tablet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,8 @@ static void handle_tablet_pad_path(void *data,
|
||||||
struct wlr_wl_input_device *dev = data;
|
struct wlr_wl_input_device *dev = data;
|
||||||
struct wlr_tablet_pad *tablet_pad = dev->wlr_input_device.tablet_pad;
|
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,
|
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_wl_input_device *dev = data;
|
||||||
struct wlr_tablet *tablet = dev->wlr_input_device.tablet;
|
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) {
|
static void handle_tablet_done(void *data, struct zwp_tablet_v2 *zwp_tablet_v2) {
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/types/wlr_input_device.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
|
* NOTE: the wlr tablet pad implementation does not currently support tablets
|
||||||
|
@ -37,7 +36,7 @@ struct wlr_tablet_pad {
|
||||||
size_t strip_count;
|
size_t strip_count;
|
||||||
|
|
||||||
struct wl_list groups; // wlr_tablet_pad_group::link
|
struct wl_list groups; // wlr_tablet_pad_group::link
|
||||||
struct wlr_list paths; // char *
|
struct wl_array paths; // char *
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/types/wlr_input_device.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
|
* Copy+Paste from libinput, but this should neither use libinput, nor
|
||||||
|
@ -71,7 +70,7 @@ struct wlr_tablet {
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
struct wlr_list paths; // char *
|
struct wl_array paths; // char *
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -325,10 +325,12 @@ void add_tablet_pad_client(struct wlr_tablet_seat_client_v2 *seat,
|
||||||
if (pad->wlr_pad->button_count) {
|
if (pad->wlr_pad->button_count) {
|
||||||
zwp_tablet_pad_v2_send_buttons(client->resource, 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,
|
const char *path;
|
||||||
pad->wlr_pad->paths.items[i]);
|
wl_array_for_each(path, &pad->wlr_pad->paths) {
|
||||||
|
zwp_tablet_pad_v2_send_path(client->resource, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
struct wlr_tablet_pad_group *group;
|
struct wlr_tablet_pad_group *group;
|
||||||
client->group_count = pad->group_count;
|
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,
|
zwp_tablet_v2_send_id(client->resource,
|
||||||
tablet->wlr_device->vendor, tablet->wlr_device->product);
|
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,
|
const char *path;
|
||||||
tablet->wlr_tablet->paths.items[i]);
|
wl_array_for_each(path, &tablet->wlr_tablet->paths) {
|
||||||
|
zwp_tablet_v2_send_path(client->resource, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
zwp_tablet_v2_send_done(client->resource);
|
zwp_tablet_v2_send_done(client->resource);
|
||||||
|
|
||||||
client->client = seat->wl_client;
|
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_signal_init(&pad->events.attach_tablet);
|
||||||
|
|
||||||
wl_list_init(&pad->groups);
|
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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_list_for_each(&pad->paths, free);
|
char *path;
|
||||||
wlr_list_finish(&pad->paths);
|
wl_array_for_each(path, &pad->paths) {
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
wl_array_release(&pad->paths);
|
||||||
|
|
||||||
if (pad->impl && pad->impl->destroy) {
|
if (pad->impl && pad->impl->destroy) {
|
||||||
pad->impl->destroy(pad);
|
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.proximity);
|
||||||
wl_signal_init(&tablet->events.tip);
|
wl_signal_init(&tablet->events.tip);
|
||||||
wl_signal_init(&tablet->events.button);
|
wl_signal_init(&tablet->events.button);
|
||||||
|
wl_array_init(&tablet->paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_tablet_destroy(struct wlr_tablet *tablet) {
|
void wlr_tablet_destroy(struct wlr_tablet *tablet) {
|
||||||
|
@ -18,8 +19,11 @@ void wlr_tablet_destroy(struct wlr_tablet *tablet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_list_for_each(&tablet->paths, free);
|
char *path;
|
||||||
wlr_list_finish(&tablet->paths);
|
wl_array_for_each(path, &tablet->paths) {
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
wl_array_release(&tablet->paths);
|
||||||
|
|
||||||
if (tablet->impl && tablet->impl->destroy) {
|
if (tablet->impl && tablet->impl->destroy) {
|
||||||
tablet->impl->destroy(tablet);
|
tablet->impl->destroy(tablet);
|
||||||
|
|
Loading…
Reference in New Issue