[PATCH libinput 2/7] Use named initializers for the various dispatch interfaces

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 21 00:57:11 UTC 2017


Better for self-documentation than comments and makes it more obvious if we
initialize something wrongly.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 20 ++++++++++----------
 src/evdev-tablet-pad.c  | 20 ++++++++++----------
 src/evdev-tablet.c      | 20 ++++++++++----------
 src/evdev.c             | 20 ++++++++++----------
 4 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index c3e9e5a3..a2b97c97 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -2251,16 +2251,16 @@ tp_interface_toggle_touch(struct evdev_dispatch *dispatch,
 }
 
 static struct evdev_dispatch_interface tp_interface = {
-	tp_interface_process,
-	tp_interface_suspend,
-	tp_interface_remove,
-	tp_interface_destroy,
-	tp_interface_device_added,
-	tp_interface_device_removed,
-	tp_interface_device_removed, /* device_suspended, treat as remove */
-	tp_interface_device_added,   /* device_resumed, treat as add */
-	NULL,                        /* post_added */
-	tp_interface_toggle_touch,
+	.process = tp_interface_process,
+	.suspend = tp_interface_suspend,
+	.remove = tp_interface_remove,
+	.destroy = tp_interface_destroy,
+	.device_added = tp_interface_device_added,
+	.device_removed = tp_interface_device_removed,
+	.device_suspended = tp_interface_device_removed, /* treat as remove */
+	.device_resumed = tp_interface_device_added,   /* treat as add */
+	.post_added = NULL,
+	.toggle_touch = tp_interface_toggle_touch,
 };
 
 static void
diff --git a/src/evdev-tablet-pad.c b/src/evdev-tablet-pad.c
index 092defa6..00db4c29 100644
--- a/src/evdev-tablet-pad.c
+++ b/src/evdev-tablet-pad.c
@@ -504,16 +504,16 @@ pad_destroy(struct evdev_dispatch *dispatch)
 }
 
 static struct evdev_dispatch_interface pad_interface = {
-	pad_process,
-	pad_suspend, /* suspend */
-	NULL, /* remove */
-	pad_destroy,
-	NULL, /* device_added */
-	NULL, /* device_removed */
-	NULL, /* device_suspended */
-	NULL, /* device_resumed */
-	NULL, /* post_added */
-	NULL, /* toggle_touch */
+	.process = pad_process,
+	.suspend = pad_suspend,
+	.remove = NULL,
+	.destroy = pad_destroy,
+	.device_added = NULL,
+	.device_removed = NULL,
+	.device_suspended = NULL,
+	.device_resumed = NULL,
+	.post_added = NULL,
+	.toggle_touch = NULL,
 };
 
 static void
diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 7e9281d1..fbbcae09 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -1861,16 +1861,16 @@ tablet_check_initial_proximity(struct evdev_device *device,
 }
 
 static struct evdev_dispatch_interface tablet_interface = {
-	tablet_process,
-	tablet_suspend,
-	NULL, /* remove */
-	tablet_destroy,
-	tablet_device_added,
-	tablet_device_removed,
-	NULL, /* device_suspended */
-	NULL, /* device_resumed */
-	tablet_check_initial_proximity,
-	NULL, /* toggle_touch */
+	.process = tablet_process,
+	.suspend = tablet_suspend,
+	.remove = NULL,
+	.destroy = tablet_destroy,
+	.device_added = tablet_device_added,
+	.device_removed = tablet_device_removed,
+	.device_suspended = NULL,
+	.device_resumed = NULL,
+	.post_added = tablet_check_initial_proximity,
+	.toggle_touch = NULL,
 };
 
 static void
diff --git a/src/evdev.c b/src/evdev.c
index 65d6e16e..b2149eff 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1725,16 +1725,16 @@ fallback_interface_device_removed(struct evdev_device *device,
 }
 
 struct evdev_dispatch_interface fallback_interface = {
-	fallback_process,
-	fallback_suspend,
-	fallback_remove,
-	fallback_destroy,
-	fallback_interface_device_added,
-	fallback_interface_device_removed,
-	fallback_interface_device_removed, /* device_suspended, treat as remove */
-	fallback_interface_device_added,   /* device_resumed, treat as add */
-	fallback_sync_initial_state, /* post_added */
-	fallback_toggle_touch,
+	.process = fallback_process,
+	.suspend = fallback_suspend,
+	.remove = fallback_remove,
+	.destroy = fallback_destroy,
+	.device_added = fallback_interface_device_added,
+	.device_removed = fallback_interface_device_removed,
+	.device_suspended = fallback_interface_device_removed, /* treat as remove */
+	.device_resumed = fallback_interface_device_added,   /* treat as add */
+	.post_added = fallback_sync_initial_state,
+	.toggle_touch = fallback_toggle_touch,
 };
 
 static uint32_t
-- 
2.13.5



More information about the wayland-devel mailing list