xf86-input-mtrack icon indicating copy to clipboard operation
xf86-input-mtrack copied to clipboard

Cannot scroll down/scroll right

Open guruthree opened this issue 11 years ago • 1 comments

I'm trying to use my Magic Trackpad. For some reason I can't scroll down or to the right, while up and left works fine. I'm using mtrack 0.3.0 on xorg-server 1.13.1, bluez 4.101-r5, kernel 3.8.4-gentoo.

I enabled debugging. http://guru3.net/temp/scrollup.txt http://guru3.net/temp/scrolldown.txt http://guru3.net/temp/threetap.txt

It looks somehow like scrolling down is either flat out not detected or is detected as a rotate. This may be related to the fact that occasionally when middle clicking (three tap) the mouse pointer goes flying.

I'm not sure exactly what the issue is, but it looks like some sort of integer wrapping issue may be happening: (II) is_thumb: no -2147483648 > 70 && 0 > 25

The trackpad works fine on another computer with mtrack.

guruthree avatar Mar 26 '13 10:03 guruthree

I think I've found the problem: See this line of code: https://github.com/BlueDragonX/xf86-input-mtrack/blob/master/src/gestures.c#L572

t1->direction and t2->direction do not get checked if they are valid directions (see https://github.com/BlueDragonX/xf86-input-mtrack/blob/797719796a53a24fa6cd72fc3909a490ed807bec/include/trig.h#L40 ). When one finger is not moving, one of the directions is TR_NONE, which as a number is -1.00

Now, when the other finger is moving upwards (0.00) or upper-left (6.00-7.99) the scrolling works, because the difference (trig_angles_acute) between -1.00 (TR_NONE) and 0.00 respectively 6.00-7.99 (overflow, like from 360° to 0°) is small enough.

When moving the other finger down or right (2.00, 4.00), the difference is >2 and therefore too big to trigger a scrolling event.

Now the bigger problem with this is: For some odd reason my touchpad (it's the touchscreen of an Galaxy S2 Smartphone (i9100), which has an Atmel MXT224 touchcontroller) always reports one direction as TR_NONE (-1.00) when moving two fingers?!? Example (moving 2 fingers upwards (=0.00)):

(II) t1dir: -1.00 , t2dir: 0.41 
(II) t1dir: 0.00 , t2dir: -1.00 
(II) t1dir: -1.00 , t2dir: 0.00 
(II) t1dir: 0.00 , t2dir: -1.00 
(II) t1dir: -1.00 , t2dir: 0.00 
(II) t1dir: 0.00 , t2dir: -1.00 
(II) t1dir: -1.00 , t2dir: 0.00 

I did this to make scrolling possible anyways:

if (t1->direction == TR_NONE) // if no movement in t1
{
    return trig_generalize(t2->direction); // use t2 only to determine direction
}
else if (t2->direction == TR_NONE) // and vice versa
{
    return trig_generalize(t1->direction);
}
else if (trig_angles_acute(t1->direction, t2->direction) < 2.0) {

But the issue of the touchpad reporting one finger as TR_NONE when moving two of them remains, which bugs me since it renders the the other gestures (rotate, scale) unuseable...

schuhumi avatar Mar 14 '15 23:03 schuhumi