[Xcb] Xinput: units of the coordinates in motion-events?

Christophe Lohr christophe.lohr at cegetel.net
Thu Oct 25 15:28:13 UTC 2018

  I'm trying to use xinput to get pointer position (see attached code)

I h'ave a question about the type used to return coordinates. How to
convert this xcb_input_fp1616_t into a float?

According to specification

            Fixed point decimal in 16.16 format as one INT16 and one CARD16.
            The INT16 contains the integral part, the CARD16 the decimal fraction
            shifted by 16.

So, ok the higher 16bits is the coordinate in terms of pixels on the
window (a signed 16bits integer)

But what's about the lower 16bits (an unsigned 16 bits interger)?
This supposes to count fractions. But fractions of what?  Of portions
of  1 / 2^16  pixel ?
Shifted by 16... but 16 bits? to the left? right? to do what?

Simply speaking, how to convert a FP1616 into a float?
(I just have to do  FP1616 / 2^16 )?

Many thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xcb/attachments/20181025/745bfd2a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pointer.c
Type: text/x-csrc
Size: 1677 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/xcb/attachments/20181025/745bfd2a/attachment.c>

More information about the Xcb mailing list