Christophe Lohr
2018-10-25 15:28:13 UTC
Hi,
 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
(https://www.x.org/releases/X11R7.7/doc/inputproto/XI2proto.txt):
FP1616
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
Regards
 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
(https://www.x.org/releases/X11R7.7/doc/inputproto/XI2proto.txt):
FP1616
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
Regards