[PATCH libinput 04/14] gestures: pass the finger count into pinch events

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 7 20:11:08 PST 2016


Prep work for multifinger pinch gestures

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 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 fc51c54..c676caa 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 e146c26..efffe35 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 24f2b69..756edfa 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
-- 
2.5.0



More information about the wayland-devel mailing list