Gesture events are generated when a gesture is recognized on a touchpad. More...
Functions | |
uint32_t | libinput_event_gesture_get_time (struct libinput_event_gesture *event) |
uint64_t | libinput_event_gesture_get_time_usec (struct libinput_event_gesture *event) |
struct libinput_event * | libinput_event_gesture_get_base_event (struct libinput_event_gesture *event) |
int | libinput_event_gesture_get_finger_count (struct libinput_event_gesture *event) |
Return the number of fingers used for a gesture. More... | |
int | libinput_event_gesture_get_cancelled (struct libinput_event_gesture *event) |
Return if the gesture ended normally, or if it was cancelled. More... | |
double | libinput_event_gesture_get_dx (struct libinput_event_gesture *event) |
Return the delta between the last event and the current event. More... | |
double | libinput_event_gesture_get_dy (struct libinput_event_gesture *event) |
Return the delta between the last event and the current event. More... | |
double | libinput_event_gesture_get_dx_unaccelerated (struct libinput_event_gesture *event) |
Return the relative delta of the unaccelerated motion vector of the current event. More... | |
double | libinput_event_gesture_get_dy_unaccelerated (struct libinput_event_gesture *event) |
Return the relative delta of the unaccelerated motion vector of the current event. More... | |
double | libinput_event_gesture_get_scale (struct libinput_event_gesture *event) |
Return the absolute scale of a pinch gesture, the scale is the division of the current distance between the fingers and the distance at the start of the gesture. More... | |
double | libinput_event_gesture_get_angle_delta (struct libinput_event_gesture *event) |
Return the angle delta in degrees between the last and the current LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event. More... | |
Detailed Description
Gesture events are generated when a gesture is recognized on a touchpad.
Gesture sequences always start with a LIBINPUT_EVENT_GESTURE_FOO_START event. All following gesture events will be of the LIBINPUT_EVENT_GESTURE_FOO_UPDATE type until a LIBINPUT_EVENT_GESTURE_FOO_END is generated which signals the end of the gesture.
See the libinput documentation for details on gesture handling.
Function Documentation
◆ libinput_event_gesture_get_angle_delta()
double libinput_event_gesture_get_angle_delta | ( | struct libinput_event_gesture * | event | ) |
Return the angle delta in degrees between the last and the current LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event.
For gesture events that are not of type LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
The angle delta is defined as the change in angle of the line formed by the 2 fingers of a pinch gesture. Clockwise rotation is represented by a positive delta, counter-clockwise by a negative delta. If e.g. the fingers are on the 12 and 6 location of a clock face plate and they move to the 1 resp. 7 location in a single event then the angle delta is 30 degrees.
If more than two fingers are present, the angle represents the rotation around the center of gravity. The calculation of the center of gravity is implementation-dependent.
- Returns
- the angle delta since the last event
◆ libinput_event_gesture_get_base_event()
struct libinput_event * libinput_event_gesture_get_base_event | ( | struct libinput_event_gesture * | event | ) |
- Returns
- The generic libinput_event of this event
◆ libinput_event_gesture_get_cancelled()
int libinput_event_gesture_get_cancelled | ( | struct libinput_event_gesture * | event | ) |
Return if the gesture ended normally, or if it was cancelled.
For gesture events that are not of type LIBINPUT_EVENT_GESTURE_SWIPE_END or LIBINPUT_EVENT_GESTURE_PINCH_END, this function returns 0.
- Note
- It is an application bug to call this function for events other than LIBINPUT_EVENT_GESTURE_SWIPE_END or LIBINPUT_EVENT_GESTURE_PINCH_END.
- Returns
- 0 or 1, with 1 indicating that the gesture was cancelled.
◆ libinput_event_gesture_get_dx()
double libinput_event_gesture_get_dx | ( | struct libinput_event_gesture * | event | ) |
Return the delta between the last event and the current event.
For gesture events that are not of type LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
If a device employs pointer acceleration, the delta returned by this function is the accelerated delta.
Relative motion deltas are normalized to represent those of a device with 1000dpi resolution. See the libinput documentation for more details.
- Returns
- the relative x movement since the last event
◆ libinput_event_gesture_get_dx_unaccelerated()
double libinput_event_gesture_get_dx_unaccelerated | ( | struct libinput_event_gesture * | event | ) |
Return the relative delta of the unaccelerated motion vector of the current event.
For gesture events that are not of type LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
Relative unaccelerated motion deltas are normalized to represent those of a device with 1000dpi resolution. See the libinput documentation for more details. Note that unaccelerated events are not equivalent to 'raw' events as read from the device.
Any rotation applied to the device also applies to gesture motion (see libinput_device_config_rotation_set_angle()).
- Returns
- the unaccelerated relative x movement since the last event
◆ libinput_event_gesture_get_dy()
double libinput_event_gesture_get_dy | ( | struct libinput_event_gesture * | event | ) |
Return the delta between the last event and the current event.
For gesture events that are not of type LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
If a device employs pointer acceleration, the delta returned by this function is the accelerated delta.
Relative motion deltas are normalized to represent those of a device with 1000dpi resolution. See the libinput documentation for more details.
- Returns
- the relative y movement since the last event
◆ libinput_event_gesture_get_dy_unaccelerated()
double libinput_event_gesture_get_dy_unaccelerated | ( | struct libinput_event_gesture * | event | ) |
Return the relative delta of the unaccelerated motion vector of the current event.
For gesture events that are not of type LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this function returns 0.
Relative unaccelerated motion deltas are normalized to represent those of a device with 1000dpi resolution. See the libinput documentation for more details. Note that unaccelerated events are not equivalent to 'raw' events as read from the device.
Any rotation applied to the device also applies to gesture motion (see libinput_device_config_rotation_set_angle()).
- Returns
- the unaccelerated relative y movement since the last event
◆ libinput_event_gesture_get_finger_count()
int libinput_event_gesture_get_finger_count | ( | struct libinput_event_gesture * | event | ) |
Return the number of fingers used for a gesture.
This can be used e.g. to differentiate between 3 or 4 finger swipes.
This function can be called on all gesture events and the returned finger count value remains the same for the lifetime of a gesture. Thus, if a user puts down a fourth finger during a three-finger swipe gesture, libinput will end the three-finger gesture and, if applicable, start a four-finger swipe gesture. A caller may decide that those gestures are semantically identical and continue the two gestures as one single gesture.
- Returns
- the number of fingers used for a gesture
◆ libinput_event_gesture_get_scale()
double libinput_event_gesture_get_scale | ( | struct libinput_event_gesture * | event | ) |
Return the absolute scale of a pinch gesture, the scale is the division of the current distance between the fingers and the distance at the start of the gesture.
The scale begins at 1.0, and if e.g. the fingers moved together by 50% then the scale will become 0.5, if they move twice as far apart as initially the scale becomes 2.0, etc.
For gesture events that are of type LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, this function returns 1.0.
For gesture events that are of type LIBINPUT_EVENT_GESTURE_PINCH_END, this function returns the scale value of the most recent LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event (if any) or 1.0 otherwise.
For all other events this function returns 0.
- Note
- It is an application bug to call this function for events other than LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, LIBINPUT_EVENT_GESTURE_PINCH_END or LIBINPUT_EVENT_GESTURE_PINCH_UPDATE.
- Returns
- the absolute scale of a pinch gesture
◆ libinput_event_gesture_get_time()
uint32_t libinput_event_gesture_get_time | ( | struct libinput_event_gesture * | event | ) |
- Note
- Timestamps may not always increase. See the libinput documentation for more details.
- Returns
- The event time for this event
◆ libinput_event_gesture_get_time_usec()
uint64_t libinput_event_gesture_get_time_usec | ( | struct libinput_event_gesture * | event | ) |
- Note
- Timestamps may not always increase. See the libinput documentation for more details.
- Returns
- The event time for this event in microseconds