From 585deda799a8c9cf93125aa18fa17f54d795e81b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 7 Jan 2016 13:57:03 +1000 Subject: [PATCH] gestures: pass the finger count into pinch events Prep work for multifinger pinch gestures Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad-gestures.c | 3 +++ src/libinput-private.h | 2 ++ src/libinput.c | 8 +++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index fc51c547..c676caac 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -109,6 +109,7 @@ tp_gesture_start(struct tp_dispatch *tp, uint64_t time) case GESTURE_STATE_PINCH: gesture_notify_pinch(&tp->device->base, time, LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, + tp->gesture.finger_count, &zero, &zero, 1.0, 0.0); break; } @@ -378,6 +379,7 @@ tp_gesture_twofinger_handle_state_pinch(struct tp_dispatch *tp, uint64_t time) tp_gesture_start(tp, time); gesture_notify_pinch(&tp->device->base, time, LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, + tp->gesture.finger_count, &delta, &unaccel, scale, angle_delta); tp->gesture.prev_scale = scale; @@ -496,6 +498,7 @@ tp_gesture_end(struct tp_dispatch *tp, uint64_t time, bool cancelled) break; case GESTURE_STATE_PINCH: gesture_notify_pinch_end(&tp->device->base, time, + tp->gesture.finger_count, tp->gesture.prev_scale, cancelled); break; diff --git a/src/libinput-private.h b/src/libinput-private.h index e146c260..efffe35c 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -429,6 +429,7 @@ void gesture_notify_pinch(struct libinput_device *device, uint64_t time, enum libinput_event_type type, + int finger_count, const struct normalized_coords *delta, const struct normalized_coords *unaccel, double scale, @@ -437,6 +438,7 @@ gesture_notify_pinch(struct libinput_device *device, void gesture_notify_pinch_end(struct libinput_device *device, uint64_t time, + int finger_count, double scale, int cancelled); diff --git a/src/libinput.c b/src/libinput.c index 24f2b693..756edfad 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -1673,25 +1673,27 @@ void gesture_notify_pinch(struct libinput_device *device, uint64_t time, enum libinput_event_type type, + int finger_count, const struct normalized_coords *delta, const struct normalized_coords *unaccel, double scale, double angle) { - gesture_notify(device, time, type, 2, 0, delta, unaccel, - scale, angle); + gesture_notify(device, time, type, finger_count, 0, + delta, unaccel, scale, angle); } void gesture_notify_pinch_end(struct libinput_device *device, uint64_t time, + int finger_count, double scale, int cancelled) { const struct normalized_coords zero = { 0.0, 0.0 }; gesture_notify(device, time, LIBINPUT_EVENT_GESTURE_PINCH_END, - 2, cancelled, &zero, &zero, scale, 0.0); + finger_count, cancelled, &zero, &zero, scale, 0.0); } static void