[PATCH libinput 12/14] Add a helper function for initializing an event listener

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 25 23:44:22 UTC 2017


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 <peter.hutterer at who-t.net>
---
 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 07bed36..205dbf8 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -467,6 +467,9 @@ 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,
 				   void (*notify_func)(
diff --git a/src/libinput.c b/src/libinput.c
index 4997153..ebfedec 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1945,6 +1945,12 @@ libinput_dispatch(struct libinput *libinput)
 }
 
 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,
 				   void (*notify_func)(
-- 
2.9.3



More information about the wayland-devel mailing list