On Tue, Dec 20, 2016 at 12:20:38PM +0100, Hans de Goede wrote: > Hi, > > On 20-12-16 04:57, Peter Hutterer wrote: > > If the fingers rest on the touchpad without moving for a timeout, switch to > > pinch or swipe based on the finger position. We already did so for > > two-fingers > > switching to scrolling, now we also do so for 3 and 4 finger gestures. This > > gives us better reaction to small movements. > > > > Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> > > --- > > src/evdev-mt-touchpad-gestures.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/src/evdev-mt-touchpad-gestures.c > > b/src/evdev-mt-touchpad-gestures.c > > index 6c568a3..e54db2a 100644 > > --- a/src/evdev-mt-touchpad-gestures.c > > +++ b/src/evdev-mt-touchpad-gestures.c > > @@ -331,10 +331,10 @@ tp_gesture_handle_state_unknown(struct tp_dispatch > > *tp, uint64_t time) > > int yres = tp->device->abs.absinfo_y->resolution; > > int vert_distance; > > > > - /* for two-finger gestures, if the fingers stay unmoving for a > > - * while, assume (slow) scroll */ > > - if (tp->gesture.finger_count == 2) { > > - if (time > (tp->gesture.initial_time + > > DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) { > > + if (time > (tp->gesture.initial_time + > > DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) { > > + /* for two-finger gestures, if the fingers stay unmoving for a > > + * while, assume (slow) scroll */ > > + if (tp->gesture.finger_count == 2) { > > tp_gesture_set_scroll_buildup(tp); > > return GESTURE_STATE_SCROLL; > > } > > @@ -346,6 +346,8 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, > > uint64_t time) > > tp->gesture.enabled) { > > tp_gesture_init_pinch(tp); > > return GESTURE_STATE_PINCH; > > + } else { > > + return GESTURE_STATE_SWIPE; > > } > > } > > > > > > This change means that if 2 fingers are down and one finger is > 20mm below > the others, we > will no longer immediately switch to pinch mode, as that test is now only > done after the > timeout. I think that that is an unintended side-effect of this patch ?
Huh, I didn't think it was. I just double-checked that and realised that the previous bit was broken anyway but it's not visible in the patch context. The full condition is: if (vert_distance > 20 * yres && tp->gesture.finger_count > 2 && tp->gesture.enabled) { tp_gesture_init_pinch(tp); return GESTURE_STATE_PINCH; but that was inside a "if (tp->gesture.finger_count == 2)" block so this code was never triggered. Apparently we don't have a test case for this one. The new code is: if (timeout expired) { if two fingers -> return scroll if vertical distance -> return pinch else return swipe } I'll clean this up and re-send, thanks. Another note: the reason we can't switch to pinch immediately for 2 fingers is that when you put 3 fingers down for a swipe, it's likely you put down one, then two, then 3 fingers. So there's a chance that you could switch to pinch before the third finger is down. We work around this by looking at the left/right touches only and thus ignoring the middle finger but that doesn't work during the transitional phase. Cheers, Peter _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel