XInput: Tablet to screen coordinate translation

Magnus Vigerlöf Magnus.Vigerlof at home.se
Wed Feb 28 10:54:55 PST 2007


On Wednesday 28 February 2007 02:02, Peter Hutterer wrote:
> On 28/02/2007, at 10:17 , Magnus Vigerlöf wrote:
> > So the coordinates that is sent on the first two axis (x & y) to
> > xf86PostXXXEvent must be converted into coordinates that will fit
> > the actual
> > screen resolution (provided first_valuator is 0)?
>
> True, that how it appears to me.
>
> > This conversion is something that the xf86PostXXXEvent-functions
> > seems to have
> > handled itself previously with a little help by the actual driver
> > (by calling
> > LocalDeviceRec->conversion_proc() from within xf86PostXXXEvent), so
> > it can
> > generate XInput events with the native (sub-pixel precision)
> > resolution for
> > that device which is independent of the screen and also core-events
> > that is
> > scaled to the screen resolution.
> >
> > I'm not sure I like the new way since it limits the value range the
> > driver may
> > report and also put the full responsibility of handling
> > notification of
> > screen resolution changes in the device driver for its device.
>
> just had a look at the old code, you're right. sounds reasonable to me.
> care to submit a patch?

If you can give me an advice on one little detail, sure...

The function pointers to the conversion routines are stored in a 
LocalDeviceRec structure, which isn't accessible in GetPointerEvents (I guess 
there's no desire in adding a dependency to hw/xfree/common/ from dix/, is 
there?). So I wonder what you think would be the best ('right') way of making 
these functions accessible to GPE (where they are needed as far as I can 
see)?

 - Defining additional parameters for the GPE method? (function/structure 
pointer(s))
 - Moving the LocalDeviceRec struct into include/inputstr.h? This will pull a 
few other structs with it as well..

Or I split the GPE function into two functions. First create the XInput 
events, then translate the x/y coordinates and create the core events. That 
would place the call to the translation routines into the xf86PostXXXEvent 
where the LocalDeviceRec structure will be known.

Other ways to do it?

Thanks
  Magnus



More information about the xorg mailing list