[PATCH] fixes to pointer acceleration

Peter Hutterer peter.hutterer at who-t.net
Tue May 5 17:00:45 PDT 2009


On Tue, May 05, 2009 at 08:55:52PM +0200, Simon Thum wrote:
> attached are some minor patches to pointer acceleration:
>
> - A 'none' profile is added so users can disable acceleration at
> runtime in a more explicit way than xset m 1 0 or other magic.

see comments below.

> - fix a warning newer GCCs issue on some casts and maybe improve
> performance as well.

> - remove unneeded headers from ptrveloc.c

Both merged, thanks. Will be pushed in time.

> >From 883cab39ace28695c3be4303b919d3b786d83ee6 Mon Sep 17 00:00:00 2001
> From: Simon Thum <simon.thum at gmx.de>
> Date: Tue, 28 Apr 2009 10:11:32 +0200
> Subject: [PATCH] dix: add 'none' pointer acceleration profile with number -1
> 
> this is a shorthand for disabling acceleration, while retaining the
> possiblity to use constant deceleration. If constant deceleration is
> unused, it will also optimize motion processing.

Please add in the commit message why it's ok to remove the "reserved" profile,
just in case someone has to figure that out at a later point in time.

> ---
>  dix/ptrveloc.c     |   30 ++++++++++++++++++++++++------
>  include/ptrveloc.h |    4 ++--
>  2 files changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
> index 1590cfd..6553772 100644
> --- a/dix/ptrveloc.c
> +++ b/dix/ptrveloc.c
> @@ -80,9 +80,12 @@ GetAccelerationProfile(DeviceVelocityPtr s, int profile_num);
>  #endif
>  
>  /********************************
> - *  Init/Uninit etc
> + *  Init/Uninit
>   *******************************/
>  
> +/* some int which is not a profile number */
> +#define PROFILE_UNINITIALIZE (-100)
> +
>  /**
>   * Init struct so it should match the average case
>   */
> @@ -111,7 +114,7 @@ InitVelocityData(DeviceVelocityPtr s)
>  static void
>  FreeVelocityData(DeviceVelocityPtr s){
>      xfree(s->tracker);
> -    SetAccelerationProfile(s, -1);
> +    SetAccelerationProfile(s, PROFILE_UNINITIALIZE);
>  }
>  
>  
> @@ -827,6 +830,16 @@ LinearProfile(
>  }
>  
>  
> +static float
> +NoProfile(
> +    DeviceVelocityPtr pVel,
> +    float velocity,
> +    float threshold,
> +    float acc)
> +{
> +    return 1.0f;
> +}
> +
>  static PointerAccelerationProfileFunc
>  GetAccelerationProfile(
>      DeviceVelocityPtr s,
> @@ -847,8 +860,8 @@ GetAccelerationProfile(
>              return PowerProfile;
>          case AccelProfileLinear:
>              return LinearProfile;
> -        case AccelProfileReserved:
> -            /* reserved for future use, e.g. a user-defined profile */
> +        case AccelProfileNone:
> +            return NoProfile;
>          default:
>              return NULL;
>      }
> @@ -859,7 +872,7 @@ GetAccelerationProfile(
>   * Intended to make profiles exchangeable at runtime.
>   * If you created a profile, give it a number here and in the header to
>   * make it selectable. In case some profile-specific init is needed, here
> - * would be a good place, since FreeVelocityData() also calls this with -1.
> + * would be a good place, since FreeVelocityData() also calls this with -100.

that should refer to PROFILE_UNINITIALIZE, IMO

Cheers,
  Peter


More information about the xorg-devel mailing list