summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-03-08 17:17:23 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-03-08 17:17:23 +1030
commitceca5670fee99b5feceaa2453f1ac32d1bfe7dcd (patch)
tree61b135c3d494c4588cacbcd05329032da92ef82f
parent537bc2ead4d154552cbdc3a19e335f82af63792c (diff)
dix: Each device needs to differ between a core grab and an XI grab,
otherwise a Xi grab may overwrite or release a core grab. Replace grab and associates with coreGrab and deviceGrab structures, adjust rest of dix/Xi/etc to compile. xfree86: Don't check for core devices, we'll have the virtual ones anyway. If we check, the first mouse device is duplicated and sends double events.
-rw-r--r--Xext/security.c7
-rw-r--r--Xi/allowev.c12
-rw-r--r--Xi/chgdctl.c2
-rw-r--r--Xi/closedev.c4
-rw-r--r--Xi/exevents.c41
-rw-r--r--Xi/setdval.c2
-rw-r--r--Xi/setmode.c2
-rw-r--r--Xi/ungrdev.c6
-rw-r--r--dix/devices.c42
-rw-r--r--dix/events.c353
-rw-r--r--hw/xfree86/common/xf86Config.c2
-rw-r--r--hw/xfree86/common/xf86DGA.c10
-rw-r--r--hw/xfree86/common/xf86Events.c22
-rw-r--r--include/dix.h3
-rw-r--r--include/input.h2
-rw-r--r--include/inputstr.h42
-rw-r--r--xkb/xkbEvents.c5
17 files changed, 325 insertions, 232 deletions
diff --git a/Xext/security.c b/Xext/security.c
index 6e58b09a6..e9d2875fd 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -822,10 +822,13 @@ CALLBACK(SecurityCheckDeviceAccess)
untrusted_got_event = FALSE;
found_event_window = FALSE;
- if (dev->grab)
+ /* We can just use coreGrab as a comment a few lines above clearly states
+ "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 =
- (TRUSTLEVEL(rClient(dev->grab)) != XSecurityClientTrusted);
+ (TRUSTLEVEL(rClient(dev->coreGrab.grab)) != XSecurityClientTrusted);
}
else
{
diff --git a/Xi/allowev.c b/Xi/allowev.c
index ea9c5de08..c9e4c87d2 100644
--- a/Xi/allowev.c
+++ b/Xi/allowev.c
@@ -111,22 +111,22 @@ ProcXAllowDeviceEvents(register ClientPtr client)
switch (stuff->mode) {
case ReplayThisDevice:
- AllowSome(client, time, thisdev, NOT_GRABBED);
+ AllowSome(client, time, thisdev, NOT_GRABBED, FALSE);
break;
case SyncThisDevice:
- AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
+ AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT, FALSE);
break;
case AsyncThisDevice:
- AllowSome(client, time, thisdev, THAWED);
+ AllowSome(client, time, thisdev, THAWED, FALSE);
break;
case AsyncOtherDevices:
- AllowSome(client, time, thisdev, THAW_OTHERS);
+ AllowSome(client, time, thisdev, THAW_OTHERS, FALSE);
break;
case SyncAll:
- AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
+ AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT, FALSE);
break;
case AsyncAll:
- AllowSome(client, time, thisdev, THAWED_BOTH);
+ AllowSome(client, time, thisdev, THAWED_BOTH, FALSE);
break;
default:
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadValue);
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index badd93822..899015a02 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -138,7 +138,7 @@ ProcXChangeDeviceControl(ClientPtr client)
ret = BadMatch;
goto out;
}
- if ((dev->grab) && !SameClient(dev->grab, client)) {
+ if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client)) {
rep.status = AlreadyGrabbed;
ret = Success;
goto out;
diff --git a/Xi/closedev.c b/Xi/closedev.c
index cc83e6a5b..7bdd3730f 100644
--- a/Xi/closedev.c
+++ b/Xi/closedev.c
@@ -109,8 +109,8 @@ ProcXCloseDevice(register ClientPtr client)
return Success;
}
- if (d->grab && SameClient(d->grab, client))
- (*d->DeactivateGrab) (d); /* release active grab */
+ if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client))
+ (*d->deviceGrab.DeactivateGrab) (d); /* release active grab */
/* Remove event selections from all windows for events from this device
* and selected by this client.
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 5dbb0e226..6cedafb50 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -99,8 +99,17 @@ RegisterOtherDevice(DeviceIntPtr device)
{
device->public.processInputProc = ProcessOtherEvent;
device->public.realInputProc = ProcessOtherEvent;
- (device)->ActivateGrab = ActivateKeyboardGrab;
- (device)->DeactivateGrab = DeactivateKeyboardGrab;
+ (device)->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
+ (device)->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
+ if (IsPointerDevice(device))
+ {
+ (device)->coreGrab.ActivateGrab = ActivatePointerGrab;
+ (device)->coreGrab.DeactivateGrab = DeactivatePointerGrab;
+ } else
+ {
+ (device)->coreGrab.ActivateGrab = ActivateKeyboardGrab;
+ (device)->coreGrab.DeactivateGrab = DeactivateKeyboardGrab;
+ }
}
/*ARGSUSED*/ void
@@ -110,7 +119,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count)
int i;
CARD16 modifiers;
CARD16 mask;
- GrabPtr grab = other->grab;
+ GrabPtr grab = other->deviceGrab.grab;
Bool deactivateDeviceGrab = FALSE;
int key = 0, bit = 0, rootX, rootY;
ButtonClassPtr b = other->button;
@@ -203,7 +212,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count)
}
}
if (!grab && CheckDeviceGrabs(other, xE, 0, count)) {
- other->activatingKey = key;
+ other->deviceGrab.activatingKey = key;
return;
}
} else if (xE->u.u.type == DeviceKeyRelease) {
@@ -229,9 +238,9 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count)
}
}
- if (other->fromPassiveGrab &&
- !other->grab->coreGrab &&
- (key == other->activatingKey))
+ if (other->deviceGrab.fromPassiveGrab &&
+ !other->deviceGrab.grab->coreGrab &&
+ (key == other->deviceGrab.activatingKey))
deactivateDeviceGrab = TRUE;
} else if (xE->u.u.type == DeviceButtonPress) {
if (!b)
@@ -270,8 +279,8 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count)
b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
if (!b->state
- && other->fromPassiveGrab
- && !other->grab->coreGrab)
+ && other->deviceGrab.fromPassiveGrab
+ && !other->deviceGrab.grab->coreGrab)
deactivateDeviceGrab = TRUE;
} else if (xE->u.u.type == ProximityIn)
other->valuator->mode &= ~OutOfProximity;
@@ -287,7 +296,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count)
other, count);
if (deactivateDeviceGrab == TRUE)
- (*other->DeactivateGrab) (other);
+ (*other->deviceGrab.DeactivateGrab) (other);
}
_X_EXPORT int
@@ -663,7 +672,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
if (dev->valuator)
if ((dev->valuator->motionHintWindow == pWin) &&
(mask & DevicePointerMotionHintMask) &&
- !(check & DevicePointerMotionHintMask) && !dev->grab)
+ !(check & DevicePointerMotionHintMask) && !dev->deviceGrab.grab)
dev->valuator->motionHintWindow = NullWindow;
RecalculateDeviceDeliverableEvents(pWin);
return Success;
@@ -1034,8 +1043,8 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev)
* any input focus changes.
* Deactivating a device grab should cause focus events. */
- if (dev->grab && (dev->grab->window == pWin))
- (*dev->DeactivateGrab) (dev);
+ if (dev->deviceGrab.grab && (dev->deviceGrab.grab->window == pWin))
+ (*dev->deviceGrab.DeactivateGrab) (dev);
/* If the focus window is a root window (ie. has no parent)
* then don't delete the focus from it. */
@@ -1045,7 +1054,7 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev)
/* If a grab is in progress, then alter the mode of focus events. */
- if (dev->grab)
+ if (dev->deviceGrab.grab)
focusEventMode = NotifyWhileGrabbed;
switch (dev->focus->revert) {
@@ -1139,7 +1148,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type,
tempGrab.pointerMode = GrabModeAsync;
tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor;
- (*dev->ActivateGrab) (dev, &tempGrab, currentTime, TRUE);
+ (*dev->deviceGrab.ActivateGrab) (dev, &tempGrab, currentTime, TRUE);
}
}
@@ -1162,7 +1171,7 @@ void
MaybeStopDeviceHint(register DeviceIntPtr dev, ClientPtr client)
{
WindowPtr pWin;
- GrabPtr grab = dev->grab;
+ GrabPtr grab = dev->deviceGrab.grab;
pWin = dev->valuator->motionHintWindow;
diff --git a/Xi/setdval.c b/Xi/setdval.c
index 958b2ac21..ce9b02d2f 100644
--- a/Xi/setdval.c
+++ b/Xi/setdval.c
@@ -125,7 +125,7 @@ ProcXSetDeviceValuators(register ClientPtr client)
return Success;
}
- if ((dev->grab) && !SameClient(dev->grab, client))
+ if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))
rep.status = AlreadyGrabbed;
else
rep.status = SetDeviceValuators(client, dev, (int *)&stuff[1],
diff --git a/Xi/setmode.c b/Xi/setmode.c
index 11feb6d32..ff5a3bcfc 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -113,7 +113,7 @@ ProcXSetDeviceMode(register ClientPtr client)
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch);
return Success;
}
- if ((dev->grab) && !SameClient(dev->grab, client))
+ if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))
rep.status = AlreadyGrabbed;
else
rep.status = SetDeviceMode(client, dev, stuff->mode);
diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c
index 980fa9339..a028a228f 100644
--- a/Xi/ungrdev.c
+++ b/Xi/ungrdev.c
@@ -106,12 +106,12 @@ ProcXUngrabDevice(register ClientPtr client)
SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice);
return Success;
}
- grab = dev->grab;
+ grab = dev->deviceGrab.grab;
time = ClientTimeToServerTime(stuff->time);
if ((CompareTimeStamps(time, currentTime) != LATER) &&
- (CompareTimeStamps(time, dev->grabTime) != EARLIER) &&
+ (CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) &&
(grab) && SameClient(grab, client))
- (*dev->DeactivateGrab) (dev);
+ (*dev->deviceGrab.DeactivateGrab) (dev);
return Success;
}
diff --git a/dix/devices.c b/dix/devices.c
index 9e0879450..05a03b572 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -104,14 +104,27 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart)
dev->public.enqueueInputProc = EnqueueEvent;
dev->deviceProc = deviceProc;
dev->startup = autoStart;
- dev->sync.frozen = FALSE;
- dev->sync.other = NullGrab;
- dev->sync.state = NOT_GRABBED;
- dev->sync.event = (xEvent *) NULL;
- dev->sync.evcount = 0;
- dev->grab = NullGrab;
- dev->grabTime = currentTime;
- dev->fromPassiveGrab = FALSE;
+
+ /* 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 */
+ dev->deviceGrab.sync.frozen = FALSE;
+ dev->deviceGrab.sync.other = NullGrab;
+ dev->deviceGrab.sync.state = NOT_GRABBED;
+ dev->deviceGrab.sync.event = (xEvent *) NULL;
+ dev->deviceGrab.sync.evcount = 0;
+ dev->deviceGrab.grab = NullGrab;
+ dev->deviceGrab.grabTime = currentTime;
+ dev->deviceGrab.fromPassiveGrab = FALSE;
+
dev->key = (KeyClassPtr)NULL;
dev->valuator = (ValuatorClassPtr)NULL;
dev->button = (ButtonClassPtr)NULL;
@@ -339,8 +352,8 @@ InitCoreDevices()
dev->public.processInputProc = ProcessKeyboardEvent;
dev->public.realInputProc = ProcessKeyboardEvent;
#endif
- dev->ActivateGrab = ActivateKeyboardGrab;
- dev->DeactivateGrab = DeactivateKeyboardGrab;
+ dev->coreGrab.ActivateGrab = ActivateKeyboardGrab;
+ dev->coreGrab.DeactivateGrab = DeactivateKeyboardGrab;
dev->coreEvents = FALSE;
dev->spriteOwner = FALSE;
if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
@@ -372,8 +385,8 @@ InitCoreDevices()
dev->public.processInputProc = ProcessPointerEvent;
dev->public.realInputProc = ProcessPointerEvent;
#endif
- dev->ActivateGrab = ActivatePointerGrab;
- dev->DeactivateGrab = DeactivatePointerGrab;
+ dev->coreGrab.ActivateGrab = ActivatePointerGrab;
+ dev->coreGrab.DeactivateGrab = DeactivatePointerGrab;
dev->coreEvents = FALSE;
if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
FatalError("Couldn't allocate pointer devPrivates\n");
@@ -535,7 +548,8 @@ CloseDevice(register DeviceIntPtr dev)
PickPointer(clients[j]);
}
- xfree(dev->sync.event);
+ xfree(dev->coreGrab.sync.event);
+ xfree(dev->deviceGrab.sync.event);
xfree(dev);
}
@@ -1872,7 +1886,7 @@ ProcGetPointerControl(ClientPtr client)
void
MaybeStopHint(register DeviceIntPtr dev, ClientPtr client)
{
- GrabPtr grab = dev->grab;
+ GrabPtr grab = dev->coreGrab.grab;
if ((grab && SameClient(grab, client) &&
((grab->eventMask & PointerMotionHintMask) ||
diff --git a/dix/events.c b/dix/events.c
index 23d5f22fc..66d63cc3b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -478,7 +478,7 @@ XineramaCheckVirtualMotion(
pSprite->hot.pScreen = qe->pScreen; /* should always be Screen 0 */
pSprite->hot.x = qe->event->u.keyButtonPointer.rootX;
pSprite->hot.y = qe->event->u.keyButtonPointer.rootY;
- pWin = pDev->grab ? pDev->grab->confineTo :
+ pWin = pDev->coreGrab.grab ? pDev->coreGrab.grab->confineTo :
NullWindow;
}
if (pWin)
@@ -801,7 +801,7 @@ CheckVirtualMotion(
pSprite->hot.pScreen = qe->pScreen;
pSprite->hot.x = qe->event->u.keyButtonPointer.rootX;
pSprite->hot.y = qe->event->u.keyButtonPointer.rootY;
- pWin = pDev->grab ? pDev->grab->confineTo : NullWindow;
+ pWin = pDev->coreGrab.grab ? pDev->coreGrab.grab->confineTo : NullWindow;
}
if (pWin)
{
@@ -916,7 +916,7 @@ static void
PostNewCursor(DeviceIntPtr pDev)
{
register WindowPtr win;
- register GrabPtr grab = pDev->grab;
+ register GrabPtr grab = pDev->coreGrab.grab;
SpritePtr pSprite = pDev->pSprite;
CursorPtr pCursor;
@@ -1108,7 +1108,7 @@ PlayReleasedEvents(void)
prev = &syncEvents.pending;
while ( (qe = *prev) )
{
- if (!qe->device->sync.frozen)
+ if (!qe->device->coreGrab.sync.frozen)
{
*prev = qe->next;
pDev = qe->device;
@@ -1134,7 +1134,7 @@ PlayReleasedEvents(void)
(*qe->device->public.processInputProc)(qe->event, qe->device,
qe->evcount);
xfree(qe);
- for (dev = inputInfo.devices; dev && dev->sync.frozen; dev = dev->next)
+ for (dev = inputInfo.devices; dev && dev->coreGrab.sync.frozen; dev = dev->next)
;
if (!dev)
break;
@@ -1150,7 +1150,7 @@ PlayReleasedEvents(void)
static void
FreezeThaw(register DeviceIntPtr dev, Bool frozen)
{
- dev->sync.frozen = frozen;
+ dev->coreGrab.sync.frozen = frozen;
if (frozen)
dev->public.processInputProc = dev->public.enqueueInputProc;
else
@@ -1169,14 +1169,15 @@ ComputeFreezes()
register DeviceIntPtr dev;
for (dev = inputInfo.devices; dev; dev = dev->next)
- FreezeThaw(dev, dev->sync.other || (dev->sync.state >= FROZEN));
+ FreezeThaw(dev, dev->coreGrab.sync.other ||
+ (dev->coreGrab.sync.state >= FROZEN));
if (syncEvents.playingEvents || (!replayDev && !syncEvents.pending))
return;
syncEvents.playingEvents = TRUE;
if (replayDev)
{
- xE = replayDev->sync.event;
- count = replayDev->sync.evcount;
+ xE = replayDev->coreGrab.sync.event;
+ count = replayDev->coreGrab.sync.evcount;
syncEvents.replayDev = (DeviceIntPtr)NULL;
w = XYToWindow( XE_KBPTR.rootX, XE_KBPTR.rootY);
@@ -1203,7 +1204,7 @@ ComputeFreezes()
playmore:
for (dev = inputInfo.devices; dev; dev = dev->next)
{
- if (!dev->sync.frozen)
+ if (!dev->coreGrab.sync.frozen)
{
PlayReleasedEvents();
break;
@@ -1216,7 +1217,7 @@ playmore:
{
/* the following may have been skipped during replay,
so do it now */
- if ((grab = dev->grab) && grab->confineTo)
+ if ((grab = dev->coreGrab.grab) && grab->confineTo)
{
if (grab->confineTo->drawable.pScreen !=
dev->pSprite->hotPhys.pScreen)
@@ -1243,7 +1244,9 @@ ScreenRestructured (ScreenPtr pScreen)
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
- if ((grab = pDev->grab) && grab->confineTo)
+ /* GrabDevice doesn't have a confineTo field, so we don't need to
+ * worry about it. */
+ if ((grab = pDev->coreGrab.grab) && grab->confineTo)
{
if (grab->confineTo->drawable.pScreen
!= pDev->pSprite->hotPhys.pScreen)
@@ -1261,31 +1264,31 @@ ScreenRestructured (ScreenPtr pScreen)
void
CheckGrabForSyncs(register DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
{
- register GrabPtr grab = thisDev->grab;
+ register GrabPtr grab = thisDev->coreGrab.grab;
register DeviceIntPtr dev;
if (thisMode == GrabModeSync)
- thisDev->sync.state = FROZEN_NO_EVENT;
+ thisDev->coreGrab.sync.state = FROZEN_NO_EVENT;
else
{ /* free both if same client owns both */
- thisDev->sync.state = THAWED;
- if (thisDev->sync.other &&
- (CLIENT_BITS(thisDev->sync.other->resource) ==
+ thisDev->coreGrab.sync.state = THAWED;
+ if (thisDev->coreGrab.sync.other &&
+ (CLIENT_BITS(thisDev->coreGrab.sync.other->resource) ==
CLIENT_BITS(grab->resource)))
- thisDev->sync.other = NullGrab;
+ thisDev->coreGrab.sync.other = NullGrab;
}
for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (dev != thisDev)
{
if (otherMode == GrabModeSync)
- dev->sync.other = grab;
+ dev->coreGrab.sync.other = grab;
else
{ /* free both if same client owns both */
- if (dev->sync.other &&
- (CLIENT_BITS(dev->sync.other->resource) ==
+ if (dev->coreGrab.sync.other &&
+ (CLIENT_BITS(dev->coreGrab.sync.other->resource) ==
CLIENT_BITS(grab->resource)))
- dev->sync.other = NullGrab;
+ dev->coreGrab.sync.other = NullGrab;
}
}
}
@@ -1296,8 +1299,9 @@ void
ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab,
TimeStamp time, Bool autoGrab)
{
- WindowPtr oldWin = (mouse->grab) ? mouse->grab->window
- : mouse->pSprite->win;
+ WindowPtr oldWin = (mouse->coreGrab.grab) ?
+ mouse->coreGrab.grab->window
+ : mouse->pSprite->win;
if (grab->confineTo)
{
@@ -1309,14 +1313,14 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab,
DoEnterLeaveEvents(mouse, oldWin, grab->window, NotifyGrab);
mouse->valuator->motionHintWindow = NullWindow;
if (syncEvents.playingEvents)
- mouse->grabTime = syncEvents.time;
+ mouse->coreGrab.grabTime = syncEvents.time;
else
- mouse->grabTime = time;
+ mouse->coreGrab.grabTime = time;
if (grab->cursor)
grab->cursor->refcnt++;
- mouse->activeGrab = *grab;
- mouse->grab = &mouse->activeGrab;
- mouse->fromPassiveGrab = autoGrab;
+ mouse->coreGrab.activeGrab = *grab;
+ mouse->coreGrab.grab = &mouse->coreGrab.activeGrab;
+ mouse->coreGrab.fromPassiveGrab = autoGrab;
PostNewCursor(mouse);
CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
}
@@ -1324,17 +1328,17 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab,
void
DeactivatePointerGrab(register DeviceIntPtr mouse)
{
- register GrabPtr grab = mouse->grab;
+ register GrabPtr grab = mouse->coreGrab.grab;
register DeviceIntPtr dev;
mouse->valuator->motionHintWindow = NullWindow;
- mouse->grab = NullGrab;
- mouse->sync.state = NOT_GRABBED;
- mouse->fromPassiveGrab = FALSE;
+ mouse->coreGrab.grab = NullGrab;
+ mouse->coreGrab.sync.state = NOT_GRABBED;
+ mouse->coreGrab.fromPassiveGrab = FALSE;
for (dev = inputInfo.devices; dev; dev = dev->next)
{
- if (dev->sync.other == grab)
- dev->sync.other = NullGrab;
+ if (dev->coreGrab.sync.other == grab)
+ dev->coreGrab.sync.other = NullGrab;
}
DoEnterLeaveEvents(mouse, grab->window,
mouse->pSprite->win, NotifyUngrab);
@@ -1351,8 +1355,8 @@ ActivateKeyboardGrab(register DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
{
WindowPtr oldWin;
- if (keybd->grab)
- oldWin = keybd->grab->window;
+ if (keybd->coreGrab.grab)
+ oldWin = keybd->coreGrab.grab->window;
else if (keybd->focus)
oldWin = keybd->focus->win;
else
@@ -1363,19 +1367,19 @@ ActivateKeyboardGrab(register DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
keybd->valuator->motionHintWindow = NullWindow;
DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
if (syncEvents.playingEvents)
- keybd->grabTime = syncEvents.time;
+ keybd->coreGrab.grabTime = syncEvents.time;
else
- keybd->grabTime = time;
- keybd->activeGrab = *grab;
- keybd->grab = &keybd->activeGrab;
- keybd->fromPassiveGrab = passive;
+ keybd->coreGrab.grabTime = time;
+ keybd->coreGrab.activeGrab = *grab;
+ keybd->coreGrab.grab = &keybd->coreGrab.activeGrab;
+ keybd->coreGrab.fromPassiveGrab = passive;
CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
}
void
DeactivateKeyboardGrab(register DeviceIntPtr keybd)
{
- register GrabPtr grab = keybd->grab;
+ register GrabPtr grab = keybd->coreGrab.grab;
register DeviceIntPtr dev;
register WindowPtr focusWin = keybd->focus ? keybd->focus->win
: keybd->pSprite->win;
@@ -1384,49 +1388,61 @@ DeactivateKeyboardGrab(register DeviceIntPtr keybd)
focusWin = inputInfo.keyboard->focus->win;
if (keybd->valuator)
keybd->valuator->motionHintWindow = NullWindow;
- keybd->grab = NullGrab;
- keybd->sync.state = NOT_GRABBED;
- keybd->fromPassiveGrab = FALSE;
+ keybd->coreGrab.grab = NullGrab;
+ keybd->coreGrab.sync.state = NOT_GRABBED;
+ keybd->coreGrab.fromPassiveGrab = FALSE;
for (dev = inputInfo.devices; dev; dev = dev->next)
{
- if (dev->sync.other == grab)
- dev->sync.other = NullGrab;
+ if (dev->coreGrab.sync.other == grab)
+ dev->coreGrab.sync.other = NullGrab;
}
DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
ComputeFreezes();
}
+/*
+ * Core flag decides whether to work on the coreGrab or deviceGrab sync
+ * fields.
+ */
void
-AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
+AllowSome(ClientPtr client,
+ TimeStamp time,
+ DeviceIntPtr thisDev,
+ int newState,
+ Bool core)
{
Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced;
TimeStamp grabTime;
register DeviceIntPtr dev;
+ GrabInfoPtr devgrabinfo,
+ grabinfo = (core) ? &thisDev->coreGrab : &thisDev->deviceGrab;
- thisGrabbed = thisDev->grab && SameClient(thisDev->grab, client);
+ thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client);
thisSynced = FALSE;
otherGrabbed = FALSE;
othersFrozen = TRUE;
- grabTime = thisDev->grabTime;
+ grabTime = grabinfo->grabTime;
for (dev = inputInfo.devices; dev; dev = dev->next)
{
+ devgrabinfo = (core) ? &dev->coreGrab : &dev->deviceGrab;
+
if (dev == thisDev)
continue;
- if (dev->grab && SameClient(dev->grab, client))
+ if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
{
if (!(thisGrabbed || otherGrabbed) ||
- (CompareTimeStamps(dev->grabTime, grabTime) == LATER))
- grabTime = dev->grabTime;
+ (CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER))
+ grabTime = devgrabinfo->grabTime;
otherGrabbed = TRUE;
- if (thisDev->sync.other == dev->grab)
+ if (grabinfo->sync.other == devgrabinfo->grab)
thisSynced = TRUE;
- if (dev->sync.state < FROZEN)
+ if (devgrabinfo->sync.state < FROZEN)
othersFrozen = FALSE;
}
- else if (!dev->sync.other || !SameClient(dev->sync.other, client))
+ else if (!devgrabinfo->sync.other || !SameClient(devgrabinfo->sync.other, client))
othersFrozen = FALSE;
}
- if (!((thisGrabbed && thisDev->sync.state >= FROZEN) || thisSynced))
+ if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced))
return;
if ((CompareTimeStamps(time, currentTime) == LATER) ||
(CompareTimeStamps(time, grabTime) == EARLIER))
@@ -1435,17 +1451,17 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
{
case THAWED: /* Async */
if (thisGrabbed)
- thisDev->sync.state = THAWED;
+ grabinfo->sync.state = THAWED;
if (thisSynced)
- thisDev->sync.other = NullGrab;
+ grabinfo->sync.other = NullGrab;
ComputeFreezes();
break;
case FREEZE_NEXT_EVENT: /* Sync */
if (thisGrabbed)
{
- thisDev->sync.state = FREEZE_NEXT_EVENT;
+ grabinfo->sync.state = FREEZE_NEXT_EVENT;
if (thisSynced)
- thisDev->sync.other = NullGrab;
+ grabinfo->sync.other = NullGrab;
ComputeFreezes();
}
break;
@@ -1454,10 +1470,13 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
{
for (dev = inputInfo.devices; dev; dev = dev->next)
{
- if (dev->grab && SameClient(dev->grab, client))
- dev->sync.state = THAWED;
- if (dev->sync.other && SameClient(dev->sync.other, client))
- dev->sync.other = NullGrab;
+ devgrabinfo = (core) ? &dev->coreGrab : &dev->deviceGrab;
+ if (devgrabinfo->grab
+ && SameClient(devgrabinfo->grab, client))
+ devgrabinfo->sync.state = THAWED;
+ if (devgrabinfo->sync.other &&
+ SameClient(devgrabinfo->sync.other, client))
+ devgrabinfo->sync.other = NullGrab;
}
ComputeFreezes();
}
@@ -1467,22 +1486,25 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
{
for (dev = inputInfo.devices; dev; dev = dev->next)
{
- if (dev->grab && SameClient(dev->grab, client))
- dev->sync.state = FREEZE_BOTH_NEXT_EVENT;
- if (dev->sync.other && SameClient(dev->sync.other, client))
- dev->sync.other = NullGrab;
+ devgrabinfo = (core) ? &dev->coreGrab : &dev->deviceGrab;
+ if (devgrabinfo->grab
+ && SameClient(devgrabinfo->grab, client))
+ devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT;
+ if (devgrabinfo->sync.other
+ && SameClient(devgrabinfo->sync.other, client))
+ devgrabinfo->sync.other = NullGrab;
}
ComputeFreezes();
}
break;
case NOT_GRABBED: /* Replay */
- if (thisGrabbed && thisDev->sync.state == FROZEN_WITH_EVENT)
+ if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT)
{
if (thisSynced)
- thisDev->sync.other = NullGrab;
+ grabinfo->sync.other = NullGrab;
syncEvents.replayDev = thisDev;
- syncEvents.replayWin = thisDev->grab->window;
- (*thisDev->DeactivateGrab)(thisDev);
+ syncEvents.replayWin = grabinfo->grab->window;
+ (*grabinfo->DeactivateGrab)(thisDev);
syncEvents.replayDev = (DeviceIntPtr)NULL;
}
break;
@@ -1493,10 +1515,13 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
{
if (dev == thisDev)
continue;
- if (dev->grab && SameClient(dev->grab, client))
- dev->sync.state = THAWED;
- if (dev->sync.other && SameClient(dev->sync.other, client))
- dev->sync.other = NullGrab;
+ devgrabinfo = (core) ? &dev->coreGrab : &dev->deviceGrab;
+ if (devgrabinfo->grab
+ && SameClient(devgrabinfo->grab, client))
+ devgrabinfo->sync.state = THAWED;
+ if (devgrabinfo->sync.other
+ && SameClient(devgrabinfo->sync.other, client))
+ devgrabinfo->sync.other = NullGrab;
}
ComputeFreezes();
}
@@ -1517,28 +1542,28 @@ ProcAllowEvents(register ClientPtr client)
switch (stuff->mode)
{
case ReplayPointer:
- AllowSome(client, time, mouse, NOT_GRABBED);
+ AllowSome(client, time, mouse, NOT_GRABBED, True);
break;
case SyncPointer:
- AllowSome(client, time, mouse, FREEZE_NEXT_EVENT);
+ AllowSome(client, time, mouse, FREEZE_NEXT_EVENT, True);
break;
case AsyncPointer:
- AllowSome(client, time, mouse, THAWED);
+ AllowSome(client, time, mouse, THAWED, True);
break;
case ReplayKeyboard:
- AllowSome(client, time, keybd, NOT_GRABBED);
+ AllowSome(client, time, keybd, NOT_GRABBED, True);
break;
case SyncKeyboard:
- AllowSome(client, time, keybd, FREEZE_NEXT_EVENT);
+ AllowSome(client, time, keybd, FREEZE_NEXT_EVENT, True);
break;
case AsyncKeyboard:
- AllowSome(client, time, keybd, THAWED);
+ AllowSome(client, time, keybd, THAWED, True);
break;
case SyncBoth:
- AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT);
+ AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT, True);
break;
case AsyncBoth:
- AllowSome(client, time, keybd, THAWED_BOTH);
+ AllowSome(client, time, keybd, THAWED_BOTH, True);
break;
default:
client->errorValue = stuff->mode;
@@ -1560,9 +1585,15 @@ ReleaseActiveGrabs(ClientPtr client)
done = TRUE;
for (dev = inputInfo.devices; dev; dev = dev->next)
{
- if (dev->grab && SameClient(dev->grab, client))
+ if (dev->coreGrab.grab && SameClient(dev->coreGrab.grab, client))
+ {
+ (*dev->coreGrab.DeactivateGrab)(dev);
+ done = FALSE;
+ }
+
+ if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
{
- (*dev->DeactivateGrab)(dev);
+ (*dev->deviceGrab.DeactivateGrab)(dev);
done = FALSE;
}
}
@@ -1730,7 +1761,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, register WindowPtr pWin, xEvent
tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor;
tempGrab.coreGrab = True;
- (*inputInfo.pointer->ActivateGrab)(pDev, &tempGrab,
+ (*inputInfo.pointer->coreGrab.ActivateGrab)(pDev, &tempGrab,
currentTime, TRUE);
}
else if ((type == MotionNotify) && deliveries)
@@ -2175,7 +2206,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
REGION_TRANSLATE(pSprite->screen, &pSprite->Reg2, xoff, yoff);
/* FIXME: if we call ConfineCursorToWindow, must we do anything else? */
- if ((grab = pDev->grab) && grab->confineTo) {
+ if ((grab = pDev->coreGrab.grab) && grab->confineTo) {
if (grab->confineTo->drawable.pScreen
!= pSprite->hotPhys.pScreen)
pSprite->hotPhys.x = pSprite->hotPhys.y = 0;
@@ -2576,6 +2607,7 @@ CheckPassiveGrabsOnWindow(
{
register GrabPtr grab = wPassiveGrabs(pWin);
GrabRec tempGrab;
+ GrabInfoPtr grabinfo;
register xEvent *dxE;
if (!grab)
@@ -2629,7 +2661,9 @@ CheckPassiveGrabsOnWindow(
tempGrab.modifiersDetail.exact&(~0x1f00);
}
#endif
- (*device->ActivateGrab)(device, grab, currentTime, TRUE);
+ grabinfo = (xE->u.u.type & EXTENSION_EVENT_BASE) ?
+ &device->deviceGrab : &device->coreGrab;
+ (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
@@ -2637,20 +2671,20 @@ CheckPassiveGrabsOnWindow(
filters[xE->u.u.type],
filters[xE->u.u.type], grab);
- if (device->sync.state == FROZEN_NO_EVENT)
+ if (grabinfo->sync.state == FROZEN_NO_EVENT)
{
- if (device->sync.evcount < count)
+ if (grabinfo->sync.evcount < count)
{
Must_have_memory = TRUE; /* XXX */
- device->sync.event = (xEvent *)xrealloc(device->sync.event,
+ grabinfo->sync.event = (xEvent *)xrealloc(grabinfo->sync.event,
count*
sizeof(xEvent));
Must_have_memory = FALSE; /* XXX */
}
- device->sync.evcount = count;
- for (dxE = device->sync.event; --count >= 0; dxE++, xE++)
+ grabinfo->sync.evcount = count;
+ for (dxE = grabinfo->sync.event; --count >= 0; dxE++, xE++)
*dxE = *xE;
- device->sync.state = FROZEN_WITH_EVENT;
+ grabinfo->sync.state = FROZEN_WITH_EVENT;
}
return TRUE;
}
@@ -2747,12 +2781,20 @@ void
DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev,
Bool deactivateGrab, int count)
{
- register GrabPtr grab = thisDev->grab;
+ register GrabPtr grab;
+ GrabInfoPtr grabinfo;
int deliveries = 0;
register DeviceIntPtr dev;
register xEvent *dxE;
SpritePtr pSprite = thisDev->pSprite;
+ if (xE->u.u.type & EXTENSION_EVENT_BASE)
+ grabinfo = &thisDev->deviceGrab;
+ else
+ grabinfo = &thisDev->coreGrab;
+
+ grab = grabinfo->grab;
+
if (grab->ownerEvents)
{
WindowPtr focus;
@@ -2798,7 +2840,7 @@ DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev,
&& xE->u.u.type != DeviceMotionNotify
#endif
))
- switch (thisDev->sync.state)
+ switch (grabinfo->sync.state)
{
case FREEZE_BOTH_NEXT_EVENT:
for (dev = inputInfo.devices; dev; dev = dev->next)
@@ -2806,26 +2848,26 @@ DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev,
if (dev == thisDev)
continue;
FreezeThaw(dev, TRUE);
- if ((dev->sync.state == FREEZE_BOTH_NEXT_EVENT) &&
- (CLIENT_BITS(dev->grab->resource) ==
- CLIENT_BITS(thisDev->grab->resource)))
- dev->sync.state = FROZEN_NO_EVENT;
+ if ((grabinfo->sync.state == FREEZE_BOTH_NEXT_EVENT) &&
+ (CLIENT_BITS(grab->resource) ==
+ CLIENT_BITS(grab->resource)))
+ grabinfo->sync.state = FROZEN_NO_EVENT;
else
- dev->sync.other = thisDev->grab;
+ grabinfo->sync.other = grab;
}
/* fall through */
case FREEZE_NEXT_EVENT:
- thisDev->sync.state = FROZEN_WITH_EVENT;
+ grabinfo->sync.state = FROZEN_WITH_EVENT;
FreezeThaw(thisDev, TRUE);
- if (thisDev->sync.evcount < count)
+ if (grabinfo->sync.evcount < count)
{
Must_have_memory = TRUE; /* XXX */
- thisDev->sync.event = (xEvent *)xrealloc(thisDev->sync.event,
+ grabinfo->sync.event = (xEvent *)xrealloc(grabinfo->sync.event,
count*sizeof(xEvent));
Must_have_memory = FALSE; /* XXX */
}
- thisDev->sync.evcount = count;
- for (dxE = thisDev->sync.event; --count >= 0; dxE++, xE++)
+ grabinfo->sync.evcount = count;
+ for (dxE = grabinfo->sync.event; --count >= 0; dxE++, xE++)
*dxE = *xE;
break;
}
@@ -2843,9 +2885,11 @@ ProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int coun
register int i;
register CARD8 modifiers;
register CARD16 mask;
- GrabPtr grab = keybd->grab;
+ register GrabPtr grab;
+ GrabInfoPtr grabinfo;
Bool deactivateGrab = FALSE;
register KeyClassPtr keyc = keybd->key;
+
#ifdef XEVIE
static Window rootWin = 0;
@@ -2886,6 +2930,13 @@ drawable.id:0;
}
#endif
+ if (xE->u.u.type & EXTENSION_EVENT_BASE)
+ grabinfo = &keybd->deviceGrab;
+ else
+ grabinfo = &keybd->coreGrab;
+
+ grab = grabinfo->grab;
+
if (!syncEvents.playingEvents)
{
NoticeTime(xE);
@@ -2954,7 +3005,7 @@ drawable.id:0;
}
if (!grab && CheckDeviceGrabs(keybd, xE, 0, count))
{
- keybd->activatingKey = key;
+ grabinfo->activatingKey = key;
return;
}
break;
@@ -2975,7 +3026,7 @@ drawable.id:0;
modifiers &= ~mask;
}
}
- if (keybd->fromPassiveGrab && (key == keybd->activatingKey))
+ if (grabinfo->fromPassiveGrab && (key == grabinfo->activatingKey))
deactivateGrab = TRUE;
break;
default:
@@ -2986,7 +3037,7 @@ drawable.id:0;
else
DeliverFocusedEvent(keybd, xE, keybd->pSprite->win, count);
if (deactivateGrab)
- (*keybd->DeactivateGrab)(keybd);
+ (*grabinfo->DeactivateGrab)(keybd);
XaceHook(XACE_KEY_AVAIL, xE, keybd, count);
}
@@ -3033,7 +3084,7 @@ CoreProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int c
ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count)
#endif
{
- register GrabPtr grab = mouse->grab;
+ GrabPtr grab = mouse->coreGrab.grab;
Bool deactivateGrab = FALSE;
register ButtonClassPtr butc = mouse->button;
SpritePtr pSprite = mouse->pSprite;
@@ -3120,7 +3171,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
if (xE->u.u.detail <= 5)
butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
filters[MotionNotify] = Motion_Filter(butc);
- if (!butc->state && mouse->fromPassiveGrab)
+ if (!butc->state && mouse->coreGrab.fromPassiveGrab)
deactivateGrab = TRUE;
break;
default:
@@ -3135,7 +3186,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
DeliverDeviceEvents(pSprite->win, xE, NullGrab, NullWindow,
mouse, count);
if (deactivateGrab)
- (*mouse->DeactivateGrab)(mouse);
+ (*mouse->coreGrab.DeactivateGrab)(mouse);
}
#define AtMostOneClient \
@@ -3277,7 +3328,7 @@ maskSet:
if ((inputInfo.pointer->valuator->motionHintWindow == pWin) &&
(mask & PointerMotionHintMask) &&
!(check & PointerMotionHintMask) &&
- !inputInfo.pointer->grab)
+ !inputInfo.pointer->coreGrab.grab) /* VCP shouldn't have deviceGrab */
inputInfo.pointer->valuator->motionHintWindow = NullWindow;
RecalculateDeliverableEvents(pWin);
return Success;
@@ -3362,7 +3413,8 @@ EnterLeaveEvent(
register DeviceIntPtr keybd = inputInfo.keyboard;
WindowPtr focus;
register DeviceIntPtr mouse = pDev;
- register GrabPtr grab = mouse->grab;
+ GrabPtr grab = mouse->coreGrab.grab;
+ GrabPtr devgrab = mouse->deviceGrab.grab;
Mask mask;
deviceEnterNotify *devEnterLeave;
@@ -3430,9 +3482,9 @@ EnterLeaveEvent(
if (inputMasks &&
(filters[devEnterLeave->type] & inputMasks->deliverableEvents[mskidx]))
{
- if (grab)
- (void)TryClientEvents(rClient(grab), (xEvent*)devEnterLeave, 1,
- mask, filters[devEnterLeave->type], grab);
+ if (devgrab)
+ (void)TryClientEvents(rClient(devgrab), (xEvent*)devEnterLeave, 1,
+ mask, filters[devEnterLeave->type], devgrab);
else
(void)DeliverEventsToWindow(pDev, pWin, (xEvent*)devEnterLeave,
1, filters[devEnterLeave->type],
@@ -3776,7 +3828,7 @@ SetInputFocus(
if ((CompareTimeStamps(time, currentTime) == LATER) ||
(CompareTimeStamps(time, focus->time) == EARLIER))
return Success;
- mode = (dev->grab) ? NotifyWhileGrabbed : NotifyNormal;
+ mode = (dev->coreGrab.grab) ? NotifyWhileGrabbed : NotifyNormal;
if (focus->win == FollowKeyboardWin)
DoFocusEvents(dev, inputInfo.keyboard->focus->win, focusWin, mode);
else
@@ -3912,7 +3964,7 @@ ProcGrabPointer(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
- grab = device->grab;
+ grab = device->coreGrab.grab;
if ((grab) && !SameClient(grab, client))
rep.status = AlreadyGrabbed;
else if ((!pWin->realized) ||
@@ -3920,11 +3972,12 @@ ProcGrabPointer(ClientPtr client)
!(confineTo->realized
&& BorderSizeNotEmpty(device, confineTo))))
rep.status = GrabNotViewable;
- else if (device->sync.frozen &&
- device->sync.other && !SameClient(device->sync.other, client))
+ else if (device->coreGrab.sync.frozen &&
+ device->coreGrab.sync.other &&
+ !SameClient(device->coreGrab.sync.other, client))
rep.status = GrabFrozen;
else if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, device->grabTime) == EARLIER))
+ (CompareTimeStamps(time, device->coreGrab.grabTime) == EARLIER))
rep.status = GrabInvalidTime;
else
{
@@ -3948,7 +4001,7 @@ ProcGrabPointer(ClientPtr client)
tempGrab.pointerMode = stuff->pointerMode;
tempGrab.device = device;
tempGrab.coreGrab = True;
- (*device->ActivateGrab)(device, &tempGrab, time, FALSE);
+ (*device->coreGrab.ActivateGrab)(device, &tempGrab, time, FALSE);
if (oldCursor)
FreeCursor (oldCursor, (Cursor)0);
rep.status = GrabSuccess;
@@ -3961,7 +4014,7 @@ int
ProcChangeActivePointerGrab(ClientPtr client)
{
DeviceIntPtr device = PickPointer(client);
- register GrabPtr grab = device->grab;
+ register GrabPtr grab = device->coreGrab.grab;
CursorPtr newCursor, oldCursor;
REQUEST(xChangeActivePointerGrabReq);
TimeStamp time;
@@ -3990,7 +4043,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
return Success;
time = ClientTimeToServerTime(stuff->time);
if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, device->grabTime) == EARLIER))
+ (CompareTimeStamps(time, device->coreGrab.grabTime) == EARLIER))
return Success;
oldCursor = grab->cursor;
grab->cursor = newCursor;
@@ -4013,12 +4066,12 @@ ProcUngrabPointer(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime();
- grab = device->grab;
+ grab = device->coreGrab.grab;
time = ClientTimeToServerTime(stuff->id);
if ((CompareTimeStamps(time, currentTime) != LATER) &&
- (CompareTimeStamps(time, device->grabTime) != EARLIER) &&
+ (CompareTimeStamps(time, device->coreGrab.grabTime) != EARLIER) &&
(grab) && SameClient(grab, client))
- (*device->DeactivateGrab)(device);
+ (*device->coreGrab.DeactivateGrab)(device);
return Success;
}
@@ -4052,16 +4105,16 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
if (rc != Success)
return rc;
time = ClientTimeToServerTime(ctime);
- grab = dev->grab;
+ grab = dev->coreGrab.grab;
if (grab && !SameClient(grab, client))
*status = AlreadyGrabbed;
else if (!pWin->realized)
*status = GrabNotViewable;
else if ((CompareTimeStamps(time, currentTime) == LATER) ||
- (CompareTimeStamps(time, dev->grabTime) == EARLIER))
+ (CompareTimeStamps(time, dev->coreGrab.grabTime) == EARLIER))
*status = GrabInvalidTime;
- else if (dev->sync.frozen &&
- dev->sync.other && !SameClient(dev->sync.other, client))
+ else if (dev->coreGrab.sync.frozen &&
+ dev->coreGrab.sync.other && !SameClient(dev->coreGrab.sync.other, client))
*status = GrabFrozen;
else
{
@@ -4079,7 +4132,7 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
tempGrab.device = dev;
tempGrab.cursor = NULL;
- (*dev->ActivateGrab)(dev, &tempGrab, time, FALSE);
+ (*dev->coreGrab.ActivateGrab)(dev, &tempGrab, time, FALSE);
*status = GrabSuccess;
}
return Success;
@@ -4123,12 +4176,12 @@ ProcUngrabKeyboard(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime();
- grab = device->grab;
+ grab = device->coreGrab.grab;
time = ClientTimeToServerTime(stuff->id);
if ((CompareTimeStamps(time, currentTime) != LATER) &&
- (CompareTimeStamps(time, device->grabTime) != EARLIER) &&
+ (CompareTimeStamps(time, device->coreGrab.grabTime) != EARLIER) &&
(grab) && SameClient(grab, client))
- (*device->DeactivateGrab)(device);
+ (*device->coreGrab.DeactivateGrab)(device);
return Success;
}
@@ -4547,19 +4600,21 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
FocusClassPtr focus = keybd->focus;
OtherClientsPtr oc;
GrabPtr passive;
+ GrabPtr grab;
/* Deactivate any grabs performed on this window, before making any
input focus changes. */
-
- if (mouse->grab &&
- ((mouse->grab->window == pWin) || (mouse->grab->confineTo == pWin)))
- (*mouse->DeactivateGrab)(mouse);
+ grab = mouse->coreGrab.grab;
+ if (grab &&
+ ((grab->window == pWin) || (grab->confineTo == pWin)))
+ (*mouse->coreGrab.DeactivateGrab)(mouse);
/* Deactivating a keyboard grab should cause focus events. */
- if (keybd->grab && (keybd->grab->window == pWin))
- (*keybd->DeactivateGrab)(keybd);
+ grab = keybd->coreGrab.grab;
+ if (grab && (grab->window == pWin))
+ (*keybd->coreGrab.DeactivateGrab)(keybd);
/* If the focus window is a root window (ie. has no parent) then don't
delete the focus from it. */
@@ -4570,7 +4625,7 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
/* If a grab is in progress, then alter the mode of focus events. */
- if (keybd->grab)
+ if (keybd->coreGrab.grab)
focusEventMode = NotifyWhileGrabbed;
switch (focus->revert)
@@ -4644,11 +4699,11 @@ CheckCursorConfinement(WindowPtr pWin)
{
if (DevHasCursor(pDev))
{
- grab = pDev->grab;
+ grab = pDev->coreGrab.grab;
if (grab && (confineTo = grab->confineTo))
{
if (!BorderSizeNotEmpty(pDev, confineTo))
- (*inputInfo.pointer->DeactivateGrab)(pDev);
+ (*inputInfo.pointer->coreGrab.DeactivateGrab)(pDev);
else if ((pWin == confineTo) || IsParent(pWin, confineTo))
ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE);
}
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index c0e21dd5e..2981e173c 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2478,8 +2478,6 @@ xf86HandleConfigFile(Bool autoconfig)
return CONFIG_PARSE_ERROR;
}
- checkInput(&xf86ConfigLayout);
-
/*
* Handle some command line options that can override some of the
* ServerFlags settings.
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 204457fb1..9a24040af 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -1030,9 +1030,11 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd)
else
{
/* If the keyboard is actively grabbed, deliver a grabbed core event */
- if (keybd->grab && !keybd->fromPassiveGrab)
+ if (keybd->coreGrab.grab && !keybd->coreGrab.fromPassiveGrab)
{
- core.u.u.type = coreEquiv;
+ /* I've got no clue if that is correct but only working on core
+ * grabs seems the right thing here. (whot) */
+ core.u.u.type = coreEquiv;
core.u.u.detail = de->u.u.detail;
core.u.keyButtonPointer.time = de->u.event.time;
core.u.keyButtonPointer.eventX = de->u.event.dx;
@@ -1109,8 +1111,10 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse)
else
{
/* If the pointer is actively grabbed, deliver a grabbed core event */
- if (mouse->grab && !mouse->fromPassiveGrab)
+ if (mouse->coreGrab.grab && !mouse->coreGrab.fromPassiveGrab)
{
+ /* I've got no clue if that is correct but only working on core
+ * grabs seems the right thing here. (whot) */
core.u.u.type = coreEquiv;
core.u.u.detail = de->u.u.detail;
core.u.keyButtonPointer.time = de->u.event.time;
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 5f4371432..a91f6b34e 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -290,12 +290,13 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
break;
case ACTION_DISABLEGRAB:
if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) {
- if (inputInfo.pointer && inputInfo.pointer->grab != NULL &&
- inputInfo.pointer->DeactivateGrab)
- inputInfo.pointer->DeactivateGrab(inputInfo.pointer);
- if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL &&
- inputInfo.keyboard->DeactivateGrab)
- inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard);
+ if (inputInfo.pointer && inputInfo.pointer->coreGrab.grab != NULL &&
+ inputInfo.pointer->coreGrab.DeactivateGrab)
+ inputInfo.pointer->coreGrab.DeactivateGrab(inputInfo.pointer);
+ if (inputInfo.keyboard &&
+ inputInfo.keyboard->coreGrab.grab != NULL &&
+ inputInfo.keyboard->coreGrab.DeactivateGrab)
+ inputInfo.keyboard->coreGrab.DeactivateGrab(inputInfo.keyboard);
}
break;
case ACTION_CLOSECLIENT:
@@ -303,10 +304,11 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
ClientPtr pointer, keyboard, server;
pointer = keyboard = server = NULL;
- if (inputInfo.pointer && inputInfo.pointer->grab != NULL)
- pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)];
- if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) {
- keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)];
+ if (inputInfo.pointer && inputInfo.pointer->coreGrab.grab != NULL)
+ pointer = clients[CLIENT_ID(inputInfo.pointer->coreGrab.grab->resource)];
+ if (inputInfo.keyboard && inputInfo.keyboard->coreGrab.grab != NULL)
+ {
+ keyboard = clients[CLIENT_ID(inputInfo.keyboard->coreGrab.grab->resource)];
if (keyboard == pointer)
keyboard = NULL;
}
diff --git a/include/dix.h b/include/dix.h
index 95c69f057..f22f48964 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -469,7 +469,8 @@ extern void AllowSome(
ClientPtr /* client */,
TimeStamp /* time */,
DeviceIntPtr /* thisDev */,
- int /* newState */);
+ int /* newState */,
+ Bool /* core */);
extern void ReleaseActiveGrabs(
ClientPtr client);
diff --git a/include/input.h b/include/input.h
index ca81b1af6..2d72f838b 100644
--- a/include/input.h
+++ b/include/input.h
@@ -455,7 +455,7 @@ extern DeviceIntPtr GetPairedPointer(DeviceIntPtr kbd);
extern Bool RegisterPairingClient(ClientPtr client);
extern Bool UnregisterPairingClient(ClientPtr client);
-extern DeviceIntPtr GuessFreePointerDevice();
+extern DeviceIntPtr GuessFreePointerDevice(void);
/* Window/device based access control */
extern Bool ACRegisterClient(ClientPtr client);
diff --git a/include/inputstr.h b/include/inputstr.h
index 90a985b5f..8c3e5604d 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -300,11 +300,31 @@ typedef struct {
#define FROZEN_NO_EVENT 5
#define FROZEN_WITH_EVENT 6
#define THAW_OTHERS 7
+typedef struct _GrabInfoRec {
+ TimeStamp grabTime;
+ Bool fromPassiveGrab;
+ GrabRec activeGrab;
+ GrabPtr grab;
+ CARD8 activatingKey;
+ void (*ActivateGrab) (
+ DeviceIntPtr /*device*/,
+ GrabPtr /*grab*/,
+ TimeStamp /*time*/,
+ Bool /*autoGrab*/);
+ void (*DeactivateGrab)(
+ DeviceIntPtr /*device*/);
+ struct {
+ Bool frozen;
+ int state;
+ GrabPtr other; /* if other grab has this frozen */
+ xEvent *event; /* saved to be replayed */
+ int evcount;
+ } sync;
+} GrabInfoRec, *GrabInfoPtr;
typedef struct _DeviceIntRec {
DeviceRec public;
DeviceIntPtr next;
- TimeStamp grabTime;
Bool startup; /* true if needs to be turned on at
server intialization time */
DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
@@ -313,27 +333,11 @@ typedef struct _DeviceIntRec {
Bool inited; /* TRUE if INIT returns Success */
Bool enabled; /* TRUE if ON returns Success */
Bool coreEvents; /* TRUE if device also sends core */
- GrabPtr grab; /* the grabber - used by DIX */
- struct {
- Bool frozen;
- int state;
- GrabPtr other; /* if other grab has this frozen */
- xEvent *event; /* saved to be replayed */
- int evcount;
- } sync;
+ GrabInfoRec coreGrab; /* grab on core events */
+ GrabInfoRec deviceGrab; /* grab on device events */
Atom type;
char *name;
CARD8 id;
- CARD8 activatingKey;
- Bool fromPassiveGrab;
- GrabRec activeGrab;
- void (*ActivateGrab) (
- DeviceIntPtr /*device*/,
- GrabPtr /*grab*/,
- TimeStamp /*time*/,
- Bool /*autoGrab*/);
- void (*DeactivateGrab)(
- DeviceIntPtr /*device*/);
KeyClassPtr key;
ValuatorClassPtr valuator;
ButtonClassPtr button;
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 139221f3f..eeb9dec7c 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -808,6 +808,7 @@ XkbFilterEvents(ClientPtr pClient,int nEvents,xEvent *xE)
int i, button_mask;
DeviceIntPtr pXDev = (DeviceIntPtr)LookupKeyboardDevice();
XkbSrvInfoPtr xkbi;
+GrabInfoPtr grabinfo;
xkbi= pXDev->key->xkbInfo;
if ( pClient->xkbClientFlags & _XkbClientInitialized ) {
@@ -831,7 +832,9 @@ XkbSrvInfoPtr xkbi;
(_XkbIsReleaseEvent(xE[0].u.u.type)) ) {
return False;
}
- if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab &&
+ /* just coreGrab is fine, pXDev is inputInfo.keyboard (see above) */
+ if ((pXDev->coreGrab.grab != NullGrab)
+ && pXDev->coreGrab.fromPassiveGrab &&
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
register unsigned state,flags;