How to capture the original mouse input in X11?

For the Windows version of my application, I use WM_INPUT and register the mouse device directly to get the most accurate movements. How will I do this in X11?

+3
source share
2 answers

There are several ways to do this, depending on the structure used.

If you intend to do this with "Xlib," the easiest way to program for X11, you should take a look at the Xlib manual , with a special focus on XInput. More information can be obtained using XI2 (XInput version 2)

. Qt. API , - .

, .

+1

, , , Linux. # 2 (Python) # 1 (C), # 3 (Python) # 4 (C) , ps/2 # 5. # 6 .

X (Xlib), x y. , , Xlib ( ), , . [. # 8 " ", X.] XInput 2.0 ( # 10), X API (, -lX11 -lXi).

:

1: - "/dev/input/mouse0" - ( , , , /dev/input/event 4 ).

2: . . , raw- ps/2, , [n], , 2- 3- 3 , x, y. X. Y. int8_t ( 8 ) . X, , , ; Y ( ), Y ( , ).

: open/read, fopen/getc, X (. # 7 ). , 3 x y, . [ , "", .] , Linux, , "" "", 1 ( ^ A ^ @ <FF> ). , , . № 5 Microsoft intellimouse 4 5 . # 11 / ps 2 . , . ( # 9, xdotool), , . , root ( ).

0

Source: https://habr.com/ru/post/1785592/


All Articles