[PATCH 05/28] Input: Convert ValuatorMask to double-precision internally

Simon Thum simon.thum at gmx.de
Fri Jun 10 13:09:36 PDT 2011


On 06/09/2011 07:17 PM, Daniel Stone wrote:
> Switch the ValuatorMask struct to using doubles instead of ints for the
> actual values.  Preserve the old int API, and (attempt to) round towards
> zero for values we return.
It's nice to keep the API, but what about the ABI? AFAIK this changes
the size of a driver-exposed struct.

Cheers,

Simon


> 
> Signed-off-by: Daniel Stone <daniel at fooishbar.org>
> Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  dix/inpututils.c     |    4 ++--
>  include/inpututils.h |    2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/dix/inpututils.c b/dix/inpututils.c
> index 49e1758..20132d5 100644
> --- a/dix/inpututils.c
> +++ b/dix/inpututils.c
> @@ -514,7 +514,7 @@ valuator_mask_set(ValuatorMask *mask, int valuator, int data)
>  int
>  valuator_mask_get(const ValuatorMask *mask, int valuator)
>  {
> -    return mask->valuators[valuator];
> +    return trunc(mask->valuators[valuator]);
>  }
>  
>  /**
> @@ -527,7 +527,7 @@ valuator_mask_unset(ValuatorMask *mask, int valuator)
>          int i, lastbit = -1;
>  
>          ClearBit(mask->mask, valuator);
> -        mask->valuators[valuator] = 0;
> +        mask->valuators[valuator] = 0.0;
>  
>          for (i = 0; i <= mask->last_bit; i++)
>              if (valuator_mask_isset(mask, i))
> diff --git a/include/inpututils.h b/include/inpututils.h
> index 92a7543..4d02125 100644
> --- a/include/inpututils.h
> +++ b/include/inpututils.h
> @@ -34,7 +34,7 @@
>  struct _ValuatorMask {
>      int8_t      last_bit; /* highest bit set in mask */
>      uint8_t     mask[(MAX_VALUATORS + 7)/8];
> -    int         valuators[MAX_VALUATORS]; /* valuator data */
> +    double      valuators[MAX_VALUATORS]; /* valuator data */
>  };
>  
>  extern void verify_internal_event(const InternalEvent *ev);



More information about the xorg-devel mailing list