[PULL] XI 2.1 - raw events and smooth scrolling

Max Schwarz Max at x-quadraht.de
Mon Oct 3 03:50:49 PDT 2011


Hi Peter,

>       Input: Add smooth-scrolling support to GetPointerEvents
There's a subtle bug on that one: Old-style scroll button presses create 
inverted emulated presses (and maybe inverted valuator events, but I don't 
know which direction is 'up' or 'down' on the valuator).

Take a look at dix/getevents.c, GetPointerEvents():

> switch(buttons) {
> case 4:
>    adj = 1.0;
> [snip]
> }
> [snip]
> adj *= pDev->valuator->axes[axis].scroll.increment;
> val = valuator_mask_get_double(&mask, axis) + adj;
> valuator_mask_set_double(&mask, axis, val);

So if increment > 0 and button 4 is pressed, the valuator gets incremented.

Later in emulate_scroll_button_events():

> delta = valuator_mask_get_double(mask, axis)
>          - valuator_mask_get_double(last, axis)
=> delta > 0
> b = (ax->scroll.type == SCROLL_TYPE_VERTICAL) ? 5 : 7
> if((incr > 0 && delta < 0) ||
>    (incr < 0 && delta > 0))
>    b--; /* we're scrolling up or left → button 4 or 6 */
Since incr > 0 and delta > 0, we get button 5.

So either that condition needs to be changed, or the conversion in 
GetPointerEvents() needs to be flipped.

Max


More information about the xorg-devel mailing list