diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2014-02-19 21:39:26 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2014-02-26 19:32:33 +0100 |
commit | 6f0ca1a3866afeda3b5eed101f497d1fc66131be (patch) | |
tree | 23e542f1f0cd43b8b0473aa8b7a7f616692b9d6a /tools | |
parent | e80cff7b0e18da0ac57662afb99e5ec396ab3786 (diff) | |
download | libinput-6f0ca1a3866afeda3b5eed101f497d1fc66131be.tar.gz |
Split up the touch event into the different touch types
Instead of having one touch events representing different types of touch
events by providing a touch type, have one separate event type per touch
type. This means the LIBINPUT_EVENT_TYPE_TOUCH is replaced with
LIBINPUT_EVENT_TYPE_TOUCH_DOWN, LIBINPUT_EVENT_TYPE_TOUCH_MOTION,
LIBINPUT_EVENT_TYPE_TOUCH_UP and LIBINPUT_EVENT_TYPE_TOUCH_CANCEL.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/event-debug.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/tools/event-debug.c b/tools/event-debug.c index 4eb5dd35..876f6f0f 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -199,8 +199,17 @@ print_event_header(struct libinput_event *ev) case LIBINPUT_EVENT_POINTER_AXIS: type = "POINTER_AXIS"; break; - case LIBINPUT_EVENT_TOUCH_TOUCH: - type = "TOUCH_TOUCH"; + case LIBINPUT_EVENT_TOUCH_DOWN: + type = "TOUCH_DOWN"; + break; + case LIBINPUT_EVENT_TOUCH_MOTION: + type = "TOUCH_MOTION"; + break; + case LIBINPUT_EVENT_TOUCH_UP: + type = "TOUCH_UP"; + break; + case LIBINPUT_EVENT_TOUCH_CANCEL: + type = "TOUCH_CANCEL"; break; case LIBINPUT_EVENT_TOUCH_FRAME: type = "TOUCH_FRAME"; @@ -309,7 +318,7 @@ print_axis_event(struct libinput_event *ev) } static void -print_touch_frame_event(struct libinput_event *ev) +print_touch_event_without_coords(struct libinput_event *ev) { struct libinput_event_touch *t = libinput_event_get_touch_event(ev); @@ -318,26 +327,15 @@ print_touch_frame_event(struct libinput_event *ev) } static void -print_touch_event(struct libinput_event *ev) +print_touch_event_with_coords(struct libinput_event *ev) { struct libinput_event_touch *t = libinput_event_get_touch_event(ev); li_fixed_t x = libinput_event_touch_get_x_transformed(t, screen_width), y = libinput_event_touch_get_y_transformed(t, screen_height); - const char *type; - - switch (libinput_event_touch_get_touch_type(t)) { - case LIBINPUT_TOUCH_TYPE_DOWN: type = "down"; break; - case LIBINPUT_TOUCH_TYPE_UP: type = "up"; break; - case LIBINPUT_TOUCH_TYPE_MOTION: type = "motion"; break; - case LIBINPUT_TOUCH_TYPE_CANCEL: type = "cancel"; break; - default: - abort(); - } print_event_time(libinput_event_touch_get_time(t)); - printf("%6s %d (%d) %5.2f/%5.2f\n", - type, + printf("%d (%d) %5.2f/%5.2f\n", libinput_event_touch_get_slot(t), libinput_event_touch_get_seat_slot(t), li_fixed_to_double(x), @@ -376,11 +374,20 @@ handle_and_print_events(struct libinput *li) case LIBINPUT_EVENT_POINTER_AXIS: print_axis_event(ev); break; - case LIBINPUT_EVENT_TOUCH_TOUCH: - print_touch_event(ev); + case LIBINPUT_EVENT_TOUCH_DOWN: + print_touch_event_with_coords(ev); + break; + case LIBINPUT_EVENT_TOUCH_MOTION: + print_touch_event_with_coords(ev); + break; + case LIBINPUT_EVENT_TOUCH_UP: + print_touch_event_without_coords(ev); + break; + case LIBINPUT_EVENT_TOUCH_CANCEL: + print_touch_event_without_coords(ev); break; case LIBINPUT_EVENT_TOUCH_FRAME: - print_touch_frame_event(ev); + print_touch_event_without_coords(ev); break; } |