Making X report the mouse position with subpixel precision
tom at dbservice.com
Wed Feb 28 01:04:49 PST 2007
Johan Kiviniemi wrote:
> On Mon, Feb 26, 2007 at 09:13:59AM +1030, Peter Hutterer wrote:
>> On 24/02/2007, at 08:12 , Johan Kiviniemi wrote:
>>> The precision of mice is generally much better than the precision of
>>> screens. I'm not very familiar with the internals of X, but AFAIK it
>>> only reports the mouse position to clients at the screen's precision.
>> One of the problems I see here is that X doesn't just swallow
>> precision. One unit move move reported represents one pixel cursor
>> move (+ acceleration).
>> To have sub-pixel accuracy you need to introduce something like
>> negative acceleration (e.g. 10 units mouse move == 1 pixel), causing
>> the user to move the physical device around _a lot_.
> First of all, the X server would need to handle mouse coordinates
> internally as floating-point numbers, not integers. The screen can be
The problem is that the _mouse_ doesn't send events in a bigger
precision. The mouse reports one unit movement, the kernel generates a
input-event with one unit movement, X reads the input-event and sends a
one unit (pixel) movement to its clients. (tested with the evdev interface).
Even if I set my mouse to 1600 DPI (todays top mice can only handle as
much as 2000 DPI), it wouldn't be useful to divide one pixel into 2x2
sub-pixels, because then I'd have to move my mouse a too big distance to
get the cursor somewhere.
More information about the xorg