[PATCH libinput 1/3] tools: print the device group in event-debug

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 9 22:50:53 PST 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 tools/event-debug.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/event-debug.c b/tools/event-debug.c
index 297e47d..38a6e82 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -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;
 
-	printf("%-33s %5s %7s",
+	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 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,
-- 
2.1.0



More information about the wayland-devel mailing list