[PATCH libinput 1/6] Store the backend type in the interface

Peter Hutterer peter.hutterer at who-t.net
Wed Feb 5 20:13:05 PST 2014


This enables us to prevent callers from calling backend-specific functions on
mismatching backends.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/libinput-private.h | 6 ++++++
 src/path.c             | 1 +
 src/udev-seat.c        | 1 +
 3 files changed, 8 insertions(+)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 0d7de90..ee5a17d 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -26,7 +26,13 @@
 #include "libinput.h"
 #include "libinput-util.h"
 
+enum libinput_backend_type {
+	BACKEND_UDEV,
+	BACKEND_PATH,
+};
+
 struct libinput_interface_backend {
+	enum libinput_backend_type backend_type;
 	int (*resume)(struct libinput *libinput);
 	void (*suspend)(struct libinput *libinput);
 	void (*destroy)(struct libinput *libinput);
diff --git a/src/path.c b/src/path.c
index de2ca49..4924b31 100644
--- a/src/path.c
+++ b/src/path.c
@@ -167,6 +167,7 @@ path_input_destroy(struct libinput *input)
 }
 
 static const struct libinput_interface_backend interface_backend = {
+	.backend_type = BACKEND_PATH,
 	.resume = path_input_enable,
 	.suspend = path_input_disable,
 	.destroy = path_input_destroy,
diff --git a/src/udev-seat.c b/src/udev-seat.c
index 957e762..b564c83 100644
--- a/src/udev-seat.c
+++ b/src/udev-seat.c
@@ -330,6 +330,7 @@ udev_seat_get_named(struct udev_input *input, const char *seat_name)
 }
 
 static const struct libinput_interface_backend interface_backend = {
+	.backend_type = BACKEND_UDEV,
 	.resume = udev_input_enable,
 	.suspend = udev_input_disable,
 	.destroy = udev_input_destroy,
-- 
1.8.4.2



More information about the wayland-devel mailing list