2017-06-15 20:32:28 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2019-07-27 10:53:54 +02:00
|
|
|
#include <wayland-server-core.h>
|
2017-06-21 16:27:45 +02:00
|
|
|
#include <wlr/interfaces/wlr_tablet_tool.h>
|
2018-02-12 21:29:23 +01:00
|
|
|
#include <wlr/types/wlr_tablet_tool.h>
|
2017-06-15 20:32:28 +02:00
|
|
|
|
2018-06-16 11:19:48 +02:00
|
|
|
void wlr_tablet_init(struct wlr_tablet *tablet,
|
2021-02-04 14:57:18 +01:00
|
|
|
const struct wlr_tablet_impl *impl) {
|
2018-06-16 11:19:48 +02:00
|
|
|
tablet->impl = impl;
|
|
|
|
wl_signal_init(&tablet->events.axis);
|
|
|
|
wl_signal_init(&tablet->events.proximity);
|
|
|
|
wl_signal_init(&tablet->events.tip);
|
|
|
|
wl_signal_init(&tablet->events.button);
|
2021-07-01 10:09:35 +02:00
|
|
|
wl_array_init(&tablet->paths);
|
2017-06-15 20:32:28 +02:00
|
|
|
}
|
|
|
|
|
2018-06-16 11:19:48 +02:00
|
|
|
void wlr_tablet_destroy(struct wlr_tablet *tablet) {
|
|
|
|
if (!tablet) {
|
2017-10-31 11:58:39 +01:00
|
|
|
return;
|
|
|
|
}
|
2018-05-15 16:16:19 +02:00
|
|
|
|
2021-07-01 10:09:35 +02:00
|
|
|
char *path;
|
|
|
|
wl_array_for_each(path, &tablet->paths) {
|
|
|
|
free(path);
|
|
|
|
}
|
|
|
|
wl_array_release(&tablet->paths);
|
2018-05-15 16:16:19 +02:00
|
|
|
|
2018-06-16 11:19:48 +02:00
|
|
|
if (tablet->impl && tablet->impl->destroy) {
|
|
|
|
tablet->impl->destroy(tablet);
|
2017-08-14 16:03:05 +02:00
|
|
|
} else {
|
2018-06-16 11:19:48 +02:00
|
|
|
free(tablet);
|
2017-06-15 20:32:28 +02:00
|
|
|
}
|
|
|
|
}
|