mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
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.
This commit is contained in:
parent
a5b032cb1e
commit
8d3cb94b41
8 changed files with 34 additions and 41 deletions
|
|
@ -563,6 +563,10 @@ void destroy_wl_input_device(struct wlr_wl_input_device *dev) {
|
|||
wlr_tablet_pad_finish(wlr_dev->tablet_pad);
|
||||
free(wlr_dev->tablet_pad);
|
||||
break;
|
||||
case WLR_INPUT_DEVICE_TABLET_TOOL:
|
||||
wlr_tablet_finish(wlr_dev->tablet);
|
||||
free(wlr_dev->tablet);
|
||||
break;
|
||||
default:
|
||||
wlr_input_device_destroy(wlr_dev);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -867,13 +867,8 @@ static void handle_tablet_removed(void *data,
|
|||
struct zwp_tablet_v2 *zwp_tablet_v2) {
|
||||
struct wlr_wl_input_device *dev = data;
|
||||
|
||||
/* This doesn't free anything, but emits the destroy signal */
|
||||
wlr_input_device_destroy(&dev->wlr_input_device);
|
||||
/* This is a bit ugly, but we need to remove it from our list */
|
||||
wl_list_remove(&dev->link);
|
||||
|
||||
zwp_tablet_v2_destroy(dev->resource);
|
||||
free(dev);
|
||||
destroy_wl_input_device(dev);
|
||||
}
|
||||
|
||||
static const struct zwp_tablet_v2_listener tablet_listener = {
|
||||
|
|
@ -884,7 +879,9 @@ static const struct zwp_tablet_v2_listener tablet_listener = {
|
|||
.removed = handle_tablet_removed,
|
||||
};
|
||||
|
||||
const struct wlr_tablet_impl tablet_impl = {0};
|
||||
const struct wlr_tablet_impl tablet_impl = {
|
||||
.name = "wl-tablet-tool",
|
||||
};
|
||||
|
||||
static void handle_tab_added(void *data,
|
||||
struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,
|
||||
|
|
@ -908,7 +905,7 @@ static void handle_tab_added(void *data,
|
|||
return;
|
||||
}
|
||||
zwp_tablet_v2_set_user_data(id, wlr_dev->tablet);
|
||||
wlr_tablet_init(wlr_dev->tablet, &tablet_impl, wlr_dev->name);
|
||||
wlr_tablet_init(wlr_dev->tablet, &tablet_impl, "wlr_tablet_v2");
|
||||
zwp_tablet_v2_add_listener(id, &tablet_listener, dev);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue