mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-05 02:00:15 +01:00
gestures: allow any gesture event type for gesture_get_dx/dy and get_angle
For start/end, dx/dy is always 0.0, and there is no need to make calling this function for start/end a caller bug. It just unnecessarily complicates the caller's codepath. Same for get_angle Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
9b938d6591
commit
a29155c9cb
2 changed files with 23 additions and 24 deletions
|
|
@ -714,8 +714,12 @@ libinput_event_gesture_get_dx(struct libinput_event_gesture *event)
|
|||
require_event_type(libinput_event_get_context(&event->base),
|
||||
event->base.type,
|
||||
0.0,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE);
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_END,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_END);
|
||||
|
||||
return event->delta.x;
|
||||
}
|
||||
|
|
@ -726,8 +730,12 @@ libinput_event_gesture_get_dy(struct libinput_event_gesture *event)
|
|||
require_event_type(libinput_event_get_context(&event->base),
|
||||
event->base.type,
|
||||
0.0,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE);
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_END,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_END);
|
||||
|
||||
return event->delta.y;
|
||||
}
|
||||
|
|
@ -739,8 +747,12 @@ libinput_event_gesture_get_dx_unaccelerated(
|
|||
require_event_type(libinput_event_get_context(&event->base),
|
||||
event->base.type,
|
||||
0.0,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE);
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_END,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_END);
|
||||
|
||||
return event->delta_unaccel.x;
|
||||
}
|
||||
|
|
@ -752,8 +764,12 @@ libinput_event_gesture_get_dy_unaccelerated(
|
|||
require_event_type(libinput_event_get_context(&event->base),
|
||||
event->base.type,
|
||||
0.0,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE);
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_END,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_SWIPE_END);
|
||||
|
||||
return event->delta_unaccel.y;
|
||||
}
|
||||
|
|
@ -777,7 +793,9 @@ libinput_event_gesture_get_angle_delta(struct libinput_event_gesture *event)
|
|||
require_event_type(libinput_event_get_context(&event->base),
|
||||
event->base.type,
|
||||
0.0,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE);
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
||||
LIBINPUT_EVENT_GESTURE_PINCH_END);
|
||||
|
||||
return event->angle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1017,10 +1017,6 @@ libinput_event_gesture_get_cancelled(struct libinput_event_gesture *event);
|
|||
* Relative motion deltas are normalized to represent those of a device with
|
||||
* 1000dpi resolution. See @ref motion_normalization for more details.
|
||||
*
|
||||
* @note It is an application bug to call this function for events other than
|
||||
* @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or
|
||||
* @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE.
|
||||
*
|
||||
* @return the relative x movement since the last event
|
||||
*/
|
||||
double
|
||||
|
|
@ -1039,10 +1035,6 @@ libinput_event_gesture_get_dx(struct libinput_event_gesture *event);
|
|||
* Relative motion deltas are normalized to represent those of a device with
|
||||
* 1000dpi resolution. See @ref motion_normalization for more details.
|
||||
*
|
||||
* @note It is an application bug to call this function for events other than
|
||||
* @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or
|
||||
* @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE.
|
||||
*
|
||||
* @return the relative y movement since the last event
|
||||
*/
|
||||
double
|
||||
|
|
@ -1061,10 +1053,6 @@ libinput_event_gesture_get_dy(struct libinput_event_gesture *event);
|
|||
* details. Note that unaccelerated events are not equivalent to 'raw' events
|
||||
* as read from the device.
|
||||
*
|
||||
* @note It is an application bug to call this function for events other than
|
||||
* @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or
|
||||
* @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE.
|
||||
*
|
||||
* @return the unaccelerated relative x movement since the last event
|
||||
*/
|
||||
double
|
||||
|
|
@ -1084,10 +1072,6 @@ libinput_event_gesture_get_dx_unaccelerated(
|
|||
* details. Note that unaccelerated events are not equivalent to 'raw' events
|
||||
* as read from the device.
|
||||
*
|
||||
* @note It is an application bug to call this function for events other than
|
||||
* @ref LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE or
|
||||
* @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE.
|
||||
*
|
||||
* @return the unaccelerated relative y movement since the last event
|
||||
*/
|
||||
double
|
||||
|
|
@ -1142,9 +1126,6 @@ libinput_event_gesture_get_scale(struct libinput_event_gesture *event);
|
|||
* around the center of gravity. The calculation of the center of gravity is
|
||||
* implementation-dependent.
|
||||
*
|
||||
* @note It is an application bug to call this function for events other than
|
||||
* @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE.
|
||||
*
|
||||
* @return the angle delta since the last event
|
||||
*/
|
||||
double
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue