Remove double-grab option. We only want one grab per device.

This commit is contained in:
Peter Hutterer 2007-05-14 12:34:53 +09:30
parent 4dc973f08c
commit 5c680e9493
9 changed files with 121 additions and 195 deletions

View File

@ -822,13 +822,10 @@ CALLBACK(SecurityCheckDeviceAccess)
untrusted_got_event = FALSE; untrusted_got_event = FALSE;
found_event_window = FALSE; found_event_window = FALSE;
/* We can just use coreGrab as a comment a few lines above clearly states if (dev->deviceGrab.grab)
"device security other than keyboard is not implemented yet". The core
kbd should never have a device grab set. */
if (dev->coreGrab.grab)
{ {
untrusted_got_event = untrusted_got_event =
(TRUSTLEVEL(rClient(dev->coreGrab.grab)) != XSecurityClientTrusted); (TRUSTLEVEL(rClient(dev->deviceGrab.grab)) != XSecurityClientTrusted);
} }
else else
{ {

View File

@ -100,16 +100,14 @@ RegisterOtherDevice(DeviceIntPtr device)
{ {
device->public.processInputProc = ProcessOtherEvent; device->public.processInputProc = ProcessOtherEvent;
device->public.realInputProc = ProcessOtherEvent; device->public.realInputProc = ProcessOtherEvent;
(device)->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
(device)->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
if (DeviceIsPointerType(device)) if (DeviceIsPointerType(device))
{ {
(device)->coreGrab.ActivateGrab = ActivatePointerGrab; (device)->deviceGrab.ActivateGrab = ActivatePointerGrab;
(device)->coreGrab.DeactivateGrab = DeactivatePointerGrab; (device)->deviceGrab.DeactivateGrab = DeactivatePointerGrab;
} else } else
{ {
(device)->coreGrab.ActivateGrab = ActivateKeyboardGrab; (device)->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
(device)->coreGrab.DeactivateGrab = DeactivateKeyboardGrab; (device)->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
} }
} }

View File

@ -111,7 +111,7 @@ ProcXUngrabDevice(ClientPtr client)
time = ClientTimeToServerTime(stuff->time); time = ClientTimeToServerTime(stuff->time);
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) && (CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) &&
(grab) && SameClient(grab, client)) (grab) && SameClient(grab, client) && !grab->coreGrab)
(*dev->deviceGrab.DeactivateGrab) (dev); (*dev->deviceGrab.DeactivateGrab) (dev);
return Success; return Success;
} }

View File

