[PATCH libinput] touchpad: disable MT for all semi-mt devices

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 28 17:20:46 PST 2016

On Mon, Jan 25, 2016 at 05:46:56PM +0100, Hans de Goede wrote:
> Hi,
> On 25-01-16 04:03, Peter Hutterer wrote:
> >On Fri, Jan 22, 2016 at 11:15:55AM +0100, Hans de Goede wrote:
> >>Hi,
> >>
> >>On 22-01-16 03:06, Peter Hutterer wrote:
> >>>On Wed, Jan 20, 2016 at 11:31:42AM +0100, Hans de Goede wrote:
> >>>>Hi,
> >>>>
> >>
> >><snip>
> >>
> >>>>Then we can also revert:
> >>>>
> >>>>http://cgit.freedesktop.org/wayland/libinput/commit/?id=0d40aefe
> >>>>
> >>>>Making tp_gesture_get_active_touches() look only at real touches
> >>>>again as intended.
> >>>
> >>>
> >>>I don't think this is correct, we still need to count fake fingers on an ST
> >>>touchpad for two-finger scrolling to trigger correctly.
> >>
> >>That is because you've put the:
> >>
> >>+	if (!tp->gesture.enabled)
> >>+
> >>
> >>Check at the end of tp_gesture_twofinger_handle_state_none(), so after the
> >>call to tp_gesture_get_active_touches().
> >>
> >>None of the variables set in tp_gesture_twofinger_handle_state_none() are
> >>used when jumping straight to GESTURE_2FG_STATE_SCROLL, so you could do
> >>the check at the beginning of tp_gesture_twofinger_handle_state_none()
> >>(before calling tp_gesture_get_active_touches()), and then you no longer
> >>need to worry about ST touchpads in there.
> >
> >Note: I've since merged the 3-finger pinch gesture branch, so merging this
> >set on top caused a couple of conflicts and things look a bit different now.
> >
> >tp_gesture_twofinger_handle_state_none() was renamed and is now invoked for
> >3 and 4-finger states as well, so we do need a finger check to bail out.
> >what I will add though is a direct jump to swipe for a >2 finger gesture on
> >an ST touchpad, patch coming up.
> >
> >>The problem I've with checking all touches, not just real touches
> >>in tp_gesture_get_active_touches() is that you may end up returning
> >>a fake touch as one of the 2 touches, and then use the coordinates
> >>of this fake touch to decide whether the user is doing a pinch or
> >>a 2fg scroll. IMHO it would be better to just jump straight to 2FG
> >>scrolling in this case (note currently we stay in GESTURE_2FG_STATE_NONE
> >>if tp_gesture_get_active_touches() fails).
> >
> >the touchpad code is so that fake touches get the same
> >positional coordinates as the first touch points. So you can't ever trigger
> >a pinch on an ST device anyway, they'll always move in the same direction.
> >I've tried to avoid putting more semi-mt conditions in than necessary,
> >relying on that functionality to give us the correct coordinates.
> >
> >but I think the patch for the above addresses that anyway, so I think we're
> >good here.
> What has me worried is the case where we've a true multi-touch clickpad
> which tracks 2 fingers, then the first finger down could be resting in
> a soft-button area, and the user could be doing 2fg scrolling with his
> other hand. In this case the coordinates of the resting finger will
> be used for the 2nd touch of the 2fg scroll (the 3th finger down), so we
> will be looking at the resting finger vs one of the 2 scrolling fingers which
> makes things look like a pinch. Hence it is better to make
> tp_gesture_get_active_touches only look at real touches, and if it fails
> just play it safe and jump straight to scrolling / swiping.

fwiw, as part of the 3fg gesture code I added a section to the doc to
explain the ambiguity:

aside from that, the code should work - we only look at active touches so a
touch resting on the bottom won't be counted. The 3fg gesture code uses the
natural hand shape to place the extra touches, so in the example above, the
fake touch would have the same coordinates as the index finger. So if you
have three fingers on the touchpad, you only get 2 fingers back with the
same coordinates, triggering a scroll.

this of course only works when there is a softbutton area, if not then it's
a case of "don't do that" :)

That aside, there is a kernel bug affecting at least the t440 and t450 where
the touch points jump slots, making the above code detect pinch gestures
when it shouldn't. 


More information about the wayland-devel mailing list