Cleanup fixes in pointer acceleration

Peter Hutterer peter.hutterer at who-t.net
Wed Mar 11 21:04:27 PDT 2009


On Thu, Mar 05, 2009 at 08:40:02PM +0100, Simon Thum wrote:
> attached patches fix 2 minor issues with pointer acceleration. I don't
> think they cause any real problem, but anyway.


> From b0c17b0442087c478b14e59698bd000591d9b3e0 Mon Sep 17 00:00:00 2001
> From: Simon Thum <simon.thum at gmx.de>
> Date: Wed, 25 Feb 2009 10:55:36 +0100
> Subject: [PATCH] xfree86: remove obsolete code
> 
> remove a few lines which redo part of the pointer acceleration
> init. Properties is the way to go for them.
> ---
>  hw/xfree86/common/xf86Xinput.c |   18 ------------------
>  1 files changed, 0 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> index 59b616c..da4f682 100644
> --- a/hw/xfree86/common/xf86Xinput.c
> +++ b/hw/xfree86/common/xf86Xinput.c
> @@ -209,24 +209,6 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
>                                           s->average_accel);
>  
>      s->reset_time = xf86SetIntOption(list, "VelocityReset", s->reset_time);
> -
> -    tempf = xf86SetRealOption(list, "ExpectedRate", 0);
> -    if(tempf > 0){
> -        s->corr_mul = 1000.0 / tempf;
> -    }else{
> -        s->corr_mul = xf86SetRealOption(list, "VelocityScale", s->corr_mul);
> -    }
> -
> -    /* select profile by number */
> -    tempi= xf86SetIntOption(list, "AccelerationProfile",
> -                            s->statistics.profile_number);
> -
> -    if(SetAccelerationProfile(s, tempi)){
> -        xf86Msg(X_CONFIG, "%s: (accel) set acceleration profile %i\n", devname, tempi);
> -    }else{
> -        xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i is unknown\n",
> -                devname, tempi);
> -    }
>  }
>  
>  static void
> -- 
> 1.6.0.6


Pushed, thanks.

> From a16531a5c1041fc11270e0b9e09593988e1c24f6 Mon Sep 17 00:00:00 2001
> From: Simon Thum <simon.thum at gmx.de>
> Date: Sun, 1 Mar 2009 14:53:03 +0100
> Subject: [PATCH] dix: use correct type for timestamps
> 
> acceleration code did use int where CARD32 would have been correct.
> ---
>  dix/ptrveloc.c     |    6 +++---
>  include/input.h    |    2 +-
>  include/ptrveloc.h |    4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
> index 30e0207..efe575f 100644
> --- a/dix/ptrveloc.c
> +++ b/dix/ptrveloc.c
> @@ -534,7 +534,7 @@ ProcessVelocityData2D(
>      DeviceVelocityPtr s,
>      int dx,
>      int dy,
> -    int time)
> +    CARD32 time)
>  {
>      float distance;
>  
> @@ -1042,7 +1042,7 @@ acceleratePointerPredictable(
>      int first_valuator,
>      int num_valuators,
>      int *valuators,
> -    int evtime)
> +    CARD32 evtime)
>  {
>      float mult = 0.0;
>      int dx = 0, dy = 0;
> @@ -1119,7 +1119,7 @@ acceleratePointerLightweight(
>      int first_valuator,
>      int num_valuators,
>      int *valuators,
> -    int ignored)
> +    CARD32 ignored)
>  {
>      float mult = 0.0;
>      int dx = 0, dy = 0;
> diff --git a/include/input.h b/include/input.h
> index 3b7a173..f086aa5 100644
> --- a/include/input.h
> +++ b/include/input.h
> @@ -140,7 +140,7 @@ typedef void (*PointerAccelSchemeProc)(
>      int /*first_valuator*/,
>      int /*num_valuators*/,
>      int* /*valuators*/,
> -    int /*evtime*/);
> +    CARD32 /*evtime*/);
>  
>  typedef void (*DeviceCallbackProc)(
>                DeviceIntPtr /*pDev*/);
> diff --git a/include/ptrveloc.h b/include/ptrveloc.h
> index f9933c9..0d4616a 100644
> --- a/include/ptrveloc.h
> +++ b/include/ptrveloc.h
> @@ -126,10 +126,10 @@ AccelerationDefaultCleanup(DeviceIntPtr pDev);
>  
>  extern _X_EXPORT void
>  acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator,
> -                             int num_valuators, int *valuators, int evtime);
> +                             int num_valuators, int *valuators, CARD32 evtime);
>  
>  extern _X_EXPORT void
>  acceleratePointerLightweight(DeviceIntPtr pDev, int first_valuator,
> -                         int num_valuators, int *valuators, int ignore);
> +                         int num_valuators, int *valuators, CARD32 ignore);
>  
>  #endif  /* POINTERVELOCITY_H */
> -- 
> 1.6.0.6
 
(sorry, accidentally mentioned all this on a private email)
I don't really see the need for this since this is an server-internal API so
we can expect that the size of int is the same anyways.
this value isn't written or used in the protocol either, so I'll leave this
patch until someone convinces me otherwise.

Cheers,
  Peter


More information about the xorg-devel mailing list