[PATCH] dix: work around scaling issues during WarpPointer (#53037)

Peter Hutterer peter.hutterer at who-t.net
Tue Aug 14 17:49:47 PDT 2012

On Tue, Aug 14, 2012 at 05:19:45PM -0700, Keith Packard wrote:
> Peter Hutterer <peter.hutterer at who-t.net> writes:
> > In WarpPointer calls, we get input in screen coordinates. They must be
> > scaled to device coordinates, and then back to screen coordinates for screen
> > crossing and root coordinates in events.
> >
> > The rounding errors introduced (and clipping in core/XI 1.x events) can lead
> > to the actual position being different to the requested input coordinates.
> > e.g. 200 scales to 199.9999, truncated to 199 in the event.
> Would it be useful to do a bit of rounding in these conversions
> somewhere?

The only place you can round is after scaling back into the screen
coordinate system and there's still a small chance of failure. It largely
depends on the difference between screen coordinate system and device
coordinate system.

So the two options we have are:
1) round() and take the potential errors. This is the better choice for
devices where round() gives more than a pixel difference since device and
root coordinates will have less of a difference.
2) force the explicit pointer position. This will hurt more for devices that
are off by more than one pixel, but won't show up by those within a pixel.

Feel free to calculate what the difference in coordinate systems must be to
favour one of the other :)


More information about the xorg-devel mailing list