[xserver][PATCH] Tablet to screen coordinate translation

Magnus Vigerlöf Magnus.Vigerlof at home.se
Wed Mar 7 12:54:12 PST 2007


On Wednesday 07 March 2007 01:13, Peter Hutterer wrote:
> On 05/03/2007, at 04:29 , Magnus Vigerlöf wrote:
> > Mmm... I split the GPE into two (extention and core) to cause minimal
> > disturbances to the current code base and to be compatible with the
> > current
> > implementations of the other input devices, but I'll try to redo
> > the patch
> > according to these ideas instead.
>
> we only need to scale core events, not XI events. The XI specs say
> that if mode is Absolute, the axis values are whatever the device
> reports. Unfortunately it is not as explicit about relative
> coordinates, but I read it as the same.
> If an app can't deal with the original values from the device (which
> may be greater than the screen dimensions), bad luck for the app.
>
> The way how I see it, is that we only need to scale the core events
> down to the screen. At the moment, GPE doesn't do this, it scales
> everything.

Hmm... I couldn't find any scaling code at all in GPE (branch 'master').. Am I 
in the same branch as you?

> Instead, it should scale x/y for the core events and for  
> the cursor position, but not for the valuators. I guess a starting
> point would be removing the "/* Drop x and y back into the valuators
> list ..." and go from there, but that's just a quick guess.

In case of relative motion reporting the current coordinates of the core 
pointer should probably be converted to the device scale so the relative 
motion can be added to it in the device own resolution.

But what conversion is needed and where can probably be derived from the old 
xf86PostMotionEvent code. GPE is not that much different from it.

> So yes, we need some conversion proc in the device that knows how to
> scale to screen coordinates, but I disagree with daniel. In GPE, we
> have the device, if the device has a conversion proc, call it then
> and there. No point in having the DDX sift through the event list and
> change events. This is just calling for trouble, but people are free
> to disagree with me.

The LocalDeviceRec structure already contains two function pointers that can 
do the needed conversions. That struct definition is available in 
xf86PostMotionEvent but not in GPE so either the conversion could be made 
outside GPE (which was what I tried), or we'll need a way to supply the 
conversion functions to GPE (old or new functions).

> > Question though: This means that we need a new method in the
> > LocalDeviceRec
> > structure or somwhere near to be called with the generated events for
> > conversion. Is the struct above 'included' in the version defined by
> > ABI_XINPUT_VERSION, or is there a better suited one that can be used?
>
> put it in, test it, worry about ABI later. We may need a couple of
> iterations anyway.

Heh.. Ok, I'm just a bit careful making changes that would affect the 
interface to the input drivers. The driver I'm working mostly with 
(linuxwacom) need to support both Xorg and XFree86 so I wouldn't mind if this 
was solved with the current definitions of the structures. But if getting a 
better architecture will need a change, so be it. We'll cope as long as we 
can detect it.

Thanks
 Magnus



More information about the xorg mailing list