From 4cfc21d49d6259373b5b7131398152c926de0566 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 3 May 2016 13:31:11 +0200 Subject: [PATCH] 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 --- clutter/clutter/clutter-event.c | 18 ++++++++++++------ clutter/clutter/clutter-event.h | 2 +- .../meta-wayland-pointer-gesture-swipe.c | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c index 35a1a4d18..0c1b703bb 100644 --- a/clutter/clutter/clutter-event.c +++ b/clutter/clutter/clutter-event.c @@ -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; } /** diff --git a/clutter/clutter/clutter-event.h b/clutter/clutter/clutter-event.h index 88f899ea0..ab04f1bcb 100644 --- a/clutter/clutter/clutter-event.h +++ b/clutter/clutter/clutter-event.h @@ -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); diff --git a/src/wayland/meta-wayland-pointer-gesture-swipe.c b/src/wayland/meta-wayland-pointer-gesture-swipe.c index 514d2c7b8..eaa34acdf 100644 --- a/src/wayland/meta-wayland-pointer-gesture-swipe.c +++ b/src/wayland/meta-wayland-pointer-gesture-swipe.c @@ -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) {