[RFC XI 2.1] Implementation patches (without grab support)
chase.douglas at canonical.com
Fri Nov 12 14:35:00 PST 2010
In the past two weeks I took Daniel Stone's initial XI 2.1 multitouch
implementation and reworked it to push it forward.
The major issue with Daniel's approach was the hardcoding of much of the
per-touch data in the protocol. For example, the proposal codified touch
size to be described in one and only one way. However, touch hardware
thus far have presented touch size in many different possible ways. Some
define it as a single number, like a diameter of a circle. Others define
it as an upright rectangle with a width and a height. Further, Apple
devices define it as a elipse with an orientation.
Rather than codifying one way of describing a touch size and shape, I
decided to leave each bit of meta data as a valuator axis. This is the
approach Peter Hutterer proposed, and I followed it fairly closely.
The basic idea is that an input device defines one touch class and a
number of touch axis classes, one for each type of metadata. Three touch
axis classes are required for the device to function: an x axis, a y
axis, and a touch ID axis. Note that I built the support on top of the
new masked valuators input API, so any of these axes or other metadata
axes may be updated individually. The one requirement is the touch ID
axis must always be provided.
Another change from Daniel's implementation is that touch events are
sent to all clients who register on any window within the window trace
of a touch. If three clients register on the root window, a top level
window, and a sub-window respectively, and the touch begins within the
sub-window, then all three clients will receive the event. However, the
window closest to the root window "owns" the event, and all other
clients see a flag informing them the events are not theirs to use in a
non-reversible manner yet (one example: they could start gesture
recognition in the hope that they become the owner for the touches at
some point). Please note that these semantics are not set in stone and
are not even implemented in this patch set outside of the event
My intention with this release of patches is to generate a discussion
and eventual agreement on the base support: event subscription mechanics
and event structure for typical (non-grabbed) events. From there we can
continue on through grabbing semantics. I have not updated XI2proto.txt
in the inputproto package, but one may refer to Peter's proposal at
for guidance, as the basic support implemented here matches.
I will be following this message with a bunch of patches to a bunch of
X components. I am maintaining all the source code in my own
repositories at cgit.freedesktop.org (acct name cndougla), and right now
this code exists in the xi2.1-new branches (xi2.1-new-stable for
xserver). Some of the patches are merely bug fixes that need to be
merged; I need to get off my butt and push them appropriately :).
I have pushed a set of packages to a PPA on Launchpad.net. If you run
Ubuntu you can install the packages or follow development by going here:
https://wiki.ubuntu.com/Multitouch/XDevelopment. Note that I've been
developing against xserver 1.9 (master for everything else) due to ABI
breakage issues when I started. The xserver source code is essentially
1.9 plus a backport of the X input ABI 12 work. I believe it should be
trivial to rebase the xserver patches on top of master, and I will
likely do so after the merge window closes for 1.10 on Dec 1st.
More information about the xorg-devel