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

Peter Hutterer peter.hutterer at who-t.net
Mon Jun 13 22:02:24 PDT 2011


On Fri, Jun 10, 2011 at 10:09:36PM +0200, Simon Thum wrote:
> 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.

the struct is opaque to the driver. unless they included the wrong headers
in which case it isn't our problem ;)

Cheers,
  Peter

> 
> > 
> > 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);
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list