tools: print the device group in event-debug
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 10 Feb 2015 04:59:05 +0000 (14:59 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 17 Feb 2015 23:47:41 +0000 (09:47 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
tools/event-debug.c

index 297e47d81ba0aa1df1c8f1dedeb2e390ae8a1676..38a6e8238a053d17a30ea9b74e4881eab061e254 100644 (file)
@@ -122,13 +122,24 @@ print_device_notify(struct libinput_event *ev)
 {
        struct libinput_device *dev = libinput_event_get_device(ev);
        struct libinput_seat *seat = libinput_device_get_seat(dev);
+       struct libinput_device_group *group;
        double w, h;
        uint32_t scroll_methods;
+       static int next_group_id = 0;
+       intptr_t group_id;
+
+       group = libinput_device_get_device_group(dev);
+       group_id = (intptr_t)libinput_device_group_get_user_data(group);
+       if (!group_id) {
+               group_id = ++next_group_id;
+               libinput_device_group_set_user_data(group, (void*)group_id);
+       }
 
-       printf("%-33s %5s %7s",
+       printf("%-33s %5s %7s group%d",
               libinput_device_get_name(dev),
               libinput_seat_get_physical_name(seat),
-              libinput_seat_get_logical_name(seat));
+              libinput_seat_get_logical_name(seat),
+              (int)group_id);
 
        printf(" cap:");
        if (libinput_device_has_capability(dev,