mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-31 03:00:08 +01:00
tools/debug-events: rework touch event printing
Previously, touch up events did not contain the slot number which makes the logs ambiguous (e.g. see the one in #532). Fix that, and since doing so would require extra conditions anyway get rid of the current with/without coords function and just handle it all inside one function instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
08999899cb
commit
1ebdc60576
1 changed files with 20 additions and 28 deletions
|
|
@ -520,15 +520,6 @@ print_tablet_axis_event(struct libinput_event *ev)
|
|||
printq("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_touch_event_without_coords(struct libinput_event *ev)
|
||||
{
|
||||
struct libinput_event_touch *t = libinput_event_get_touch_event(ev);
|
||||
|
||||
print_event_time(libinput_event_touch_get_time(t));
|
||||
printq("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_proximity_event(struct libinput_event *ev)
|
||||
{
|
||||
|
|
@ -629,21 +620,30 @@ print_proximity_event(struct libinput_event *ev)
|
|||
}
|
||||
|
||||
static void
|
||||
print_touch_event_with_coords(struct libinput_event *ev)
|
||||
print_touch_event(struct libinput_event *ev)
|
||||
{
|
||||
struct libinput_event_touch *t = libinput_event_get_touch_event(ev);
|
||||
double x = libinput_event_touch_get_x_transformed(t, screen_width);
|
||||
double y = libinput_event_touch_get_y_transformed(t, screen_height);
|
||||
double xmm = libinput_event_touch_get_x(t);
|
||||
double ymm = libinput_event_touch_get_y(t);
|
||||
enum libinput_event_type type = libinput_event_get_type(ev);
|
||||
|
||||
print_event_time(libinput_event_touch_get_time(t));
|
||||
|
||||
printq("%d (%d) %5.2f/%5.2f (%5.2f/%5.2fmm)\n",
|
||||
libinput_event_touch_get_slot(t),
|
||||
libinput_event_touch_get_seat_slot(t),
|
||||
x, y,
|
||||
xmm, ymm);
|
||||
if (type != LIBINPUT_EVENT_TOUCH_FRAME) {
|
||||
printq("%d (%d)",
|
||||
libinput_event_touch_get_slot(t),
|
||||
libinput_event_touch_get_seat_slot(t));
|
||||
}
|
||||
|
||||
if (type == LIBINPUT_EVENT_TOUCH_DOWN ||
|
||||
type == LIBINPUT_EVENT_TOUCH_MOTION) {
|
||||
double x = libinput_event_touch_get_x_transformed(t, screen_width);
|
||||
double y = libinput_event_touch_get_y_transformed(t, screen_height);
|
||||
double xmm = libinput_event_touch_get_x(t);
|
||||
double ymm = libinput_event_touch_get_y(t);
|
||||
|
||||
printq(" %5.2f/%5.2f (%5.2f/%5.2fmm)", x, y, xmm, ymm);
|
||||
}
|
||||
|
||||
printq("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -855,19 +855,11 @@ handle_and_print_events(struct libinput *li)
|
|||
print_pointer_axis_event(ev);
|
||||
break;
|
||||
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_event_without_coords(ev);
|
||||
print_touch_event(ev);
|
||||
break;
|
||||
case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN:
|
||||
print_gesture_event_without_coords(ev);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue