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, error = GrabDevice(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->grabWindow, stuff->other_devices_mode, stuff->grabWindow,
stuff->ownerEvents, stuff->time, stuff->ownerEvents, stuff->time,
tmp[stuff->deviceid].mask, &rep.status); tmp[stuff->deviceid].mask, &rep.status, FALSE);
if (error != Success) { if (error != Success) {
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error); SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);

View File

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

View File

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