gestures: allow any gesture event type for gesture_get_dx/dy and get_angle
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 9 Jun 2015 04:23:07 +0000 (14:23 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 6 Jul 2015 04:09:33 +0000 (14:09 +1000)
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>
src/libinput.c
src/libinput.h

index 93a6eb8..563ad0d 100644 (file)
@@ -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;
 }
index 15d70fb..d23f8fd 100644 (file)
@@ -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