[PATCH smooth scrolling] dix: Don't reset the scrolling valuators when emulating events

Peter Hutterer peter.hutterer at who-t.net
Mon Aug 15 18:50:10 PDT 2011


On Mon, Aug 15, 2011 at 03:24:12PM +1000, Peter Hutterer wrote:
> Relative valuators accumulate. Don't reset last.valuators when emulating
> legacy scroll button events but rather take the difference before and after,
> then emulate based on that.
> 
> For subpixel scroll events the previous valuator values sent to the clients
> were:
>     0.2 - 0.4 -0.6 - 0.8 - 0.0 - 0.2 - 0.4...
> This sequence is now
>     0.2 - 0.4 -0.6 - 0.8 - 1.0 - 1.2 - 1.4...
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> This one goes on top of the patches in my -next branch, it won't apply to
> master.
> 
>  dix/getevents.c |   41 +++++++++++++++++++++++++----------------
>  1 files changed, 25 insertions(+), 16 deletions(-)

[...]

> @@ -1259,11 +1268,14 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
>      num_events += nev_tmp;
>  
>      /* Now turn the smooth-scrolling axes back into emulated button presses
> -     * for legacy clients. */
> -    while ((v_scroll_axis != -1 &&
> -            fabs(pDev->last.valuators[v_scroll_axis]) >= 1.0) ||
> -           (h_scroll_axis != -1 &&
> -            fabs(pDev->last.valuators[h_scroll_axis]) >= 1.0))
> +     * for legacy clients, based on the integer delta between before and now */
> +    if (v_scroll_axis != -1)
> +        last_scroll_v = pDev->last.valuators[v_scroll_axis] - last_scroll_v;
> +    if (h_scroll_axis != -1)
> +        last_scroll_h = pDev->last.valuators[h_scroll_axis] - last_scroll_h;

sorry, these two should be of the form
    last_scroll_v -= pDev->last.valuators[v_scroll_axis];
instead. Only just noticed that my scrolling was inverted. amended locally.

Cheers,
  Peter


More information about the xorg-devel mailing list