Make GrabDevice differ between core grabs and device grabs.

This commit is contained in:
Peter Hutterer 2007-04-03 15:06:26 +09:30
parent e8777a91f3
commit 9b0b340668
3 changed files with 12 additions and 9 deletions

View File

@ -141,7 +141,7 @@ ProcXGrabDevice(ClientPtr client)
error = GrabDevice(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
tmp[stuff->deviceid].mask, &rep.status);
tmp[stuff->deviceid].mask, &rep.status, FALSE);
if (error != Success) {
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);

View File

@ -4110,12 +4110,14 @@ ProcUngrabPointer(ClientPtr client)
int
GrabDevice(ClientPtr client, DeviceIntPtr dev,
unsigned this_mode, unsigned other_mode, Window grabWindow,
unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status)
unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status,
Bool coreGrab)
{
WindowPtr pWin;
GrabPtr grab;
TimeStamp time;
int rc;
GrabInfoPtr grabInfo = (coreGrab) ? &dev->coreGrab : &dev->deviceGrab;
UpdateCurrentTime();
if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync))
@ -4137,16 +4139,16 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
if (rc != Success)
return rc;
time = ClientTimeToServerTime(ctime);
grab = dev->coreGrab.grab;
grab = grabInfo->grab;
if (grab && !SameClient(grab, client))
*status = AlreadyGrabbed;
else if (!pWin->realized)
*status = GrabNotViewable;
else if ((CompareTimeStamps(time, currentTime) == LATER) ||
(CompareTimeStamps(time, dev->coreGrab.grabTime) == EARLIER))
(CompareTimeStamps(time, grabInfo->grabTime) == EARLIER))
*status = GrabInvalidTime;
else if (dev->coreGrab.sync.frozen &&
dev->coreGrab.sync.other && !SameClient(dev->coreGrab.sync.other, client))
else if (grabInfo->sync.frozen &&
grabInfo->sync.other && !SameClient(grabInfo->sync.other, client))
*status = GrabFrozen;
else
{
@ -4164,7 +4166,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
tempGrab.device = dev;
tempGrab.cursor = NULL;
(*dev->coreGrab.ActivateGrab)(dev, &tempGrab, time, FALSE);
(*grabInfo->ActivateGrab)(dev, &tempGrab, time, FALSE);
*status = GrabSuccess;
}
return Success;
@ -4184,7 +4186,7 @@ ProcGrabKeyboard(ClientPtr client)
result = GrabDevice(client, keyboard, stuff->keyboardMode,
stuff->pointerMode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
KeyPressMask | KeyReleaseMask, &rep.status);
KeyPressMask | KeyReleaseMask, &rep.status, TRUE);
else {
result = Success;
rep.status = AlreadyGrabbed;

View File

@ -485,7 +485,8 @@ extern int GrabDevice(
unsigned /* ownerEvents */,
Time /* ctime */,
Mask /* mask */,
CARD8 * /* status */);
CARD8 * /* status */,
Bool /* coreGrab */);
extern void InitEvents(void);
extern void InitSprite(