clutter-event: Add API around touchpad gesture events
These are needed in order to make these events binding friendly
This commit is contained in:
@ -1877,3 +1877,125 @@ clutter_event_remove_filter (guint id)
|
||||
|
||||
g_warning ("No event filter found for id: %d\n", id);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_event_get_gesture_swipe_finger_count:
|
||||
* @event: a touchpad swipe event
|
||||
*
|
||||
* Returns the number of fingers that is triggering the touchpad gesture.
|
||||
*
|
||||
* Returns: the number of fingers swiping.
|
||||
*
|
||||
* Since: 1.24
|
||||
**/
|
||||
guint
|
||||
clutter_event_get_gesture_swipe_finger_count (const ClutterEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event != NULL, 0);
|
||||
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_SWIPE, 0);
|
||||
|
||||
return event->touchpad_swipe.n_fingers;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_event_get_gesture_pinch_angle_delta:
|
||||
* @event: a touchpad pinch event
|
||||
*
|
||||
* Returns the angle delta reported by this specific event.
|
||||
*
|
||||
* Returns: The angle delta relative to the previous event.
|
||||
*
|
||||
* Since: 1.24
|
||||
**/
|
||||
gdouble
|
||||
clutter_event_get_gesture_pinch_angle_delta (const ClutterEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event != NULL, 0);
|
||||
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH, 0);
|
||||
|
||||
return event->touchpad_pinch.angle_delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_event_get_gesture_pinch_scale:
|
||||
* @event: a touchpad pinch event
|
||||
*
|
||||
* Returns the current scale as reported by @event, 1.0 being the original
|
||||
* distance at the time the corresponding event with phase
|
||||
* %CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN is received.
|
||||
* is received.
|
||||
*
|
||||
* Returns: the current pinch gesture scale
|
||||
*
|
||||
* Since: 1.24
|
||||
**/
|
||||
gdouble
|
||||
clutter_event_get_gesture_pinch_scale (const ClutterEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event != NULL, 0);
|
||||
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH, 0);
|
||||
|
||||
return event->touchpad_pinch.scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_event_get_gesture_phase:
|
||||
* @event: a touchpad gesture event
|
||||
*
|
||||
* Returns the phase of the event, See #ClutterTouchpadGesturePhase.
|
||||
*
|
||||
* Returns: the phase of the gesture event.
|
||||
**/
|
||||
ClutterTouchpadGesturePhase
|
||||
clutter_event_get_gesture_phase (const ClutterEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event != NULL, 0);
|
||||
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH ||
|
||||
event->type == CLUTTER_TOUCHPAD_SWIPE, 0);
|
||||
|
||||
if (event->type == CLUTTER_TOUCHPAD_PINCH)
|
||||
return event->touchpad_pinch.phase;
|
||||
else if (event->type == CLUTTER_TOUCHPAD_SWIPE)
|
||||
return event->touchpad_swipe.phase;
|
||||
|
||||
/* Shouldn't ever happen */
|
||||
return CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN;
|
||||
};
|
||||
|
||||
/**
|
||||
* clutter_event_get_gesture_motion_delta:
|
||||
* @event: A clutter touchpad gesture event
|
||||
* @dx: (out) (allow-none): the displacement relative to the pointer
|
||||
* position in the X axis, or %NULL
|
||||
* @dy: (out) (allow-none): the displacement relative to the pointer
|
||||
* position in the Y axis, or %NULL
|
||||
*
|
||||
* Returns the gesture motion deltas relative to the current pointer
|
||||
* position.
|
||||
*
|
||||
* Since: 1.24
|
||||
**/
|
||||
void
|
||||
clutter_event_get_gesture_motion_delta (const ClutterEvent *event,
|
||||
gdouble *dx,
|
||||
gdouble *dy)
|
||||
{
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH ||
|
||||
event->type == CLUTTER_TOUCHPAD_SWIPE, FALSE);
|
||||
|
||||
if (event->type == CLUTTER_TOUCHPAD_PINCH)
|
||||
{
|
||||
if (dx)
|
||||
*dx = event->touchpad_pinch.dx;
|
||||
if (dy)
|
||||
*dy = event->touchpad_pinch.dy;
|
||||
}
|
||||
else if (event->type == CLUTTER_TOUCHPAD_SWIPE)
|
||||
{
|
||||
if (dx)
|
||||
*dx = event->touchpad_swipe.dx;
|
||||
if (dy)
|
||||
*dy = event->touchpad_swipe.dy;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user