[PATCH weston 08/31] evdev: Convert device type to an enum

Daniel Stone daniel at fooishbar.org
Wed May 30 08:31:46 PDT 2012


Rather than using #defines.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/evdev-private.h |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/evdev-private.h b/src/evdev-private.h
index c11c9b6..43143f2 100644
--- a/src/evdev-private.h
+++ b/src/evdev-private.h
@@ -36,6 +36,14 @@ struct evdev_seat {
 
 #define MAX_SLOTS 16
 
+enum evdev_event_type {
+	EVDEV_ABSOLUTE_MOTION = (1 << 0),
+	EVDEV_ABSOLUTE_MT_DOWN = (1 << 1),
+	EVDEV_ABSOLUTE_MT_MOTION = (1 << 2),
+	EVDEV_ABSOLUTE_MT_UP = (1 << 3),
+	EVDEV_RELATIVE_MOTION = (1 << 4),
+};
+
 struct evdev_input_device {
 	struct evdev_seat *master;
 	struct wl_list link;
@@ -60,18 +68,11 @@ struct evdev_input_device {
 		wl_fixed_t dx, dy;
 	} rel;
 
-	int type; /* event type flags */
+	enum evdev_event_type type;
 
 	int is_mt;
 };
 
-/* event type flags */
-#define EVDEV_ABSOLUTE_MOTION		(1 << 0)
-#define EVDEV_ABSOLUTE_MT_DOWN		(1 << 1)
-#define EVDEV_ABSOLUTE_MT_MOTION	(1 << 2)
-#define EVDEV_ABSOLUTE_MT_UP		(1 << 3)
-#define EVDEV_RELATIVE_MOTION		(1 << 4)
-
 /* copied from udev/extras/input_id/input_id.c */
 /* we must use this kernel-compatible implementation */
 #define BITS_PER_LONG (sizeof(unsigned long) * 8)
-- 
1.7.10



More information about the wayland-devel mailing list