clutter: Rename touchpad gesture n_fingers getter to be more generic

This can also be used now on pinch events, so make a more generic name
for this function.

https://bugzilla.gnome.org/show_bug.cgi?id=765937
This commit is contained in:
Carlos Garnacho 2016-05-03 13:31:11 +02:00
parent cf0a453d32
commit 4cfc21d49d
3 changed files with 14 additions and 8 deletions

View File

@ -1990,22 +1990,28 @@ clutter_event_remove_filter (guint id)
}
/**
* clutter_event_get_gesture_swipe_finger_count:
* @event: a touchpad swipe event
* clutter_event_get_touchpad_gesture_finger_count:
* @event: a touchpad swipe/pinch event
*
* Returns the number of fingers that is triggering the touchpad gesture.
*
* Returns: the number of fingers swiping.
* Returns: the number of fingers in the gesture.
*
* Since: 1.24
**/
guint
clutter_event_get_gesture_swipe_finger_count (const ClutterEvent *event)
clutter_event_get_touchpad_gesture_finger_count (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, 0);
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_SWIPE, 0);
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_SWIPE ||
event->type == CLUTTER_TOUCHPAD_PINCH, 0);
return event->touchpad_swipe.n_fingers;
if (event->type == CLUTTER_TOUCHPAD_SWIPE)
return event->touchpad_swipe.n_fingers;
else if (event->type == CLUTTER_TOUCHPAD_PINCH)
return event->touchpad_pinch.n_fingers;
return 0;
}
/**

View File

@ -753,7 +753,7 @@ 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);
guint clutter_event_get_touchpad_gesture_finger_count (const ClutterEvent *event);
CLUTTER_AVAILABLE_IN_1_24
gdouble clutter_event_get_gesture_pinch_angle_delta (const ClutterEvent *event);

View File

@ -43,7 +43,7 @@ handle_swipe_begin (MetaWaylandPointer *pointer,
pointer_client = pointer->focus_client;
seat = meta_wayland_pointer_get_seat (pointer);
serial = wl_display_next_serial (seat->wl_display);
fingers = clutter_event_get_gesture_swipe_finger_count (event);
fingers = clutter_event_get_touchpad_gesture_finger_count (event);
wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
{