@ -126,16 +126,6 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart)
dev->deviceProc = deviceProc; dev->deviceProc = deviceProc;
dev->startup = autoStart; dev->startup = autoStart;
/* core grab defaults */
dev->coreGrab.sync.frozen = FALSE;
dev->coreGrab.sync.other = NullGrab;
dev->coreGrab.sync.state = NOT_GRABBED;
dev->coreGrab.sync.event = (xEvent *) NULL;
dev->coreGrab.sync.evcount = 0;
dev->coreGrab.grab = NullGrab;
dev->coreGrab.grabTime = currentTime;
dev->coreGrab.fromPassiveGrab = FALSE;
/* device grab defaults */ /* device grab defaults */
dev->deviceGrab.sync.frozen = FALSE; dev->deviceGrab.sync.frozen = FALSE;
dev->deviceGrab.sync.other = NullGrab; dev->deviceGrab.sync.other = NullGrab;
@ -438,8 +428,8 @@ InitCoreDevices(void)
dev->public.processInputProc = ProcessKeyboardEvent; dev->public.processInputProc = ProcessKeyboardEvent;
dev->public.realInputProc = ProcessKeyboardEvent; dev->public.realInputProc = ProcessKeyboardEvent;
#endif #endif
dev->coreGrab.ActivateGrab = ActivateKeyboardGrab; dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
dev->coreGrab.DeactivateGrab = DeactivateKeyboardGrab; dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
dev->coreEvents = FALSE; dev->coreEvents = FALSE;
dev->spriteInfo->spriteOwner = FALSE; dev->spriteInfo->spriteOwner = FALSE;
if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex)) if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
@ -464,8 +454,8 @@ InitCoreDevices(void)
dev->public.processInputProc = ProcessPointerEvent; dev->public.processInputProc = ProcessPointerEvent;
dev->public.realInputProc = ProcessPointerEvent; dev->public.realInputProc = ProcessPointerEvent;
#endif #endif
dev->coreGrab.ActivateGrab = ActivatePointerGrab; dev->deviceGrab.ActivateGrab = ActivatePointerGrab;
dev->coreGrab.DeactivateGrab = DeactivatePointerGrab; dev->deviceGrab.DeactivateGrab = DeactivatePointerGrab;
dev->coreEvents = FALSE; dev->coreEvents = FALSE;
dev->spriteInfo->spriteOwner = TRUE; dev->spriteInfo->spriteOwner = TRUE;
if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex)) if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
@ -663,7 +653,6 @@ CloseDevice(DeviceIntPtr dev)
if (dev->devPrivates) if (dev->devPrivates)
xfree(dev->devPrivates); xfree(dev->devPrivates);
xfree(dev->coreGrab.sync.event);
xfree(dev->deviceGrab.sync.event); xfree(dev->deviceGrab.sync.event);
xfree(dev->spriteInfo); xfree(dev->spriteInfo);
xfree(dev); xfree(dev);
@ -2030,7 +2019,7 @@ ProcGetPointerControl(ClientPtr client)
void void
MaybeStopHint(DeviceIntPtr dev, ClientPtr client) MaybeStopHint(DeviceIntPtr dev, ClientPtr client)
{ {
GrabPtr grab = dev->coreGrab.grab; GrabPtr grab = dev->deviceGrab.grab;
if ((grab && SameClient(grab, client) && if ((grab && SameClient(grab, client) &&
((grab->eventMask & PointerMotionHintMask) || ((grab->eventMask & PointerMotionHintMask) ||

View File

@ -539,7 +539,7 @@ XineramaCheckVirtualMotion(
pSprite->hot.pScreen = qe->pScreen; /* should always be Screen 0 */ pSprite->hot.pScreen = qe->pScreen; /* should always be Screen 0 */
pSprite->hot.x = qe->event->u.keyButtonPointer.rootX; pSprite->hot.x = qe->event->u.keyButtonPointer.rootX;
pSprite->hot.y = qe->event->u.keyButtonPointer.rootY; pSprite->hot.y = qe->event->u.keyButtonPointer.rootY;
pWin = pDev->coreGrab.grab ? pDev->coreGrab.grab->confineTo : pWin = pDev->deviceGrab.grab ? pDev->deviceGrab.grab->confineTo :
NullWindow; NullWindow;
} }
if (pWin) if (pWin)
@ -862,7 +862,7 @@ CheckVirtualMotion(
pSprite->hot.pScreen = qe->pScreen; pSprite->hot.pScreen = qe->pScreen;
pSprite->hot.x = qe->event->u.keyButtonPointer.rootX; pSprite->hot.x = qe->event->u.keyButtonPointer.rootX;
pSprite->hot.y = qe->event->u.keyButtonPointer.rootY; pSprite->hot.y = qe->event->u.keyButtonPointer.rootY;
pWin = pDev->coreGrab.grab ? pDev->coreGrab.grab->confineTo : NullWindow; pWin = pDev->deviceGrab.grab ? pDev->deviceGrab.grab->confineTo : NullWindow;
} }
if (pWin) if (pWin)
{ {
@ -991,7 +991,7 @@ static void
PostNewCursor(DeviceIntPtr pDev) PostNewCursor(DeviceIntPtr pDev)
{ {
WindowPtr win; WindowPtr win;
GrabPtr grab = pDev->coreGrab.grab; GrabPtr grab = pDev->deviceGrab.grab;
SpritePtr pSprite = pDev->spriteInfo->sprite; SpritePtr pSprite = pDev->spriteInfo->sprite;
CursorPtr pCursor; CursorPtr pCursor;
@ -1197,7 +1197,7 @@ PlayReleasedEvents(void)
prev = &syncEvents.pending; prev = &syncEvents.pending;
while ( (qe = *prev) ) while ( (qe = *prev) )
{ {
if (!qe->device->coreGrab.sync.frozen) if (!qe->device->deviceGrab.sync.frozen)
{ {
*prev = qe->next; *prev = qe->next;
pDev = qe->device; pDev = qe->device;
@ -1223,7 +1223,7 @@ PlayReleasedEvents(void)
(*qe->device->public.processInputProc)(qe->event, qe->device, (*qe->device->public.processInputProc)(qe->event, qe->device,
qe->evcount); qe->evcount);
xfree(qe); xfree(qe);
for (dev = inputInfo.devices; dev && dev->coreGrab.sync.frozen; dev = dev->next) for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next)
; ;
if (!dev) if (!dev)
break; break;
@ -1239,7 +1239,7 @@ PlayReleasedEvents(void)
static void static void
FreezeThaw(DeviceIntPtr dev, Bool frozen) FreezeThaw(DeviceIntPtr dev, Bool frozen)
{ {
dev->coreGrab.sync.frozen = frozen; dev->deviceGrab.sync.frozen = frozen;
if (frozen) if (frozen)
dev->public.processInputProc = dev->public.enqueueInputProc; dev->public.processInputProc = dev->public.enqueueInputProc;
else else
@ -1258,15 +1258,15 @@ ComputeFreezes(void)
DeviceIntPtr dev; DeviceIntPtr dev;
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
FreezeThaw(dev, dev->coreGrab.sync.other || FreezeThaw(dev, dev->deviceGrab.sync.other ||
(dev->coreGrab.sync.state >= FROZEN)); (dev->deviceGrab.sync.state >= FROZEN));
if (syncEvents.playingEvents || (!replayDev && !syncEvents.pending)) if (syncEvents.playingEvents || (!replayDev && !syncEvents.pending))
return; return;
syncEvents.playingEvents = TRUE; syncEvents.playingEvents = TRUE;
if (replayDev) if (replayDev)
{ {
xE = replayDev->coreGrab.sync.event; xE = replayDev->deviceGrab.sync.event;
count = replayDev->coreGrab.sync.evcount; count = replayDev->deviceGrab.sync.evcount;
syncEvents.replayDev = (DeviceIntPtr)NULL; syncEvents.replayDev = (DeviceIntPtr)NULL;
w = XYToWindow(replayDev, XE_KBPTR.rootX, XE_KBPTR.rootY); w = XYToWindow(replayDev, XE_KBPTR.rootX, XE_KBPTR.rootY);
@ -1294,7 +1294,7 @@ ComputeFreezes(void)
playmore: playmore:
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
if (!dev->coreGrab.sync.frozen) if (!dev->deviceGrab.sync.frozen)
{ {
PlayReleasedEvents(); PlayReleasedEvents();
break; break;
@ -1307,7 +1307,7 @@ playmore:
{ {
/* the following may have been skipped during replay, /* the following may have been skipped during replay,
so do it now */ so do it now */
if ((grab = dev->coreGrab.grab) && grab->confineTo) if ((grab = dev->deviceGrab.grab) && grab->confineTo)
{ {
if (grab->confineTo->drawable.pScreen != if (grab->confineTo->drawable.pScreen !=
dev->spriteInfo->sprite->hotPhys.pScreen) dev->spriteInfo->sprite->hotPhys.pScreen)
@ -1336,7 +1336,7 @@ ScreenRestructured (ScreenPtr pScreen)
/* GrabDevice doesn't have a confineTo field, so we don't need to /* GrabDevice doesn't have a confineTo field, so we don't need to
* worry about it. */ * worry about it. */
if ((grab = pDev->coreGrab.grab) && grab->confineTo) if ((grab = pDev->deviceGrab.grab) && grab->confineTo)
{ {
if (grab->confineTo->drawable.pScreen if (grab->confineTo->drawable.pScreen
!= pDev->spriteInfo->sprite->hotPhys.pScreen) != pDev->spriteInfo->sprite->hotPhys.pScreen)
@ -1354,31 +1354,31 @@ ScreenRestructured (ScreenPtr pScreen)
void void
CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
{ {
GrabPtr grab = thisDev->coreGrab.grab; GrabPtr grab = thisDev->deviceGrab.grab;
DeviceIntPtr dev; DeviceIntPtr dev;
if (thisMode == GrabModeSync) if (thisMode == GrabModeSync)
thisDev->coreGrab.sync.state = FROZEN_NO_EVENT; thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT;
else else
{ /* free both if same client owns both */ { /* free both if same client owns both */
thisDev->coreGrab.sync.state = THAWED; thisDev->deviceGrab.sync.state = THAWED;
if (thisDev->coreGrab.sync.other && if (thisDev->deviceGrab.sync.other &&
(CLIENT_BITS(thisDev->coreGrab.sync.other->resource) == (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) ==
CLIENT_BITS(grab->resource))) CLIENT_BITS(grab->resource)))
thisDev->coreGrab.sync.other = NullGrab; thisDev->deviceGrab.sync.other = NullGrab;
} }
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
if (dev != thisDev) if (dev != thisDev)
{ {
if (otherMode == GrabModeSync) if (otherMode == GrabModeSync)
dev->coreGrab.sync.other = grab; dev->deviceGrab.sync.other = grab;
else else
{ /* free both if same client owns both */ { /* free both if same client owns both */
if (dev->coreGrab.sync.other && if (dev->deviceGrab.sync.other &&
(CLIENT_BITS(dev->coreGrab.sync.other->resource) == (CLIENT_BITS(dev->deviceGrab.sync.other->resource) ==
CLIENT_BITS(grab->resource))) CLIENT_BITS(grab->resource)))
dev->coreGrab.sync.other = NullGrab; dev->deviceGrab.sync.other = NullGrab;
} }
} }
} }
@ -1402,8 +1402,7 @@ void
ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
TimeStamp time, Bool autoGrab) TimeStamp time, Bool autoGrab)
{ {
GrabInfoPtr grabinfo = GrabInfoPtr grabinfo = &mouse->deviceGrab;
(grab->coreGrab) ? &mouse->coreGrab : &mouse->deviceGrab;
WindowPtr oldWin = (grabinfo->grab) ? WindowPtr oldWin = (grabinfo->grab) ?
grabinfo->grab->window grabinfo->grab->window
: mouse->spriteInfo->sprite->win; : mouse->spriteInfo->sprite->win;
@ -1440,17 +1439,17 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
void void
DeactivatePointerGrab(DeviceIntPtr mouse) DeactivatePointerGrab(DeviceIntPtr mouse)
{ {
GrabPtr grab = mouse->coreGrab.grab; GrabPtr grab = mouse->deviceGrab.grab;
DeviceIntPtr dev; DeviceIntPtr dev;
mouse->valuator->motionHintWindow = NullWindow; mouse->valuator->motionHintWindow = NullWindow;
mouse->coreGrab.grab = NullGrab; mouse->deviceGrab.grab = NullGrab;
mouse->coreGrab.sync.state = NOT_GRABBED; mouse->deviceGrab.sync.state = NOT_GRABBED;
mouse->coreGrab.fromPassiveGrab = FALSE; mouse->deviceGrab.fromPassiveGrab = FALSE;
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
if (dev->coreGrab.sync.other == grab) if (dev->deviceGrab.sync.other == grab)
dev->coreGrab.sync.other = NullGrab; dev->deviceGrab.sync.other = NullGrab;
} }
DoEnterLeaveEvents(mouse, grab->window, DoEnterLeaveEvents(mouse, grab->window,
mouse->spriteInfo->sprite->win, NotifyUngrab); mouse->spriteInfo->sprite->win, NotifyUngrab);
@ -1470,8 +1469,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
void void
ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
{ {
GrabInfoPtr grabinfo = GrabInfoPtr grabinfo = &keybd->deviceGrab;
(grab->coreGrab) ? &keybd->coreGrab : &keybd->deviceGrab;
WindowPtr oldWin; WindowPtr oldWin;
if (grabinfo->grab) if (grabinfo->grab)
@ -1501,7 +1499,7 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool pass
void void
DeactivateKeyboardGrab(DeviceIntPtr keybd) DeactivateKeyboardGrab(DeviceIntPtr keybd)
{ {
GrabPtr grab = keybd->coreGrab.grab; GrabPtr grab = keybd->deviceGrab.grab;
DeviceIntPtr dev; DeviceIntPtr dev;
WindowPtr focusWin = keybd->focus ? keybd->focus->win WindowPtr focusWin = keybd->focus ? keybd->focus->win
: keybd->spriteInfo->sprite->win; : keybd->spriteInfo->sprite->win;
@ -1513,20 +1511,20 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
focusWin = inputInfo.keyboard->focus->win; focusWin = inputInfo.keyboard->focus->win;
if (keybd->valuator) if (keybd->valuator)
keybd->valuator->motionHintWindow = NullWindow; keybd->valuator->motionHintWindow = NullWindow;
keybd->coreGrab.grab = NullGrab; keybd->deviceGrab.grab = NullGrab;
keybd->coreGrab.sync.state = NOT_GRABBED; keybd->deviceGrab.sync.state = NOT_GRABBED;
keybd->coreGrab.fromPassiveGrab = FALSE; keybd->deviceGrab.fromPassiveGrab = FALSE;
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
if (dev->coreGrab.sync.other == grab) if (dev->deviceGrab.sync.other == grab)
dev->coreGrab.sync.other = NullGrab; dev->deviceGrab.sync.other = NullGrab;
} }
DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
ComputeFreezes(); ComputeFreezes();
} }
/* /*
* Core flag decides whether to work on the coreGrab or deviceGrab sync * Core flag decides whether to work on the deviceGrab or deviceGrab sync
* fields. * fields.
*/ */
void void
@ -1540,7 +1538,7 @@ AllowSome(ClientPtr client,
TimeStamp grabTime; TimeStamp grabTime;
DeviceIntPtr dev; DeviceIntPtr dev;
GrabInfoPtr devgrabinfo, GrabInfoPtr devgrabinfo,
grabinfo = (core) ? &thisDev->coreGrab : &thisDev->deviceGrab; grabinfo = (core) ? &thisDev->deviceGrab : &thisDev->deviceGrab;
thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client); thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client);
thisSynced = FALSE; thisSynced = FALSE;
@ -1549,7 +1547,7 @@ AllowSome(ClientPtr client,
grabTime = grabinfo->grabTime; grabTime = grabinfo->grabTime;
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
devgrabinfo = (core) ? &dev->coreGrab : &dev->deviceGrab; devgrabinfo = (core) ? &dev->deviceGrab : &dev->deviceGrab;
if (dev == thisDev) if (dev == thisDev)
continue; continue;
@ -1595,7 +1593,7 @@ AllowSome(ClientPtr client,
{ {
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
devgrabinfo = (core) ? &dev->coreGrab : &dev->deviceGrab; devgrabinfo = (core) ? &dev->deviceGrab : &dev->deviceGrab;
if (devgrabinfo->grab if (devgrabinfo->grab
&& SameClient(devgrabinfo->grab, client)) && SameClient(devgrabinfo->grab, client))
devgrabinfo->sync.state = THAWED; devgrabinfo->sync.state = THAWED;
@ -1611,7 +1609,7 @@ AllowSome(ClientPtr client,
{ {
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
devgrabinfo = (core) ? &dev->coreGrab : &dev->deviceGrab; devgrabinfo = (core) ? &dev->deviceGrab : &dev->deviceGrab;
if (devgrabinfo->grab if (devgrabinfo->grab
&& SameClient(devgrabinfo->grab, client)) && SameClient(devgrabinfo->grab, client))
devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT; devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT;
@ -1640,7 +1638,7 @@ AllowSome(ClientPtr client,
{ {
if (dev == thisDev) if (dev == thisDev)
continue; continue;
devgrabinfo = (core) ? &dev->coreGrab : &dev->deviceGrab; devgrabinfo = (core) ? &dev->deviceGrab : &dev->deviceGrab;
if (devgrabinfo->grab if (devgrabinfo->grab
&& SameClient(devgrabinfo->grab, client)) && SameClient(devgrabinfo->grab, client))
devgrabinfo->sync.state = THAWED; devgrabinfo->sync.state = THAWED;
@ -1718,9 +1716,9 @@ ReleaseActiveGrabs(ClientPtr client)
done = TRUE; done = TRUE;
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
if (dev->coreGrab.grab && SameClient(dev->coreGrab.grab, client)) if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
{ {
(*dev->coreGrab.DeactivateGrab)(dev); (*dev->deviceGrab.DeactivateGrab)(dev);
done = FALSE; done = FALSE;
} }
@ -1979,7 +1977,8 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
tempGrab.confineTo = NullWindow; tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor; tempGrab.cursor = NullCursor;
tempGrab.coreGrab = True; tempGrab.coreGrab = True;
(*inputInfo.pointer->coreGrab.ActivateGrab)(pDev, &tempGrab, tempGrab.genericMasks = NULL;
(*inputInfo.pointer->deviceGrab.ActivateGrab)(pDev, &tempGrab,
currentTime, TRUE); currentTime, TRUE);
} }
else if ((type == MotionNotify) && deliveries) else if ((type == MotionNotify) && deliveries)
@ -2522,7 +2521,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
REGION_TRANSLATE(pSprite->screen, &pSprite->Reg2, xoff, yoff); REGION_TRANSLATE(pSprite->screen, &pSprite->Reg2, xoff, yoff);
/* FIXME: if we call ConfineCursorToWindow, must we do anything else? */ /* FIXME: if we call ConfineCursorToWindow, must we do anything else? */
if ((grab = pDev->coreGrab.grab) && grab->confineTo) { if ((grab = pDev->deviceGrab.grab) && grab->confineTo) {
if (grab->confineTo->drawable.pScreen if (grab->confineTo->drawable.pScreen
!= pSprite->hotPhys.pScreen) != pSprite->hotPhys.pScreen)
pSprite->hotPhys.x = pSprite->hotPhys.y = 0; pSprite->hotPhys.x = pSprite->hotPhys.y = 0;
@ -3015,7 +3014,7 @@ CheckPassiveGrabsOnWindow(
} }
#endif #endif
grabinfo = (xE->u.u.type & EXTENSION_EVENT_BASE) ? grabinfo = (xE->u.u.type & EXTENSION_EVENT_BASE) ?
&device->deviceGrab : &device->coreGrab; &device->deviceGrab : &device->deviceGrab;
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE); (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
FixUpEventFromWindow(device, xE, grab->window, None, TRUE); FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
@ -3165,7 +3164,7 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
if (xE->u.u.type & EXTENSION_EVENT_BASE || xE->u.u.type == GenericEvent) if (xE->u.u.type & EXTENSION_EVENT_BASE || xE->u.u.type == GenericEvent)
grabinfo = &thisDev->deviceGrab; grabinfo = &thisDev->deviceGrab;
else else
grabinfo = &thisDev->coreGrab; grabinfo = &thisDev->deviceGrab;
grab = grabinfo->grab; grab = grabinfo->grab;
@ -3338,7 +3337,7 @@ drawable.id:0;
if (xE->u.u.type & EXTENSION_EVENT_BASE) if (xE->u.u.type & EXTENSION_EVENT_BASE)
grabinfo = &keybd->deviceGrab; grabinfo = &keybd->deviceGrab;
else else
grabinfo = &keybd->coreGrab; grabinfo = &keybd->deviceGrab;
grab = grabinfo->grab; grab = grabinfo->grab;
@ -3501,7 +3500,7 @@ CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
#endif #endif
{ {
GrabPtr grab = mouse->coreGrab.grab; GrabPtr grab = mouse->deviceGrab.grab;
Bool deactivateGrab = FALSE; Bool deactivateGrab = FALSE;
ButtonClassPtr butc = mouse->button; ButtonClassPtr butc = mouse->button;
SpritePtr pSprite = mouse->spriteInfo->sprite; SpritePtr pSprite = mouse->spriteInfo->sprite;
@ -3588,7 +3587,7 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
if (xE->u.u.detail <= 5) if (xE->u.u.detail <= 5)
butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail); butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
filters[MotionNotify] = Motion_Filter(butc); filters[MotionNotify] = Motion_Filter(butc);
if (!butc->state && mouse->coreGrab.fromPassiveGrab) if (!butc->state && mouse->deviceGrab.fromPassiveGrab)
deactivateGrab = TRUE; deactivateGrab = TRUE;
break; break;
default: default:
@ -3603,7 +3602,7 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
DeliverDeviceEvents(pSprite->win, xE, NullGrab, NullWindow, DeliverDeviceEvents(pSprite->win, xE, NullGrab, NullWindow,
mouse, count); mouse, count);
if (deactivateGrab) if (deactivateGrab)
(*mouse->coreGrab.DeactivateGrab)(mouse); (*mouse->deviceGrab.DeactivateGrab)(mouse);
} }
#define AtMostOneClient \ #define AtMostOneClient \
@ -3757,7 +3756,7 @@ maskSet:
if ((inputInfo.pointer->valuator->motionHintWindow == pWin) && if ((inputInfo.pointer->valuator->motionHintWindow == pWin) &&
(mask & PointerMotionHintMask) && (mask & PointerMotionHintMask) &&
!(check & PointerMotionHintMask) && !(check & PointerMotionHintMask) &&
!inputInfo.pointer->coreGrab.grab) /* VCP shouldn't have deviceGrab */ !inputInfo.pointer->deviceGrab.grab) /* VCP shouldn't have deviceGrab */
inputInfo.pointer->valuator->motionHintWindow = NullWindow; inputInfo.pointer->valuator->motionHintWindow = NullWindow;
RecalculateDeliverableEvents(pWin); RecalculateDeliverableEvents(pWin);
return Success; return Success;
@ -3848,7 +3847,7 @@ EnterLeaveEvent(
xEvent event; xEvent event;
WindowPtr focus; WindowPtr focus;
DeviceIntPtr keybd; DeviceIntPtr keybd;
GrabPtr grab = mouse->coreGrab.grab; GrabPtr grab = mouse->deviceGrab.grab;
GrabPtr devgrab = mouse->deviceGrab.grab; GrabPtr devgrab = mouse->deviceGrab.grab;
Mask mask; Mask mask;
int* inWindow; /* no of sprites inside pWin */ int* inWindow; /* no of sprites inside pWin */
@ -4401,7 +4400,7 @@ SetInputFocus(
if ((CompareTimeStamps(time, currentTime) == LATER) || if ((CompareTimeStamps(time, currentTime) == LATER) ||
(CompareTimeStamps(time, focus->time) == EARLIER)) (CompareTimeStamps(time, focus->time) == EARLIER))
return Success; return Success;
mode = (dev->coreGrab.grab) ? NotifyWhileGrabbed : NotifyNormal; mode = (dev->deviceGrab.grab) ? NotifyWhileGrabbed : NotifyNormal;
if (focus->win == FollowKeyboardWin) if (focus->win == FollowKeyboardWin)
DoFocusEvents(dev, keybd->focus->win, focusWin, mode); DoFocusEvents(dev, keybd->focus->win, focusWin, mode);
else else
@ -4556,7 +4555,7 @@ ProcGrabPointer(ClientPtr client)
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.length = 0; rep.length = 0;
grab = device->coreGrab.grab; grab = device->deviceGrab.grab;
if ((grab) && !SameClient(grab, client)) if ((grab) && !SameClient(grab, client))
rep.status = AlreadyGrabbed; rep.status = AlreadyGrabbed;
else if ((!pWin->realized) || else if ((!pWin->realized) ||
@ -4564,12 +4563,12 @@ ProcGrabPointer(ClientPtr client)
!(confineTo->realized !(confineTo->realized
&& BorderSizeNotEmpty(device, confineTo)))) && BorderSizeNotEmpty(device, confineTo))))
rep.status = GrabNotViewable; rep.status = GrabNotViewable;
else if (device->coreGrab.sync.frozen && else if (device->deviceGrab.sync.frozen &&
device->coreGrab.sync.other && device->deviceGrab.sync.other &&
!SameClient(device->coreGrab.sync.other, client)) !SameClient(device->deviceGrab.sync.other, client))
rep.status = GrabFrozen; rep.status = GrabFrozen;
else if ((CompareTimeStamps(time, currentTime) == LATER) || else if ((CompareTimeStamps(time, currentTime) == LATER) ||
(CompareTimeStamps(time, device->coreGrab.grabTime) == EARLIER)) (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER))
rep.status = GrabInvalidTime; rep.status = GrabInvalidTime;
else else
{ {
@ -4592,7 +4591,8 @@ ProcGrabPointer(ClientPtr client)
tempGrab.pointerMode = stuff->pointerMode; tempGrab.pointerMode = stuff->pointerMode;
tempGrab.device = device; tempGrab.device = device;
tempGrab.coreGrab = True; tempGrab.coreGrab = True;
(*device->coreGrab.ActivateGrab)(device, &tempGrab, time, FALSE); tempGrab.genericMasks = NULL;
(*device->deviceGrab.ActivateGrab)(device, &tempGrab, time, FALSE);
if (oldCursor) if (oldCursor)
FreeCursor (oldCursor, (Cursor)0); FreeCursor (oldCursor, (Cursor)0);
rep.status = GrabSuccess; rep.status = GrabSuccess;
@ -4613,7 +4613,7 @@ int
ProcChangeActivePointerGrab(ClientPtr client) ProcChangeActivePointerGrab(ClientPtr client)
{ {
DeviceIntPtr device = PickPointer(client); DeviceIntPtr device = PickPointer(client);
GrabPtr grab = device->coreGrab.grab; GrabPtr grab = device->deviceGrab.grab;
CursorPtr newCursor, oldCursor; CursorPtr newCursor, oldCursor;
REQUEST(xChangeActivePointerGrabReq); REQUEST(xChangeActivePointerGrabReq);
TimeStamp time; TimeStamp time;
@ -4642,7 +4642,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
return Success; return Success;
time = ClientTimeToServerTime(stuff->time); time = ClientTimeToServerTime(stuff->time);
if ((CompareTimeStamps(time, currentTime) == LATER) || if ((CompareTimeStamps(time, currentTime) == LATER) ||
(CompareTimeStamps(time, device->coreGrab.grabTime) == EARLIER)) (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER))
return Success; return Success;
oldCursor = grab->cursor; oldCursor = grab->cursor;
grab->cursor = newCursor; grab->cursor = newCursor;
@ -4670,12 +4670,12 @@ ProcUngrabPointer(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime(); UpdateCurrentTime();
grab = device->coreGrab.grab; grab = device->deviceGrab.grab;
time = ClientTimeToServerTime(stuff->id); time = ClientTimeToServerTime(stuff->id);
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->coreGrab.grabTime) != EARLIER) && (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
(grab) && SameClient(grab, client)) (grab) && SameClient(grab, client))
(*device->coreGrab.DeactivateGrab)(device); (*device->deviceGrab.DeactivateGrab)(device);
return Success; return Success;
} }
@ -4701,13 +4701,13 @@ 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) Bool deviceGrab)
{ {
WindowPtr pWin; WindowPtr pWin;
GrabPtr grab; GrabPtr grab;
TimeStamp time; TimeStamp time;
int rc; int rc;
GrabInfoPtr grabInfo = (coreGrab) ? &dev->coreGrab : &dev->deviceGrab; GrabInfoPtr grabInfo = (deviceGrab) ? &dev->deviceGrab : &dev->deviceGrab;
UpdateCurrentTime(); UpdateCurrentTime();
if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync))
@ -4755,7 +4755,8 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
tempGrab.eventMask = mask; tempGrab.eventMask = mask;
tempGrab.device = dev; tempGrab.device = dev;
tempGrab.cursor = NULL; tempGrab.cursor = NULL;
tempGrab.coreGrab = coreGrab; tempGrab.coreGrab = deviceGrab;
tempGrab.genericMasks = NULL;
(*grabInfo->ActivateGrab)(dev, &tempGrab, time, FALSE); (*grabInfo->ActivateGrab)(dev, &tempGrab, time, FALSE);
*status = GrabSuccess; *status = GrabSuccess;
@ -4812,12 +4813,12 @@ ProcUngrabKeyboard(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime(); UpdateCurrentTime();
grab = device->coreGrab.grab; grab = device->deviceGrab.grab;
time = ClientTimeToServerTime(stuff->id); time = ClientTimeToServerTime(stuff->id);
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->coreGrab.grabTime) != EARLIER) && (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
(grab) && SameClient(grab, client)) (grab) && SameClient(grab, client) && grab->coreGrab)
(*device->coreGrab.DeactivateGrab)(device); (*device->deviceGrab.DeactivateGrab)(device);
return Success; return Success;
} }
@ -5282,23 +5283,23 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
/* Deactivate any grabs performed on this window, before making any /* Deactivate any grabs performed on this window, before making any
input focus changes. */ input focus changes. */
grab = mouse->coreGrab.grab; grab = mouse->deviceGrab.grab;
if (grab && if (grab &&
((grab->window == pWin) || (grab->confineTo == pWin))) ((grab->window == pWin) || (grab->confineTo == pWin)))
(*mouse->coreGrab.DeactivateGrab)(mouse); (*mouse->deviceGrab.DeactivateGrab)(mouse);
/* Deactivating a keyboard grab should cause focus events. */ /* Deactivating a keyboard grab should cause focus events. */
grab = keybd->coreGrab.grab; grab = keybd->deviceGrab.grab;
if (grab && (grab->window == pWin)) if (grab && (grab->window == pWin))
(*keybd->coreGrab.DeactivateGrab)(keybd); (*keybd->deviceGrab.DeactivateGrab)(keybd);
/* And now the real devices */ /* And now the real devices */
for (mouse = inputInfo.devices; mouse; mouse = mouse->next) for (mouse = inputInfo.devices; mouse; mouse = mouse->next)
{ {
grab = mouse->coreGrab.grab; grab = mouse->deviceGrab.grab;
if (grab && ((grab->window == pWin) || (grab->confineTo == pWin))) if (grab && ((grab->window == pWin) || (grab->confineTo == pWin)))
(*mouse->coreGrab.DeactivateGrab)(mouse); (*mouse->deviceGrab.DeactivateGrab)(mouse);
} }
@ -5317,7 +5318,7 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
/* If a grab is in progress, then alter the mode of focus events. */ /* If a grab is in progress, then alter the mode of focus events. */
if (keybd->coreGrab.grab) if (keybd->deviceGrab.grab)
focusEventMode = NotifyWhileGrabbed; focusEventMode = NotifyWhileGrabbed;
switch (focus->revert) switch (focus->revert)
@ -5398,11 +5399,11 @@ CheckCursorConfinement(WindowPtr pWin)
{ {
if (DevHasCursor(pDev)) if (DevHasCursor(pDev))
{ {
grab = pDev->coreGrab.grab; grab = pDev->deviceGrab.grab;
if (grab && (confineTo = grab->confineTo)) if (grab && (confineTo = grab->confineTo))
{ {
if (!BorderSizeNotEmpty(pDev, confineTo)) if (!BorderSizeNotEmpty(pDev, confineTo))
(*inputInfo.pointer->coreGrab.DeactivateGrab)(pDev); (*inputInfo.pointer->deviceGrab.DeactivateGrab)(pDev);
else if ((pWin == confineTo) || IsParent(pWin, confineTo)) else if ((pWin == confineTo) || IsParent(pWin, confineTo))
ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE); ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE);
} }
@ -5683,7 +5684,7 @@ IsInterferingGrab(ClientPtr client, WindowPtr win, DeviceIntPtr dev, xEvent* eve
DeviceIntPtr it; DeviceIntPtr it;
Bool mayInterfere = FALSE; Bool mayInterfere = FALSE;
if (dev->coreGrab.grab && SameClient(dev->coreGrab.grab, client)) if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
return FALSE; return FALSE;
switch(event->u.u.type) switch(event->u.u.type)
@ -5705,7 +5706,7 @@ IsInterferingGrab(ClientPtr client, WindowPtr win, DeviceIntPtr dev, xEvent* eve
{ {
if (it != dev) if (it != dev)
{ {
if (it->coreGrab.grab && SameClient(it->coreGrab.grab, client)) if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client))
{ {
/* there's a client with a grab on some device. /* there's a client with a grab on some device.
* if we're delivering to the very same window that is * if we're delivering to the very same window that is
@ -5713,7 +5714,7 @@ IsInterferingGrab(ClientPtr client, WindowPtr win, DeviceIntPtr dev, xEvent* eve
WindowPtr parent = win; WindowPtr parent = win;
while(parent) while(parent)
{ {
if (it->coreGrab.grab->window == parent) if (it->deviceGrab.grab->window == parent)
return FALSE; return FALSE;
parent = parent->parent; parent = parent->parent;
} }
@ -5742,11 +5743,10 @@ SetGenericFilter(int extension, Mask* filters)
/** /**
* Grab a device properly. * Grab a device for core events, XI events or XGE events.
* *
* grabmode decides if the grab should be for core events and/or XI device * The latter also applies to generic events.
* events. The latter also applies to generic events. * grabmode is used to ungrab a device.
* grabmode is also used to ungrab a device.
* *
* *
*/ */
@ -5768,59 +5768,6 @@ ExtGrabDevice(ClientPtr client,
GrabRec newGrab; GrabRec newGrab;
UpdateCurrentTime(); UpdateCurrentTime();
if (grabmode & CoreOnlyGrab)
{
CursorPtr oldCursor = NullCursor;
grabinfo = &dev->coreGrab;
if (grabinfo->grab && !SameClient(grabinfo->grab, client))
return AlreadyGrabbed;
if ((!grabWindow->realized) ||
(confineTo && !(confineTo->realized &&
BorderSizeNotEmpty(dev, confineTo))))
return GrabNotViewable;
if (grabinfo->sync.frozen && grabinfo->sync.other &&
!SameClient(grabinfo->sync.other, client))
return GrabFrozen;
if ((CompareTimeStamps(ctime, currentTime) == LATER) ||
(CompareTimeStamps(ctime, grabinfo->grabTime) == EARLIER))
return GrabInvalidTime;
if (grabinfo->grab)
{
if (grabinfo->grab->confineTo)
ConfineCursorToWindow(dev, RootWindow(dev), FALSE, FALSE);
oldCursor = dev->coreGrab.grab->cursor;
}
memset(&newGrab, 0, sizeof(GrabRec));
newGrab.cursor = cursor;
newGrab.resource = client->clientAsMask;
newGrab.ownerEvents = ownerEvents;
newGrab.confineTo = confineTo;
newGrab.window = grabWindow;
newGrab.coreGrab = True;
newGrab.device = dev;
newGrab.eventMask = core_mask;
if (IsPointerDevice(dev))
{
newGrab.keyboardMode = GrabModeAsync;
newGrab.pointerMode = device_mode;
} else
{
newGrab.keyboardMode = device_mode;
newGrab.pointerMode = GrabModeAsync;
}
(*grabinfo->ActivateGrab)(dev, &newGrab, ctime, FALSE);
if (oldCursor)
FreeCursor(oldCursor, 0);
}
if (grabmode & DeviceOnlyGrab) if (grabmode & DeviceOnlyGrab)
{ {
@ -5883,10 +5830,7 @@ ExtGrabDevice(ClientPtr client,
if (grabmode & UngrabAll) if (grabmode & UngrabAll)
{ {
if (grabmode & UngrabCoreOnly) grabinfo = &dev->deviceGrab;
grabinfo = &dev->coreGrab;
else
grabinfo = &dev->deviceGrab;
if (grabinfo->grab && SameClient(grabinfo->grab, client)) if (grabinfo->grab && SameClient(grabinfo->grab, client))
(*grabinfo->DeactivateGrab)(dev); (*grabinfo->DeactivateGrab)(dev);
} }

View File

@ -1114,7 +1114,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd)
else else
{ {
/* If the keyboard is actively grabbed, deliver a grabbed core event */ /* If the keyboard is actively grabbed, deliver a grabbed core event */
if (keybd->coreGrab.grab && !keybd->coreGrab.fromPassiveGrab) if (keybd->deviceGrab.grab && !keybd->deviceGrab.fromPassiveGrab)
{ {
/* I've got no clue if that is correct but only working on core /* I've got no clue if that is correct but only working on core
* grabs seems the right thing here. (whot) */ * grabs seems the right thing here. (whot) */
@ -1195,7 +1195,7 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse)
else else
{ {
/* If the pointer is actively grabbed, deliver a grabbed core event */ /* If the pointer is actively grabbed, deliver a grabbed core event */
if (mouse->coreGrab.grab && !mouse->coreGrab.fromPassiveGrab) if (mouse->deviceGrab.grab && !mouse->deviceGrab.fromPassiveGrab)
{ {
/* I've got no clue if that is correct but only working on core /* I've got no clue if that is correct but only working on core
* grabs seems the right thing here. (whot) */ * grabs seems the right thing here. (whot) */

View File

@ -290,13 +290,13 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
break; break;
case ACTION_DISABLEGRAB: case ACTION_DISABLEGRAB:
if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) { if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) {
if (inputInfo.pointer && inputInfo.pointer->coreGrab.grab != NULL && if (inputInfo.pointer && inputInfo.pointer->deviceGrab.grab != NULL &&
inputInfo.pointer->coreGrab.DeactivateGrab) inputInfo.pointer->deviceGrab.DeactivateGrab)
inputInfo.pointer->coreGrab.DeactivateGrab(inputInfo.pointer); inputInfo.pointer->deviceGrab.DeactivateGrab(inputInfo.pointer);
if (inputInfo.keyboard && if (inputInfo.keyboard &&
inputInfo.keyboard->coreGrab.grab != NULL && inputInfo.keyboard->deviceGrab.grab != NULL &&
inputInfo.keyboard->coreGrab.DeactivateGrab) inputInfo.keyboard->deviceGrab.DeactivateGrab)
inputInfo.keyboard->coreGrab.DeactivateGrab(inputInfo.keyboard); inputInfo.keyboard->deviceGrab.DeactivateGrab(inputInfo.keyboard);
} }
break; break;
case ACTION_CLOSECLIENT: case ACTION_CLOSECLIENT:
@ -304,11 +304,11 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
ClientPtr pointer, keyboard, server; ClientPtr pointer, keyboard, server;
pointer = keyboard = server = NULL; pointer = keyboard = server = NULL;
if (inputInfo.pointer && inputInfo.pointer->coreGrab.grab != NULL) if (inputInfo.pointer && inputInfo.pointer->deviceGrab.grab != NULL)
pointer = clients[CLIENT_ID(inputInfo.pointer->coreGrab.grab->resource)]; pointer = clients[CLIENT_ID(inputInfo.pointer->deviceGrab.grab->resource)];
if (inputInfo.keyboard && inputInfo.keyboard->coreGrab.grab != NULL) if (inputInfo.keyboard && inputInfo.keyboard->deviceGrab.grab != NULL)
{ {
keyboard = clients[CLIENT_ID(inputInfo.keyboard->coreGrab.grab->resource)]; keyboard = clients[CLIENT_ID(inputInfo.keyboard->deviceGrab.grab->resource)];
if (keyboard == pointer) if (keyboard == pointer)
keyboard = NULL; keyboard = NULL;
} }

View File

@ -371,8 +371,7 @@ typedef struct _DeviceIntRec {
Bool inited; /* TRUE if INIT returns Success */ Bool inited; /* TRUE if INIT returns Success */
Bool enabled; /* TRUE if ON returns Success */ Bool enabled; /* TRUE if ON returns Success */
Bool coreEvents; /* TRUE if device also sends core */ Bool coreEvents; /* TRUE if device also sends core */
GrabInfoRec coreGrab; /* grab on core events */ GrabInfoRec deviceGrab; /* grab on the device */
GrabInfoRec deviceGrab; /* grab on device events */
Atom type; Atom type;
char *name; char *name;
CARD8 id; CARD8 id;

View File

@ -832,9 +832,8 @@ GrabInfoPtr grabinfo;
(_XkbIsReleaseEvent(xE[0].u.u.type)) ) { (_XkbIsReleaseEvent(xE[0].u.u.type)) ) {
return False; return False;
} }
/* just coreGrab is fine, pXDev is inputInfo.keyboard (see above) */ if ((pXDev->deviceGrab.grab != NullGrab)
if ((pXDev->coreGrab.grab != NullGrab) && pXDev->deviceGrab.fromPassiveGrab &&
&& pXDev->coreGrab.fromPassiveGrab &&
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) { ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
register unsigned state,flags; register unsigned state,flags;