Friday, April 29, 2011

Pointers, pointers, pointers ...

Because of a really long period of silence I wish to show you a nice feature of Xorg: XInput2

First of all let's list the input devices:


marian@marian-laptop:~$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ A4Tech PS/2+USB Mouse id=9 [slave pointer (2)]
⎜ ↳ TPPS/2 IBM TrackPoint id=14 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Integrated Camera id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
↳ ThinkPad Extra Buttons id=15 [slave keyboard (3)]
↳ CHICONY USB NetVista Full Width Keyboard id=11 [slave keyboard (3)]



You can see that on my laptop I have several input devices that control a single pointer (The "Virtual core pointer" with id=2).

Lets suppose that I want to remove the "Synaptics TouchPad" (id=13) from the core pointer and attach to a new pointer.

First of all let's create a new pointer:
marian@marian-laptop:~$ xinput create-master Secondary


And now reattach input device with id 13 to the new pointer:

xinput reattach 13 "Secondary pointer"


And guess what ? You have two independent pointers (controlled by separate input devices). :)