mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 04:40:25 +01:00
evdev: Add a remove callback to the evdev_dispatch_interface
Some dispatchers may want to do some cleanup at remove time, rather then at destroy time. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
c212f2042d
commit
4a971a69cf
3 changed files with 8 additions and 0 deletions
|
|
@ -858,6 +858,7 @@ tp_tag_device(struct evdev_device *device,
|
|||
|
||||
static struct evdev_dispatch_interface tp_interface = {
|
||||
tp_process,
|
||||
NULL, /* remove */
|
||||
tp_destroy,
|
||||
tp_device_added,
|
||||
tp_device_removed,
|
||||
|
|
|
|||
|
|
@ -737,6 +737,7 @@ evdev_calibration_get_default_matrix(struct libinput_device *libinput_device,
|
|||
|
||||
struct evdev_dispatch_interface fallback_interface = {
|
||||
fallback_process,
|
||||
NULL, /* remove */
|
||||
fallback_destroy,
|
||||
NULL, /* device_added */
|
||||
NULL, /* device_removed */
|
||||
|
|
@ -2041,6 +2042,9 @@ evdev_device_remove(struct evdev_device *device)
|
|||
|
||||
evdev_device_suspend(device);
|
||||
|
||||
if (device->dispatch->interface->remove)
|
||||
device->dispatch->interface->remove(device->dispatch);
|
||||
|
||||
/* A device may be removed while suspended, mark it to
|
||||
* skip re-opening a different device with the same node */
|
||||
device->was_removed = true;
|
||||
|
|
|
|||
|
|
@ -166,6 +166,9 @@ struct evdev_dispatch_interface {
|
|||
struct input_event *event,
|
||||
uint64_t time);
|
||||
|
||||
/* Device is being removed (may be NULL) */
|
||||
void (*remove)(struct evdev_dispatch *dispatch);
|
||||
|
||||
/* Destroy an event dispatch handler and free all its resources. */
|
||||
void (*destroy)(struct evdev_dispatch *dispatch);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue