Grab of pointer device breaks touch consistency
We're implementing touch support in TigerVNC and we've stumbled on this rather nasty bug in the X server:
a) Press a finger, get a TouchBegin
b) Open Activities in GNOME
At this point we get no more events. Not even a TouchEnd to inform us that GNOME has taken over this touch point. This badly breaks TigerVNC (and probably other stuff) as we get a wedged touch point for which we never get a TouchEnd.
After some debugging we're fairly sure this code in Xi/exevents.c
is the culprit:
else if (ti->emulate_pointer && dev->deviceGrab.grab &&
!dev->deviceGrab.fromPassiveGrab) {
/* There may be an active pointer grab on the device */
*grab = dev->deviceGrab.grab;
}
What we think happens is that GNOME does a grab on the pointer when opening Activities, and the above code then just blindly stops event delivery to all listeners on the relevant device.
I'm not sure what the fix here, but something needs to be done to give a consistent event flow to touch listeners. So either a) keep delivering events even if a grab has been activated, or b) force some ownership change so existing listeners get a TouchEnd.
PS. Given a casual reading of the code it also looks like the grabbing client (GNOME in this case) might get duplicated events as the above code is run once per listener and not once per event.
(also see #847 which somewhat contradicts this, but it's not quite the same scenario so there are more gremlins in the grab handling for touch)