2017-06-19 18:49:07 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2019-07-27 08:53:54 +00:00
|
|
|
#include <wayland-server-core.h>
|
2017-06-21 14:27:45 +00:00
|
|
|
#include <wlr/interfaces/wlr_tablet_pad.h>
|
2018-02-12 20:29:23 +00:00
|
|
|
#include <wlr/types/wlr_tablet_pad.h>
|
2017-06-19 18:49:07 +00:00
|
|
|
|
2017-08-14 13:59:59 +00:00
|
|
|
void wlr_tablet_pad_init(struct wlr_tablet_pad *pad,
|
|
|
|
struct wlr_tablet_pad_impl *impl) {
|
2017-06-19 18:49:07 +00:00
|
|
|
pad->impl = impl;
|
|
|
|
wl_signal_init(&pad->events.button);
|
|
|
|
wl_signal_init(&pad->events.ring);
|
|
|
|
wl_signal_init(&pad->events.strip);
|
2018-04-26 10:31:25 +00:00
|
|
|
wl_signal_init(&pad->events.attach_tablet);
|
2019-05-10 06:35:23 +00:00
|
|
|
|
|
|
|
wl_list_init(&pad->groups);
|
2021-07-01 08:09:35 +00:00
|
|
|
wl_array_init(&pad->paths);
|
2017-06-19 18:49:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void wlr_tablet_pad_destroy(struct wlr_tablet_pad *pad) {
|
2018-05-15 14:16:19 +00:00
|
|
|
if (!pad) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-07-08 11:39:33 +00:00
|
|
|
char **path_ptr;
|
|
|
|
wl_array_for_each(path_ptr, &pad->paths) {
|
|
|
|
free(*path_ptr);
|
2021-07-01 08:09:35 +00:00
|
|
|
}
|
|
|
|
wl_array_release(&pad->paths);
|
2018-05-15 14:16:19 +00:00
|
|
|
|
|
|
|
if (pad->impl && pad->impl->destroy) {
|
2017-08-14 13:59:59 +00:00
|
|
|
pad->impl->destroy(pad);
|
|
|
|
} else {
|
|
|
|
free(pad);
|
2017-06-19 18:49:07 +00:00
|
|
|
}
|
|
|
|
}
|