diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2015-12-14 07:39:26 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2015-12-23 09:59:35 +1000 |
commit | 67e0b232a037572b83a5c752a258fdbd9003d0b3 (patch) | |
tree | 4fdffba991070e1d2eefa4b3c5e9c6a699799e78 /src/libinput.c | |
parent | 77c1c75a6466a03e00faa1e614214c7b7ae8fc49 (diff) |
Add event debugging to libinput_post_event
Print the type of event when it is queued up internally. This makes it a lot
easier to associate evdev events with the libinput event queued up and does
not depend on the caller calling libinput_dispatch().
Since this should only be used during development, hide it behind an if 0.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/libinput.c')
-rw-r--r-- | src/libinput.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/libinput.c b/src/libinput.c index 082c1b0..b3fca6c 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -2369,6 +2369,39 @@ gesture_notify_pinch_end(struct libinput_device *device, 2, cancelled, &zero, &zero, scale, 0.0); } +static inline const char * +event_type_to_str(enum libinput_event_type type) +{ + switch(type) { + CASE_RETURN_STRING(LIBINPUT_EVENT_DEVICE_ADDED); + CASE_RETURN_STRING(LIBINPUT_EVENT_DEVICE_REMOVED); + CASE_RETURN_STRING(LIBINPUT_EVENT_KEYBOARD_KEY); + CASE_RETURN_STRING(LIBINPUT_EVENT_POINTER_MOTION); + CASE_RETURN_STRING(LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE); + CASE_RETURN_STRING(LIBINPUT_EVENT_POINTER_BUTTON); + CASE_RETURN_STRING(LIBINPUT_EVENT_POINTER_AXIS); + CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_DOWN); + CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_UP); + CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_MOTION); + CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_CANCEL); + CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_FRAME); + CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_TOOL_AXIS); + CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_TOOL_TIP); + CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_TOOL_BUTTON); + CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN); + CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE); + CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_SWIPE_END); + CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_PINCH_BEGIN); + CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_PINCH_UPDATE); + CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_PINCH_END); + case LIBINPUT_EVENT_NONE: + abort(); + } + + return NULL; +} + static void libinput_post_event(struct libinput *libinput, struct libinput_event *event) @@ -2379,6 +2412,10 @@ libinput_post_event(struct libinput *libinput, size_t move_len; size_t new_out; +#if 0 + log_debug(libinput, "Queuing %s\n", event_type_to_str(event->type)); +#endif + events_count++; if (events_count > events_len) { events_len *= 2; |