[PATCH libinput 10/23] tools: handle tablet button events in event-debug

Stephen Chandler Paul thatslyude at gmail.com
Thu Jun 12 20:28:31 PDT 2014


Signed-off-by: Stephen Chandler Paul <thatslyude at gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 tools/event-debug.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/tools/event-debug.c b/tools/event-debug.c
index 90cdd64..13b86a4 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -224,6 +224,9 @@ print_event_header(struct libinput_event *ev)
 	case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
 		type = "TABLET_PROXIMITY_OUT";
 		break;
+	case LIBINPUT_EVENT_TABLET_BUTTON:
+		type = "TABLET_BUTTON";
+		break;
 	}
 
 	printf("%-7s	%s	", libinput_device_get_sysname(dev), type);
@@ -285,7 +288,7 @@ print_absmotion_event(struct libinput_event *ev)
 }
 
 static void
-print_button_event(struct libinput_event *ev)
+print_pointer_button_event(struct libinput_event *ev)
 {
 	struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev);
 	enum libinput_button_state state;
@@ -300,6 +303,21 @@ print_button_event(struct libinput_event *ev)
 }
 
 static void
+print_tablet_button_event(struct libinput_event *ev)
+{
+	struct libinput_event_tablet *p = libinput_event_get_tablet_event(ev);
+	enum libinput_button_state state;
+
+	print_event_time(libinput_event_tablet_get_time(p));
+
+	state = libinput_event_tablet_get_button_state(p);
+	printf("%3d %s, seat count: %u\n",
+	       libinput_event_tablet_get_button(p),
+	       state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released",
+	       libinput_event_tablet_get_seat_button_count(p));
+}
+
+static void
 print_pointer_axis_event(struct libinput_event *ev)
 {
 	struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev);
@@ -455,7 +473,7 @@ handle_and_print_events(struct libinput *li)
 			print_absmotion_event(ev);
 			break;
 		case LIBINPUT_EVENT_POINTER_BUTTON:
-			print_button_event(ev);
+			print_pointer_button_event(ev);
 			break;
 		case LIBINPUT_EVENT_POINTER_AXIS:
 			print_pointer_axis_event(ev);
@@ -484,6 +502,9 @@ handle_and_print_events(struct libinput *li)
 		case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
 			print_proximity_out_event(ev);
 			break;
+		case LIBINPUT_EVENT_TABLET_BUTTON:
+			print_tablet_button_event(ev);
+			break;
 		}
 
 		libinput_event_destroy(ev);
-- 
1.8.5.5



More information about the wayland-devel mailing list