aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/tablet_tool.c
diff options
context:
space:
mode:
authorSimon Zeni <simon@bl4ckb0ne.ca>2022-03-02 15:58:44 -0500
committerKirill Primak <vyivel@eclair.cafe>2022-03-07 16:37:41 +0000
commit8d3cb94b41b3c21350e16e38a00f4e33941c33d5 (patch)
tree1bb4949645852f26224e9b5089c134d923d90d3c /backend/libinput/tablet_tool.c
parenta5b032cb1e9a3510d7722640a8970532be4d7b57 (diff)
interface/wlr_tablet_tool: rework destroy sequence
The destroy callback in wlr_tablet_tool_impl has been removed. The function `wlr_tablet_tool_finish` has been introduced to clean up the resources owned by a wlr_tablet_tool. `wlr_input_device_destroy` no longer destroys the wlr_tablet_tool, attempting to destroy a wlr_tablet_tool will result in a no-op. The field `name` has been added to the wlr_tablet_tool_impl to be able to identify a given wlr_tablet_tool device.
Diffstat (limited to 'backend/libinput/tablet_tool.c')
-rw-r--r--backend/libinput/tablet_tool.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c
index af212218..c778ccc2 100644
--- a/backend/libinput/tablet_tool.c
+++ b/backend/libinput/tablet_tool.c
@@ -14,24 +14,8 @@ struct tablet_tool {
struct wl_list link; // wlr_libinput_input_device::tablet_tools
};
-static void tool_destroy(struct tablet_tool *tool) {
- wlr_signal_emit_safe(&tool->wlr_tool.events.destroy, &tool->wlr_tool);
- libinput_tablet_tool_unref(tool->handle);
- libinput_tablet_tool_set_user_data(tool->handle, NULL);
- wl_list_remove(&tool->link);
- free(tool);
-}
-
-static void tablet_destroy(struct wlr_tablet *wlr_tablet) {
- struct wlr_libinput_input_device *dev = device_from_tablet(wlr_tablet);
- struct tablet_tool *tool, *tmp;
- wl_list_for_each_safe(tool, tmp, &dev->tablet_tools, link) {
- tool_destroy(tool);
- }
-}
-
const struct wlr_tablet_impl libinput_tablet_impl = {
- .destroy = tablet_destroy,
+ .name = "libinput-tablet-tool",
};
void init_device_tablet(struct wlr_libinput_input_device *dev) {
@@ -48,6 +32,23 @@ void init_device_tablet(struct wlr_libinput_input_device *dev) {
wl_list_init(&dev->tablet_tools);
}
+static void tool_destroy(struct tablet_tool *tool) {
+ wlr_signal_emit_safe(&tool->wlr_tool.events.destroy, &tool->wlr_tool);
+ libinput_tablet_tool_unref(tool->handle);
+ libinput_tablet_tool_set_user_data(tool->handle, NULL);
+ wl_list_remove(&tool->link);
+ free(tool);
+}
+
+void finish_device_tablet(struct wlr_libinput_input_device *dev) {
+ struct tablet_tool *tool, *tmp;
+ wl_list_for_each_safe(tool, tmp, &dev->tablet_tools, link) {
+ tool_destroy(tool);
+ }
+
+ wlr_tablet_finish(&dev->tablet);
+}
+
struct wlr_libinput_input_device *device_from_tablet(
struct wlr_tablet *wlr_tablet) {
assert(wlr_tablet->impl == &libinput_tablet_impl);