[PATCH libinput 02/11] Add a gesture capability flag

Hans de Goede hdegoede at redhat.com
Wed Feb 18 04:26:45 PST 2015


Add a new LIBINPUT_DEVICE_CAP_GESTURE device capability,

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/evdev.c         | 3 +++
 src/evdev.h         | 3 ++-
 src/libinput.h      | 3 ++-
 tools/event-debug.c | 3 +++
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 525d5d7..9a1ea13 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1487,6 +1487,7 @@ evdev_configure_device(struct evdev_device *device)
 
 	if (udev_tags & EVDEV_UDEV_TAG_TOUCHPAD) {
 		device->dispatch = evdev_mt_touchpad_create(device);
+		device->seat_caps |= EVDEV_DEVICE_GESTURE;
 		log_info(libinput,
 			 "input device '%s', %s is a touchpad\n",
 			 device->devname, devnode);
@@ -1801,6 +1802,8 @@ evdev_device_has_capability(struct evdev_device *device,
 		return !!(device->seat_caps & EVDEV_DEVICE_KEYBOARD);
 	case LIBINPUT_DEVICE_CAP_TOUCH:
 		return !!(device->seat_caps & EVDEV_DEVICE_TOUCH);
+	case LIBINPUT_DEVICE_CAP_GESTURE:
+		return !!(device->seat_caps & EVDEV_DEVICE_GESTURE);
 	default:
 		return 0;
 	}
diff --git a/src/evdev.h b/src/evdev.h
index fc70a28..845cd29 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -47,7 +47,8 @@ enum evdev_event_type {
 enum evdev_device_seat_capability {
 	EVDEV_DEVICE_POINTER = (1 << 0),
 	EVDEV_DEVICE_KEYBOARD = (1 << 1),
-	EVDEV_DEVICE_TOUCH = (1 << 2)
+	EVDEV_DEVICE_TOUCH = (1 << 2),
+	EVDEV_DEVICE_GESTURE = (1 << 3),
 };
 
 enum evdev_device_tags {
diff --git a/src/libinput.h b/src/libinput.h
index c0112c2..cf4511d 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -54,7 +54,8 @@ enum libinput_log_priority {
 enum libinput_device_capability {
 	LIBINPUT_DEVICE_CAP_KEYBOARD = 0,
 	LIBINPUT_DEVICE_CAP_POINTER = 1,
-	LIBINPUT_DEVICE_CAP_TOUCH = 2
+	LIBINPUT_DEVICE_CAP_TOUCH = 2,
+	LIBINPUT_DEVICE_CAP_GESTURE = 3,
 };
 
 /**
diff --git a/tools/event-debug.c b/tools/event-debug.c
index 297e47d..055f3cc 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -140,6 +140,9 @@ print_device_notify(struct libinput_event *ev)
 	if (libinput_device_has_capability(dev,
 					   LIBINPUT_DEVICE_CAP_TOUCH))
 		printf("t");
+	if (libinput_device_has_capability(dev,
+					   LIBINPUT_DEVICE_CAP_GESTURE))
+		printf("g");
 
 	if (libinput_device_get_size(dev, &w, &h) == 0)
 		printf("\tsize %.2f/%.2fmm", w, h);
-- 
2.1.0



More information about the wayland-devel mailing list