Touch events

Events from absolute touch devices. More...

Data Structures

struct  libinput_event_touch
 

Functions

uint32_t libinput_event_touch_get_time (struct libinput_event_touch *event)
 
uint64_t libinput_event_touch_get_time_usec (struct libinput_event_touch *event)
 
int32_t libinput_event_touch_get_slot (struct libinput_event_touch *event)
 
int32_t libinput_event_touch_get_seat_slot (struct libinput_event_touch *event)
 
double libinput_event_touch_get_x (struct libinput_event_touch *event)
 
double libinput_event_touch_get_y (struct libinput_event_touch *event)
 
double libinput_event_touch_get_x_transformed (struct libinput_event_touch *event, uint32_t width)
 
double libinput_event_touch_get_y_transformed (struct libinput_event_touch *event, uint32_t height)
 
struct libinput_eventlibinput_event_touch_get_base_event (struct libinput_event_touch *event)
 

Detailed Description

Events from absolute touch devices.

Function Documentation

◆ libinput_event_touch_get_base_event()

struct libinput_event* libinput_event_touch_get_base_event ( struct libinput_event_touch event)
Returns
The generic libinput_event of this event

◆ libinput_event_touch_get_seat_slot()

int32_t libinput_event_touch_get_seat_slot ( struct libinput_event_touch event)

Get the seat slot of the touch event. A seat slot is a non-negative seat wide unique identifier of an active touch point.

Events from single touch devices will be represented as one individual touch point per device.

For events not of type LIBINPUT_EVENT_TOUCH_DOWN, LIBINPUT_EVENT_TOUCH_UP, LIBINPUT_EVENT_TOUCH_MOTION or LIBINPUT_EVENT_TOUCH_CANCEL, this function returns 0.

Note
It is an application bug to call this function for events of type other than LIBINPUT_EVENT_TOUCH_DOWN, LIBINPUT_EVENT_TOUCH_UP, LIBINPUT_EVENT_TOUCH_MOTION or LIBINPUT_EVENT_TOUCH_CANCEL.
Returns
The seat slot of the touch event

◆ libinput_event_touch_get_slot()

int32_t libinput_event_touch_get_slot ( struct libinput_event_touch event)

Get the slot of this touch event. See the kernel's multitouch protocol B documentation for more information.

If the touch event has no assigned slot, for example if it is from a single touch device, this function returns -1.

For events not of type LIBINPUT_EVENT_TOUCH_DOWN, LIBINPUT_EVENT_TOUCH_UP, LIBINPUT_EVENT_TOUCH_MOTION or LIBINPUT_EVENT_TOUCH_CANCEL, this function returns 0.

Note
It is an application bug to call this function for events of type other than LIBINPUT_EVENT_TOUCH_DOWN, LIBINPUT_EVENT_TOUCH_UP, LIBINPUT_EVENT_TOUCH_MOTION or LIBINPUT_EVENT_TOUCH_CANCEL.
Returns
The slot of this touch event

◆ libinput_event_touch_get_time()

uint32_t libinput_event_touch_get_time ( struct libinput_event_touch event)
Note
Timestamps may not always increase. See the libinput documentation for more details.
Returns
The event time for this event

◆ libinput_event_touch_get_time_usec()

uint64_t libinput_event_touch_get_time_usec ( struct libinput_event_touch event)
Note
Timestamps may not always increase. See the libinput documentation for more details.
Returns
The event time for this event in microseconds

◆ libinput_event_touch_get_x()

double libinput_event_touch_get_x ( struct libinput_event_touch event)

Return the current absolute x coordinate of the touch event, in mm from the top left corner of the device. To get the corresponding output screen coordinate, use libinput_event_touch_get_x_transformed().

For events not of type LIBINPUT_EVENT_TOUCH_DOWN, LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.

Note
It is an application bug to call this function for events of type other than LIBINPUT_EVENT_TOUCH_DOWN or LIBINPUT_EVENT_TOUCH_MOTION.
Parameters
eventThe libinput touch event
Returns
The current absolute x coordinate

◆ libinput_event_touch_get_x_transformed()

double libinput_event_touch_get_x_transformed ( struct libinput_event_touch event,
uint32_t  width 
)

Return the current absolute x coordinate of the touch event, transformed to screen coordinates.

For events not of type LIBINPUT_EVENT_TOUCH_DOWN, LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.

Note
It is an application bug to call this function for events of type other than LIBINPUT_EVENT_TOUCH_DOWN or LIBINPUT_EVENT_TOUCH_MOTION.
Parameters
eventThe libinput touch event
widthThe current output screen width
Returns
The current absolute x coordinate transformed to a screen coordinate

◆ libinput_event_touch_get_y()

double libinput_event_touch_get_y ( struct libinput_event_touch event)

Return the current absolute y coordinate of the touch event, in mm from the top left corner of the device. To get the corresponding output screen coordinate, use libinput_event_touch_get_y_transformed().

For events not of type LIBINPUT_EVENT_TOUCH_DOWN, LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.

Note
It is an application bug to call this function for events of type other than LIBINPUT_EVENT_TOUCH_DOWN or LIBINPUT_EVENT_TOUCH_MOTION.
Parameters
eventThe libinput touch event
Returns
The current absolute y coordinate

◆ libinput_event_touch_get_y_transformed()

double libinput_event_touch_get_y_transformed ( struct libinput_event_touch event,
uint32_t  height 
)

Return the current absolute y coordinate of the touch event, transformed to screen coordinates.

For events not of type LIBINPUT_EVENT_TOUCH_DOWN, LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.

Note
It is an application bug to call this function for events of type other than LIBINPUT_EVENT_TOUCH_DOWN or LIBINPUT_EVENT_TOUCH_MOTION.
Parameters
eventThe libinput touch event
heightThe current output screen height
Returns
The current absolute y coordinate transformed to a screen coordinate