Problem in AllowSome() function in Xorg

Park Sung-Jin input.hacker at gmail.com
Mon Apr 11 03:08:42 PDT 2011


Hello,
I'm developing some multitouch applications under X11R7.6.
I have a problem related to AllowSome() in Xorg server.

Basically, my multitouch X driver is based on Benjamin's
evdev-multitouch driver.
There are two pointer devices in my Xorg server.
(Two logical pointer devices on a physical touch screen)
The first one (id=9)  is 'SlavePointer' which is connected to VCP.
The second (id=10) is 'FloatingSlave' which is detached from VCP.

If I touch(=press) on a window of a client with two fingers(id=9, 10)
and release very quickly, the grab of the button(id=9) was not removed
even if I released the button.
According to my observation, though Xorg server tries to remove the
grab of the button(id=9), the grab cannot be removed because of the
'grabTime'.

When I touch on the window of the client with two fingers, each grab
for each finger's button will be created.
Let's assume that the grabTime of the first finger was gt1 and second
finger's grabTime was gt2 which was bigger than gt1.
At the moment, if the client sent an 'AllowEvent' request to Xorg
server to ReplayPointer,
Xorg server checked whether the grabTime(cgt) from the client is valid or not.
The grabTime(cgt) must be in between the server's grabTime(gt1) and
server's currentTime.

But in AllowSome() function, grabTime(gt1) was updated to gt2.
==========================================================
void
AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
{
    ...
    for (dev = inputInfo.devices; dev; dev = dev->next)
    {
        devgrabinfo = &dev->deviceGrab;

	if (dev == thisDev)
	    continue;
	if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
	{
	    if (!(thisGrabbed || otherGrabbed) ||
		(CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER))
		grabTime = devgrabinfo->grabTime;
	    otherGrabbed = TRUE;
	    if (grabinfo->sync.other == devgrabinfo->grab)
		thisSynced = TRUE;
	    if (devgrabinfo->sync.state >= FROZEN)
		othersFrozen = TRUE;
	}
    }
    …
}
==========================================================

After updated grabTime, server checked both of the following:
(1) grabTime(gt2) <= cgt
(2) cgt <= currentTime

As you can see, cgt was smaller than gt2, so server does nothing and
returns without removing 1st finger's grab.
Please let me know what to do for solving this problem. :)

Thanks.
Sung-Jin Park


More information about the xorg-devel mailing list