clutter-event: Add API around touchpad gesture events
These are needed in order to make these events binding friendly
This commit is contained in:
parent
5b8a2a9e15
commit
b151898534
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -665,6 +665,23 @@ guint32 clutter_get_current_event_time (void);
|
||||
CLUTTER_AVAILABLE_IN_1_2
|
||||
const ClutterEvent * clutter_get_current_event (void);
|
||||
|
||||
CLUTTER_AVAILABLE_IN_1_24
|
||||
guint clutter_event_get_gesture_swipe_finger_count (const ClutterEvent *event);
|
||||
|
||||
CLUTTER_AVAILABLE_IN_1_24
|
||||
gdouble clutter_event_get_gesture_pinch_angle_delta (const ClutterEvent *event);
|
||||
|
||||
CLUTTER_AVAILABLE_IN_1_24
|
||||
gdouble clutter_event_get_gesture_pinch_scale (const ClutterEvent *event);
|
||||
|
||||
CLUTTER_AVAILABLE_IN_1_24
|
||||
ClutterTouchpadGesturePhase clutter_event_get_gesture_phase (const ClutterEvent *event);
|
||||
|
||||
CLUTTER_AVAILABLE_IN_1_24
|
||||
void clutter_event_get_gesture_motion_delta (const ClutterEvent *event,
|
||||
gdouble *dx,
|
||||
gdouble *dy);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_EVENT_H__ */
|
||||
|
@ -1135,6 +1135,11 @@ clutter_event_get_position
|
||||
clutter_event_has_control_modifier
|
||||
clutter_event_has_shift_modifier
|
||||
clutter_event_is_pointer_emulated
|
||||
clutter_event_get_gesture_swipe_finger_count
|
||||
clutter_event_get_gesture_pinch_angle_delta
|
||||
clutter_event_get_gesture_pinch_scale
|
||||
clutter_event_get_gesture_phase
|
||||
clutter_event_get_gesture_motion_delta
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_event_get
|
||||
|
Loading…
Reference in New Issue
Block a user