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 <[email protected]> --- src/libinput.c | 28 +++++++++++++++++++++++----- src/libinput.h | 19 ------------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/libinput.c b/src/libinput.c index 93a6eb8..563ad0d 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -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; } diff --git a/src/libinput.h b/src/libinput.h index 15d70fb..d23f8fd 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -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 -- 2.4.3 _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
