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>
This commit is contained in:
Peter Hutterer 2015-12-14 07:39:26 +10:00
parent 77c1c75a64
commit 67e0b232a0

View file

@ -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;