First XI2 server implementation
peter.hutterer at who-t.net
Sat Mar 21 05:27:22 PDT 2009
I'm happy to announce that I have a working XI2 implementation. Grab the
Check out the xi2 branch on all four.
FWIW, I've been running this branch (and a devel branch on top of it) for
weeks now and (after fixing a particularly nasty bug) it works without issues.
I've also finished up the heavy rebasing, and I'm expecting more linear work
on it now.
=== What is implemented: ===
The current protocol specification is in inputproto/XI2proto.txt and in most
places identical to
- raw events do not include button state
- FP1616 type implemented as INT16.CARD16
- Enter/leave events include button/modifier state
- Focus events added - basically identical to enter/leave events.
=== Noteable things: ===
- This will break any MPX/XI2 app, if you have any. The libXi API has changed.
XI 1.x and XI2 are now separate, so XI2 apps only need to include XInput2.h,
etc. The mix of XI1 and XI2 is not recommended.
- While the protocol and the library support subpixels, the server doesn't
actually send them down the wire yet.
- I've tried to make the libXi API easier to use than the XI 1.x API. The main
- All calls are prefixed with XI (protocol types are prefixed with xXI).
- XDevice* pointers are gone. All calls use the deviceid only.
- Event masks and event types are fixed numbers, no XEventClass anymore.
- Devices don't need to be opened/closed to be used.
- There's an AllDevices and AllMasterDevices fake device id to register for
events from all devices or all master devices respectively.
- The protocol uses uint32_t and friends instead of CARD32 and misc typedefs.
- This is the first XI2 implementation, requests available in XI1 do not
necessarily have a matching counterpart yet.
- Device id's have shifted. VCP and VCK have device ids 2 and 3 now instead of
0 and 1.
=== What is missing: ===
- XI2 grabs, active and passive (incl. keysym grabs)
- getting the motion history
- do-not-propagate masks
- retrieving window event masks
- device property requests for 16 bit deviceids
There are no protocol requests to grab for XI2 events yet. There's a reason
for that: I'm currently experimenting with getting rid of the master
pointer/master keyboard distinction in favour of a single master device that
is both at the same time.
This turned out to be ... tricky.
=== How to go from here? ===
The above is what will be part of XI 2.0 and I would like it have a low
wtf/min count when people start writing code against it. XI 1 has a few more
requests that I do not plan to make part of XI 2.0. It's easy to add requests
and events if we find something is desparately missing.
One example for this are grab priorities. I think it is better to hold off for
2.1 with them.
I will post additional protocol request once I figured out the grab semantics
for the single master device case. So far, I have not been able to reach the
level of intoxication required to sort them out.
=== How can you help? ===
It's crunchtime for XI2. If something doesn't make sense, typos, bugs, please
let me know. There's bound to be some stupidities in there, so please point
them out when your find them. If you're running git master already, you can
help testing by simply switching to the xi2 branch. On a standard desktop, you
shouldn't notice any difference.
Any comments and help with the implementation are of course appreciated. There
are a few low fruits (e.g. XIGetEventMask, XISetDoNotPropagateMask, ...) that
would serve as an ideal starting point to get familiar with the code.
Feel free to write applications to test the API. It is not set in stone yet,
there's room for movement. I acknowledge that without grab requests it will be
hard to actually write anything decent.
Note that XIRawEvents are already supported (relative mouse events) - maybe
this alone may motivate some to test this branch.
has a short example that demonstrates how to register for events.
More information about the xorg-devel