mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-01 05:50:09 +01:00
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>
This commit is contained in:
parent
e80cff7b0e
commit
6f0ca1a386
6 changed files with 159 additions and 128 deletions
62
src/evdev.c
62
src/evdev.c
|
|
@ -109,6 +109,7 @@ static void
|
|||
evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
|
||||
{
|
||||
int32_t cx, cy;
|
||||
li_fixed_t x, y;
|
||||
int slot;
|
||||
int seat_slot;
|
||||
struct libinput_device *base = &device->base;
|
||||
|
|
@ -138,31 +139,23 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
|
|||
break;
|
||||
|
||||
seat->slot_map |= 1 << seat_slot;
|
||||
x = li_fixed_from_int(device->mt.slots[slot].x);
|
||||
y = li_fixed_from_int(device->mt.slots[slot].y);
|
||||
|
||||
touch_notify_touch(base,
|
||||
time,
|
||||
slot,
|
||||
seat_slot,
|
||||
li_fixed_from_int(device->mt.slots[slot].x),
|
||||
li_fixed_from_int(device->mt.slots[slot].y),
|
||||
LIBINPUT_TOUCH_TYPE_DOWN);
|
||||
touch_notify_touch_down(base, time, slot, seat_slot, x, y);
|
||||
break;
|
||||
case EVDEV_ABSOLUTE_MT_MOTION:
|
||||
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
|
||||
break;
|
||||
|
||||
seat_slot = device->mt.slots[slot].seat_slot;
|
||||
x = li_fixed_from_int(device->mt.slots[slot].x);
|
||||
y = li_fixed_from_int(device->mt.slots[slot].y);
|
||||
|
||||
if (seat_slot == -1)
|
||||
break;
|
||||
|
||||
touch_notify_touch(base,
|
||||
time,
|
||||
slot,
|
||||
seat_slot,
|
||||
li_fixed_from_int(device->mt.slots[slot].x),
|
||||
li_fixed_from_int(device->mt.slots[slot].y),
|
||||
LIBINPUT_TOUCH_TYPE_MOTION);
|
||||
touch_notify_touch_motion(base, time, slot, seat_slot, x, y);
|
||||
break;
|
||||
case EVDEV_ABSOLUTE_MT_UP:
|
||||
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
|
||||
|
|
@ -175,12 +168,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
|
|||
|
||||
seat->slot_map &= ~(1 << seat_slot);
|
||||
|
||||
touch_notify_touch(base,
|
||||
time,
|
||||
slot,
|
||||
seat_slot,
|
||||
0, 0,
|
||||
LIBINPUT_TOUCH_TYPE_UP);
|
||||
touch_notify_touch_up(base, time, slot, seat_slot);
|
||||
break;
|
||||
case EVDEV_ABSOLUTE_TOUCH_DOWN:
|
||||
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
|
||||
|
|
@ -195,34 +183,25 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
|
|||
seat->slot_map |= 1 << seat_slot;
|
||||
|
||||
transform_absolute(device, &cx, &cy);
|
||||
touch_notify_touch(base,
|
||||
time,
|
||||
-1,
|
||||
seat_slot,
|
||||
li_fixed_from_int(cx),
|
||||
li_fixed_from_int(cy),
|
||||
LIBINPUT_TOUCH_TYPE_DOWN);
|
||||
x = li_fixed_from_int(cx);
|
||||
y = li_fixed_from_int(cy);
|
||||
|
||||
touch_notify_touch_down(base, time, -1, seat_slot, x, y);
|
||||
break;
|
||||
case EVDEV_ABSOLUTE_MOTION:
|
||||
transform_absolute(device, &cx, &cy);
|
||||
x = li_fixed_from_int(cx);
|
||||
y = li_fixed_from_int(cy);
|
||||
|
||||
if (device->seat_caps & EVDEV_DEVICE_TOUCH) {
|
||||
seat_slot = device->abs.seat_slot;
|
||||
|
||||
if (seat_slot == -1)
|
||||
break;
|
||||
|
||||
touch_notify_touch(base,
|
||||
time,
|
||||
-1,
|
||||
seat_slot,
|
||||
li_fixed_from_int(cx),
|
||||
li_fixed_from_int(cy),
|
||||
LIBINPUT_TOUCH_TYPE_DOWN);
|
||||
touch_notify_touch_motion(base, time, -1, seat_slot, x, y);
|
||||
} else if (device->seat_caps & EVDEV_DEVICE_POINTER) {
|
||||
pointer_notify_motion_absolute(base,
|
||||
time,
|
||||
li_fixed_from_int(cx),
|
||||
li_fixed_from_int(cy));
|
||||
pointer_notify_motion_absolute(base, time, x, y);
|
||||
}
|
||||
break;
|
||||
case EVDEV_ABSOLUTE_TOUCH_UP:
|
||||
|
|
@ -236,12 +215,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
|
|||
|
||||
seat->slot_map &= ~(1 << seat_slot);
|
||||
|
||||
touch_notify_touch(base,
|
||||
time,
|
||||
-1,
|
||||
seat_slot,
|
||||
0, 0,
|
||||
LIBINPUT_TOUCH_TYPE_UP);
|
||||
touch_notify_touch_up(base, time, -1, seat_slot);
|
||||
break;
|
||||
default:
|
||||
assert(0 && "Unknown pending event type");
|
||||
|
|
|
|||
|
|
@ -153,13 +153,26 @@ pointer_notify_axis(struct libinput_device *device,
|
|||
li_fixed_t value);
|
||||
|
||||
void
|
||||
touch_notify_touch(struct libinput_device *device,
|
||||
uint32_t time,
|
||||
int32_t slot,
|
||||
int32_t seat_slot,
|
||||
li_fixed_t x,
|
||||
li_fixed_t y,
|
||||
enum libinput_touch_type touch_type);
|
||||
touch_notify_touch_down(struct libinput_device *device,
|
||||
uint32_t time,
|
||||
int32_t slot,
|
||||
int32_t seat_slot,
|
||||
li_fixed_t x,
|
||||
li_fixed_t y);
|
||||
|
||||
void
|
||||
touch_notify_touch_motion(struct libinput_device *device,
|
||||
uint32_t time,
|
||||
int32_t slot,
|
||||
int32_t seat_slot,
|
||||
li_fixed_t x,
|
||||
li_fixed_t y);
|
||||
|
||||
void
|
||||
touch_notify_touch_up(struct libinput_device *device,
|
||||
uint32_t time,
|
||||
int32_t slot,
|
||||
int32_t seat_slot);
|
||||
|
||||
void
|
||||
touch_notify_frame(struct libinput_device *device,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ struct libinput_event_touch {
|
|||
int32_t seat_slot;
|
||||
li_fixed_t x;
|
||||
li_fixed_t y;
|
||||
enum libinput_touch_type touch_type;
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -177,7 +176,10 @@ libinput_event_get_pointer_event(struct libinput_event *event)
|
|||
case LIBINPUT_EVENT_POINTER_BUTTON:
|
||||
case LIBINPUT_EVENT_POINTER_AXIS:
|
||||
return (struct libinput_event_pointer *) event;
|
||||
case LIBINPUT_EVENT_TOUCH_TOUCH:
|
||||
case LIBINPUT_EVENT_TOUCH_DOWN:
|
||||
case LIBINPUT_EVENT_TOUCH_UP:
|
||||
case LIBINPUT_EVENT_TOUCH_MOTION:
|
||||
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
||||
case LIBINPUT_EVENT_TOUCH_FRAME:
|
||||
break;
|
||||
}
|
||||
|
|
@ -200,7 +202,10 @@ libinput_event_get_keyboard_event(struct libinput_event *event)
|
|||
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case LIBINPUT_EVENT_POINTER_BUTTON:
|
||||
case LIBINPUT_EVENT_POINTER_AXIS:
|
||||
case LIBINPUT_EVENT_TOUCH_TOUCH:
|
||||
case LIBINPUT_EVENT_TOUCH_DOWN:
|
||||
case LIBINPUT_EVENT_TOUCH_UP:
|
||||
case LIBINPUT_EVENT_TOUCH_MOTION:
|
||||
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
||||
case LIBINPUT_EVENT_TOUCH_FRAME:
|
||||
break;
|
||||
}
|
||||
|
|
@ -222,7 +227,10 @@ libinput_event_get_touch_event(struct libinput_event *event)
|
|||
case LIBINPUT_EVENT_POINTER_BUTTON:
|
||||
case LIBINPUT_EVENT_POINTER_AXIS:
|
||||
break;
|
||||
case LIBINPUT_EVENT_TOUCH_TOUCH:
|
||||
case LIBINPUT_EVENT_TOUCH_DOWN:
|
||||
case LIBINPUT_EVENT_TOUCH_UP:
|
||||
case LIBINPUT_EVENT_TOUCH_MOTION:
|
||||
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
||||
case LIBINPUT_EVENT_TOUCH_FRAME:
|
||||
return (struct libinput_event_touch *) event;
|
||||
}
|
||||
|
|
@ -244,7 +252,10 @@ libinput_event_get_device_notify_event(struct libinput_event *event)
|
|||
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case LIBINPUT_EVENT_POINTER_BUTTON:
|
||||
case LIBINPUT_EVENT_POINTER_AXIS:
|
||||
case LIBINPUT_EVENT_TOUCH_TOUCH:
|
||||
case LIBINPUT_EVENT_TOUCH_DOWN:
|
||||
case LIBINPUT_EVENT_TOUCH_UP:
|
||||
case LIBINPUT_EVENT_TOUCH_MOTION:
|
||||
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
||||
case LIBINPUT_EVENT_TOUCH_FRAME:
|
||||
break;
|
||||
}
|
||||
|
|
@ -396,12 +407,6 @@ libinput_event_touch_get_y(struct libinput_event_touch *event)
|
|||
return event->y;
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT enum libinput_touch_type
|
||||
libinput_event_touch_get_touch_type(struct libinput_event_touch *event)
|
||||
{
|
||||
return event->touch_type;
|
||||
}
|
||||
|
||||
struct libinput_source *
|
||||
libinput_add_fd(struct libinput *libinput,
|
||||
int fd,
|
||||
|
|
@ -840,13 +845,12 @@ pointer_notify_axis(struct libinput_device *device,
|
|||
}
|
||||
|
||||
void
|
||||
touch_notify_touch(struct libinput_device *device,
|
||||
uint32_t time,
|
||||
int32_t slot,
|
||||
int32_t seat_slot,
|
||||
li_fixed_t x,
|
||||
li_fixed_t y,
|
||||
enum libinput_touch_type touch_type)
|
||||
touch_notify_touch_down(struct libinput_device *device,
|
||||
uint32_t time,
|
||||
int32_t slot,
|
||||
int32_t seat_slot,
|
||||
li_fixed_t x,
|
||||
li_fixed_t y)
|
||||
{
|
||||
struct libinput_event_touch *touch_event;
|
||||
|
||||
|
|
@ -860,11 +864,60 @@ touch_notify_touch(struct libinput_device *device,
|
|||
.seat_slot = seat_slot,
|
||||
.x = x,
|
||||
.y = y,
|
||||
.touch_type = touch_type,
|
||||
};
|
||||
|
||||
post_device_event(device,
|
||||
LIBINPUT_EVENT_TOUCH_TOUCH,
|
||||
LIBINPUT_EVENT_TOUCH_DOWN,
|
||||
&touch_event->base);
|
||||
}
|
||||
|
||||
void
|
||||
touch_notify_touch_motion(struct libinput_device *device,
|
||||
uint32_t time,
|
||||
int32_t slot,
|
||||
int32_t seat_slot,
|
||||
li_fixed_t x,
|
||||
li_fixed_t y)
|
||||
{
|
||||
struct libinput_event_touch *touch_event;
|
||||
|
||||
touch_event = zalloc(sizeof *touch_event);
|
||||
if (!touch_event)
|
||||
return;
|
||||
|
||||
*touch_event = (struct libinput_event_touch) {
|
||||
.time = time,
|
||||
.slot = slot,
|
||||
.seat_slot = seat_slot,
|
||||
.x = x,
|
||||
.y = y,
|
||||
};
|
||||
|
||||
post_device_event(device,
|
||||
LIBINPUT_EVENT_TOUCH_MOTION,
|
||||
&touch_event->base);
|
||||
}
|
||||
|
||||
void
|
||||
touch_notify_touch_up(struct libinput_device *device,
|
||||
uint32_t time,
|
||||
int32_t slot,
|
||||
int32_t seat_slot)
|
||||
{
|
||||
struct libinput_event_touch *touch_event;
|
||||
|
||||
touch_event = zalloc(sizeof *touch_event);
|
||||
if (!touch_event)
|
||||
return;
|
||||
|
||||
*touch_event = (struct libinput_event_touch) {
|
||||
.time = time,
|
||||
.slot = slot,
|
||||
.seat_slot = seat_slot,
|
||||
};
|
||||
|
||||
post_device_event(device,
|
||||
LIBINPUT_EVENT_TOUCH_UP,
|
||||
&touch_event->base);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,21 +107,6 @@ enum libinput_pointer_axis {
|
|||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
*
|
||||
* Logical touch state of a touch point. A touch point usually follows the
|
||||
* sequence down, motion, up, with the number of motion events being zero or
|
||||
* greater. If a touch point was used for gesture interpretation internally
|
||||
* and will not generate any further events, the touchpoint is cancelled.
|
||||
*/
|
||||
enum libinput_touch_type {
|
||||
LIBINPUT_TOUCH_TYPE_DOWN = 0,
|
||||
LIBINPUT_TOUCH_TYPE_UP = 1,
|
||||
LIBINPUT_TOUCH_TYPE_MOTION = 2,
|
||||
LIBINPUT_TOUCH_TYPE_CANCEL = 4
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup base
|
||||
*
|
||||
|
|
@ -158,7 +143,10 @@ enum libinput_event_type {
|
|||
LIBINPUT_EVENT_POINTER_BUTTON,
|
||||
LIBINPUT_EVENT_POINTER_AXIS,
|
||||
|
||||
LIBINPUT_EVENT_TOUCH_TOUCH = 500,
|
||||
LIBINPUT_EVENT_TOUCH_DOWN = 500,
|
||||
LIBINPUT_EVENT_TOUCH_UP,
|
||||
LIBINPUT_EVENT_TOUCH_MOTION,
|
||||
LIBINPUT_EVENT_TOUCH_CANCEL,
|
||||
/**
|
||||
* Signals the end of a set of touchpoints at one device sample
|
||||
* time. This event has no coordinate information attached.
|
||||
|
|
@ -181,7 +169,9 @@ struct libinput_event_pointer;
|
|||
*
|
||||
* Touch event representing a touch down, move or up, as well as a touch
|
||||
* cancel and touch frame events. Valid event types for this event are @ref
|
||||
* LIBINPUT_EVENT_TOUCH_TOUCH and @ref LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
* LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_MOTION, @ref
|
||||
* LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_CANCEL and @ref
|
||||
* LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
*/
|
||||
struct libinput_event_touch;
|
||||
|
||||
|
|
@ -570,7 +560,8 @@ libinput_event_touch_get_time(struct libinput_event_touch *event);
|
|||
* If the touch event has no assigned slot, for example if it is from a
|
||||
* single touch device, this function returns -1.
|
||||
*
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_CANCEL or
|
||||
* LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
*
|
||||
* @return The slot of this touch event
|
||||
*/
|
||||
|
|
@ -586,7 +577,8 @@ libinput_event_touch_get_slot(struct libinput_event_touch *event);
|
|||
* Events from single touch devices will be represented as one individual
|
||||
* touch point per device.
|
||||
*
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_CANCEL or
|
||||
* LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
*
|
||||
* @return The seat slot of the touch event
|
||||
*/
|
||||
|
|
@ -602,7 +594,8 @@ libinput_event_touch_get_seat_slot(struct libinput_event_touch *event);
|
|||
* corresponding output screen coordinate, use
|
||||
* libinput_event_touch_get_x_transformed().
|
||||
*
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
|
||||
* LIBINPUT_EVENT_TOUCH_MOTION.
|
||||
*
|
||||
* @param event The libinput touch event
|
||||
* @return the current absolute x coordinate
|
||||
|
|
@ -619,7 +612,10 @@ libinput_event_touch_get_x(struct libinput_event_touch *event);
|
|||
* corresponding output screen coordinate, use
|
||||
* libinput_event_touch_get_y_transformed().
|
||||
*
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
* For LIBINPUT_EVENT_TOUCH_UP 0 is returned.
|
||||
*
|
||||
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
|
||||
* LIBINPUT_EVENT_TOUCH_MOTION.
|
||||
*
|
||||
* @param event The libinput touch event
|
||||
* @return the current absolute y coordinate
|
||||
|
|
@ -633,7 +629,8 @@ libinput_event_touch_get_y(struct libinput_event_touch *event);
|
|||
* Return the current absolute x coordinate of the touch event, transformed to
|
||||
* screen coordinates.
|
||||
*
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
|
||||
* LIBINPUT_EVENT_TOUCH_MOTION.
|
||||
*
|
||||
* @param event The libinput touch event
|
||||
* @param width The current output screen width
|
||||
|
|
@ -649,7 +646,8 @@ libinput_event_touch_get_x_transformed(struct libinput_event_touch *event,
|
|||
* Return the current absolute y coordinate of the touch event, transformed to
|
||||
* screen coordinates.
|
||||
*
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
|
||||
* LIBINPUT_EVENT_TOUCH_MOTION.
|
||||
*
|
||||
* @param event The libinput touch event
|
||||
* @param height The current output screen height
|
||||
|
|
@ -659,16 +657,6 @@ li_fixed_t
|
|||
libinput_event_touch_get_y_transformed(struct libinput_event_touch *event,
|
||||
uint32_t height);
|
||||
|
||||
/**
|
||||
* @ingroup event_touch
|
||||
*
|
||||
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
|
||||
*
|
||||
* @return the type of touch that occured on the device
|
||||
*/
|
||||
enum libinput_touch_type
|
||||
libinput_event_touch_get_touch_type(struct libinput_event_touch *event);
|
||||
|
||||
/**
|
||||
* @defgroup base Initialization and manipulation of libinput contexts
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -76,14 +76,10 @@ START_TEST(touch_abs_transform)
|
|||
libinput_dispatch(libinput);
|
||||
|
||||
while ((ev = libinput_get_event(libinput))) {
|
||||
if (libinput_event_get_type(ev) != LIBINPUT_EVENT_TOUCH_TOUCH)
|
||||
if (libinput_event_get_type(ev) != LIBINPUT_EVENT_TOUCH_DOWN)
|
||||
continue;
|
||||
|
||||
tev = libinput_event_get_touch_event(ev);
|
||||
if (libinput_event_touch_get_touch_type(tev) !=
|
||||
LIBINPUT_TOUCH_TYPE_DOWN)
|
||||
continue;
|
||||
|
||||
fx = libinput_event_touch_get_x_transformed(tev, 1920);
|
||||
ck_assert_int_eq(li_fixed_to_int(fx), 1919);
|
||||
fy = libinput_event_touch_get_y_transformed(tev, 720);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue