[PATCH libinput 03/11] event-debug: Add support for gesture events
Hans de Goede
hdegoede at redhat.com
Wed Feb 18 04:26:46 PST 2015
Add support for gesture events to the event-debug tool.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
tools/event-debug.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/tools/event-debug.c b/tools/event-debug.c
index 055f3cc..d76c127 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -106,6 +106,15 @@ print_event_header(struct libinput_event *ev)
case LIBINPUT_EVENT_TOUCH_FRAME:
type = "TOUCH_FRAME";
break;
+ case LIBINPUT_EVENT_GESTURE_SWIPE_START:
+ type = "GESTURE_SWIPE_START";
+ break;
+ case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE:
+ type = "GESTURE_SWIPE_UPDATE";
+ break;
+ case LIBINPUT_EVENT_GESTURE_SWIPE_END:
+ type = "GESTURE_SWIPE_END";
+ break;
}
printf("%-7s %s ", libinput_device_get_sysname(dev), type);
@@ -269,6 +278,31 @@ print_touch_event_with_coords(struct libinput_event *ev)
xmm, ymm);
}
+static void
+print_gesture_event_without_coords(struct libinput_event *ev)
+{
+ struct libinput_event_gesture *t = libinput_event_get_gesture_event(ev);
+
+ print_event_time(libinput_event_gesture_get_time(t));
+ printf("%d\n", libinput_event_gesture_get_finger_count(t));
+}
+
+static void
+print_gesture_event_with_coords(struct libinput_event *ev)
+{
+ struct libinput_event_gesture *t = libinput_event_get_gesture_event(ev);
+ double dx = libinput_event_gesture_get_dx(t);
+ double dy = libinput_event_gesture_get_dy(t);
+ double dx_unaccel = libinput_event_gesture_get_dx_unaccelerated(t);
+ double dy_unaccel = libinput_event_gesture_get_dy_unaccelerated(t);
+
+ print_event_time(libinput_event_gesture_get_time(t));
+
+ printf("%d %5.2f/%5.2f (%5.2f/%5.2f unaccelerated)\n",
+ libinput_event_gesture_get_finger_count(t),
+ dx, dy, dx_unaccel, dy_unaccel);
+}
+
static int
handle_and_print_events(struct libinput *li)
{
@@ -318,6 +352,15 @@ handle_and_print_events(struct libinput *li)
case LIBINPUT_EVENT_TOUCH_FRAME:
print_touch_event_without_coords(ev);
break;
+ case LIBINPUT_EVENT_GESTURE_SWIPE_START:
+ print_gesture_event_without_coords(ev);
+ break;
+ case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE:
+ print_gesture_event_with_coords(ev);
+ break;
+ case LIBINPUT_EVENT_GESTURE_SWIPE_END:
+ print_gesture_event_without_coords(ev);
+ break;
}
libinput_event_destroy(ev);
--
2.1.0
More information about the wayland-devel
mailing list