Xi: remove RemoveOtherCoreGrabs()

PickPointer() returns grabbed devices, so we can't get a double grab anyway.
This commit is contained in:
Peter Hutterer 2008-04-25 16:28:58 +09:30
parent be5ff2b8d8
commit 1d0438de17
2 changed files with 0 additions and 51 deletions

View File

@ -5161,9 +5161,6 @@ ProcGrabPointer(ClientPtr client)
if (oldCursor)
FreeCursor (oldCursor, (Cursor)0);
rep.status = GrabSuccess;
/* guarantee only one core pointer grab at a time by this client */
RemoveOtherCoreGrabs(client, device);
}
WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
return Success;
@ -5344,47 +5341,6 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
return Success;
}
/**
* Deactivate any core grabs on the given client except the given device.
*
* This fixes race conditions where clients deal with implicit passive grabs
* on one device, but then actively grab their client pointer, which is
* another device.
*
* Grabs are only removed if the other device matches the type of device. If
* dev is a pointer device, only other pointer grabs are removed. Likewise, if
* dev is a keyboard device, only keyboard grabs are removed.
*
* If dev doesn't have a grab, do nothing and go for a beer.
*
* @param client The client that is to be limited.
* @param dev The only device allowed to have a grab on the client.
*/
_X_EXPORT void
RemoveOtherCoreGrabs(ClientPtr client, DeviceIntPtr dev)
{
if (!dev || !dev->deviceGrab.grab)
return;
DeviceIntPtr it = inputInfo.devices;
for (; it; it = it->next)
{
if (it == dev)
continue;
/* check for IsPointer Device */
if (it->deviceGrab.grab &&
it->deviceGrab.grab->coreGrab &&
SameClient(it->deviceGrab.grab, client))
{
if ((IsPointerDevice(dev) && IsPointerDevice(it)) ||
(IsKeyboardDevice(dev) && IsKeyboardDevice(it)))
(*it->deviceGrab.DeactivateGrab)(it);
}
}
}
/**
* Server-side protocol handling for GrabKeyboard request.
*
@ -5405,9 +5361,6 @@ ProcGrabKeyboard(ClientPtr client)
stuff->ownerEvents, stuff->time,
KeyPressMask | KeyReleaseMask, &rep.status, TRUE);
/* ensure only one core keyboard grab by this client */
RemoveOtherCoreGrabs(client, keyboard);
if (result != Success)
return result;
rep.type = X_Reply;

View File

@ -460,10 +460,6 @@ extern int GrabDevice(
CARD8 * /* status */,
Bool /* coreGrab */);
extern void RemoveOtherCoreGrabs(
ClientPtr /* client */,
DeviceIntPtr /* dev */);
extern void InitEvents(void);
extern void InitSprite(
DeviceIntPtr /* pDev */,