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

Uli Schlachter psychon at znc.in
Thu Oct 25 16:12:33 UTC 2018


Hi,

On 25.10.2018 17:28, Christophe Lohr wrote:
> Simply speaking, how to convert a FP1616 into a float?
> (I just have to do  FP1616 / 2^16 )?

...yes. Is there any problem with just doing that?

See e.g. https://en.wikipedia.org/wiki/Fixed-point_arithmetic on fixed
point numbers.

In xinput.h, xcb_input_fp1616_t is a typedef for int32_t. So, you can do
the conversion e.g. via:

  float f = wire_value / 65536.0

Since the code that you sent already does this: What is your actual problem?

Cheers,
Uli
-- 
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?" -- A. P. J.


More information about the Xcb mailing list