From d17e84fc0fab591869d8b6f0ce8b9933cbe1c5b8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 25 Jan 2017 15:19:50 +1000 Subject: [PATCH] Add a helper function for initializing an event listener Not needed right now as everything assumes the listener was added before it was removed. This helper is for the cases where we may call listener_remove before it was ever added. Signed-off-by: Peter Hutterer --- src/libinput-private.h | 3 +++ src/libinput.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/libinput-private.h b/src/libinput-private.h index 07bed365..205dbf89 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -466,6 +466,9 @@ void libinput_device_set_device_group(struct libinput_device *device, struct libinput_device_group *group); +void +libinput_device_init_event_listener(struct libinput_event_listener *listener); + void libinput_device_add_event_listener(struct libinput_device *device, struct libinput_event_listener *listener, diff --git a/src/libinput.c b/src/libinput.c index 49971530..ebfedece 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -1944,6 +1944,12 @@ libinput_dispatch(struct libinput *libinput) return 0; } +void +libinput_device_init_event_listener(struct libinput_event_listener *listener) +{ + list_init(&listener->link); +} + void libinput_device_add_event_listener(struct libinput_device *device, struct libinput_event_listener *listener,