interface/wlr_touch: rework destroy sequence

The destroy callback in wlr_touch_impl has been removed. The function
`wlr_touch_finish` has been introduced to clean up the resources owned by a
wlr_touch.

`wlr_input_device_destroy` no longer destroys the wlr_touch, attempting to
destroy a wlr_touch will result in a no-op.

The field `name` has been added to the wlr_touch_impl to be able to identify
a given wlr_touch device.
This commit is contained in:
Simon Zeni 2022-03-02 16:07:40 -05:00 committed by Kirill Primak
parent 8d3cb94b41
commit 10cbb9fbe1
8 changed files with 12 additions and 22 deletions

View file

@ -2,7 +2,6 @@
#include <stdlib.h>
#include <string.h>
#include <wayland-server-core.h>
#include <wlr/interfaces/wlr_touch.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/util/log.h>
#include "util/signal.h"
@ -45,7 +44,7 @@ void wlr_input_device_destroy(struct wlr_input_device *dev) {
wlr_log(WLR_ERROR, "wlr_switch will not be destroyed");
break;
case WLR_INPUT_DEVICE_TOUCH:
wlr_touch_destroy(dev->touch);
wlr_log(WLR_ERROR, "wlr_touch will not be destroyed");
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
wlr_log(WLR_ERROR, "wlr_tablet_tool will not be destroyed");

View file

@ -17,11 +17,6 @@ void wlr_touch_init(struct wlr_touch *touch,
wl_signal_init(&touch->events.frame);
}
void wlr_touch_destroy(struct wlr_touch *touch) {
void wlr_touch_finish(struct wlr_touch *touch) {
wlr_input_device_finish(&touch->base);
if (touch && touch->impl && touch->impl->destroy) {
touch->impl->destroy(touch);
} else {
free(touch);
}
}