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

Hans de Goede hdegoede at redhat.com
Fri Jan 22 02:15:55 PST 2016


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)
+		return GESTURE_2FG_STATE_SCROLL;
+

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.

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).

###

An unrelated thing which I noticed while reviewing your patches for this
is that I'm not sure if we're handling things right in tp_get_average_touches_delta()
currently we are counting dirty touches there and dividing the reported deltas
by the number of dirty touches, this means that if 2fg are moving and movement
gets reported from both in a single frame we report the averaged result of
both moves (good), but if 2 fingers are moving, but first we get a move event
for fg1 only, and then for fg2 only we now end up reporting double the
move of what we would report if both moves were reported in a single frame.

This is wrong, and doubly so because we are likely to get movements in separate
frames when the user is trying to e.g. do a slow 2fg scroll, which we now
speed up by a factor of 2.

I believe that we should change to counting active_touches in tp_get_touches_delta
rather then changed touches, and dividing by that when averaging.

We cannot simply use tp->gesture.finger_count since that may be different from
the actual number of active touches when tap+dragging.

###

Yet another unrelated remark, it seems we've an unused "int i" in
tp_gesture_handle_state().

Regards,

Hans


More information about the wayland-devel mailing list