Multitouch followup: gesture recognition?

Florian Echtler floe at
Wed Mar 31 02:45:18 PDT 2010

> >> This seems essential to your approach, so the feasibility of a server
> >> extension (oranything else, but a extension incurs overhead) depends a
> >> fair bit on the dynamics of your gesture customization.
> > Just specifying what gestures a specific window would be interested in
> > wouldn't usually be "live", would it? That's something defined at
> > creation time and maybe changed occasionally over the lifetime, but not
> > constantly.
> Which is why a declarative approach is OK for that. It's the dynamics
> that make it harder. More specificially, the dynamic part of your
> formalism likely needs tailored requests.
The reason for this being that the special client won't be notified of
property changes on other client windows, correct?

> If you want to try a special client, it's therefore sensible to divide
> your requests and events into route-through (client -> special gesture
> client or sgc -> client) and server-processed (server->sgc or sgc->
> server), if possible.
As far as I understand the architecture, everything except the plain
input events would be just routed through the server between the two
clients. In fact, I guess that after defining some custom events in
inputproto, it should be possible to send them through

> >> So whether a special client detects gestures or the server itself, the
> >> server needs to deliver events, and the client needs to be able to
> >> receive them. This is where XGE and libXi kick in.
> > Okay, it seems I'm slowly getting it. Please have a look at the attached
> > PDF - this should illustrate the combination of 2/4, correct? (the
> > normal Xinput events should probably be duplicated to the clients in the
> > classical manner).
> Yes, that's very much the picture I have in mind. For completeness'
> sake, you might want libXi or libXgesture in clients.
> At any rate, it shouldn't matter to clients what instance (server
> component, special client, *) actually detects gestures. They only see
> the server extension, or a prototype XInput + gesture requests/events.
Right, that's probably more or less transparent from a client

One other question, though: how would the special client go about
receiving copies of the input events destined for the regular clients?
AFAICT a pointer grab is quite the wrong way; I've already used
something along the lines of

// select motion events for entire screen
XIEventMask mask;
mask.deviceid = XIAllDevices;
mask.mask_len = XIMaskLen( XI_LASTEVENT );
mask.mask = (unsigned char*)calloc( mask.mask_len, sizeof(char) );

XISetMask( mask.mask, XI_Motion );
XISetMask( mask.mask, XI_ButtonPress );
XISetMask( mask.mask, XI_ButtonRelease );

XISelectEvents( display, DefaultRootWindow(display), &mask, 1 );
free( mask.mask );

to capture all XInput events, however, I believe that's also quite
flawed. What other options exist?

Many thanks,
0666 - Filemode of the Beast

More information about the xorg-devel mailing list