[PATCH xinput 1/4] test-xi2: print the correct flags, depending on the event type

Peter Hutterer peter.hutterer at who-t.net
Thu Aug 18 23:35:27 PDT 2011


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/test_xi2.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/test_xi2.c b/src/test_xi2.c
index 3c3fee3..619a6b2 100644
--- a/src/test_xi2.c
+++ b/src/test_xi2.c
@@ -48,7 +48,17 @@ static void print_deviceevent(XIDeviceEvent* event)
 
     printf("    device: %d (%d)\n", event->deviceid, event->sourceid);
     printf("    detail: %d\n", event->detail);
-    printf("    flags: %s\n", (event->flags & XIKeyRepeat) ? "repeat" : "");
+    switch(event->evtype) {
+        case XI_KeyPress:
+        case XI_KeyRelease:
+            printf("    flags: %s\n", (event->flags & XIKeyRepeat) ?  "repeat" : "");
+            break;
+        case XI_ButtonPress:
+        case XI_ButtonRelease:
+        case XI_Motion:
+            printf("    flags: %s\n", (event->flags & XIPointerEmulated) ?  "emulated" : "");
+            break;
+    }
 
     printf("    root: %.2f/%.2f\n", event->root_x, event->root_y);
     printf("    event: %.2f/%.2f\n", event->event_x, event->event_y);
-- 
1.7.6



More information about the xorg-devel mailing list