• Hans de Goede's avatar
    Input: alps - use more accurate coordinates for first touch in semi-mt mode · 4dd26573
    Hans de Goede authored
    All alps semi-mt touchpads give us the following data when 2 (or more)
    fingers are touching: 1 more or less accurate touch for the first finger
    down, and a bitmap with columns and rows in which 1 or more fingers are
    seen resulting in a crude (low res) bounding box.
    
    So far for v3, rushmore and v4 touchpads we've been reporting the
    coordinates of 2 opposite corners of the box when 2 fingers are touching.
    Ignoring the much better resolution data given in the normal position
    packet.
    
    This commit actually uses this data for the first touch, figures out which
    corner of the bounding box is closest to the first touch, and reports the
    coordinates of the opposite corner for the second touch, resulting in
    much better data for the first touch and for the single touch
    pointer-emulation events.
    
    This approach is similar to the one in alps_process_bitmap_dolphin, that
    function takes the single accurate touch info, calculates the distance to
    the center of the bounding box, and then puts the 2nd touch mirrored to
    the center. The downside of that approach is that if both touches move
    slowly in the same direction, the bounding box will stay the same for a
    while (as it is low res) and the second touch will thus been seen moving
    in the opposite direction until the bounding box actually changes, and
    then the second touch snaps to its new position resulting in a saw tooth
    pattern in the coordinates for the second touch, hence this new approach.
    
    This commit fixes 2 finger scrolling being choppy / jumpy on these
    touchpads.
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    4dd26573
alps.h 9.42 KB