input: replace GRABTYPE_* with the InputLevel enums

They achieve the same thing, re-use the more generic InputLevel so we can
convert to/fro easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
Peter Hutterer 2011-12-08 14:27:01 +10:00
parent cd56bd7b3e
commit 218752bdc5
18 changed files with 152 additions and 158 deletions

View File

@ -1389,9 +1389,9 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
int int
CheckGrabValues(ClientPtr client, GrabParameters* param) CheckGrabValues(ClientPtr client, GrabParameters* param)
{ {
if (param->grabtype != GRABTYPE_CORE && if (param->grabtype != CORE &&
param->grabtype != GRABTYPE_XI && param->grabtype != XI &&
param->grabtype != GRABTYPE_XI2) param->grabtype != XI2)
{ {
ErrorF("[Xi] grabtype is invalid. This is a bug.\n"); ErrorF("[Xi] grabtype is invalid. This is a bug.\n");
return BadImplementation; return BadImplementation;
@ -1408,7 +1408,7 @@ CheckGrabValues(ClientPtr client, GrabParameters* param)
return BadValue; return BadValue;
} }
if (param->grabtype != GRABTYPE_XI2 && (param->modifiers != AnyModifier) && if (param->grabtype != XI2 && (param->modifiers != AnyModifier) &&
(param->modifiers & ~AllModifiersMask)) { (param->modifiers & ~AllModifiersMask)) {
client->errorValue = param->modifiers; client->errorValue = param->modifiers;
return BadValue; return BadValue;
@ -1423,7 +1423,7 @@ CheckGrabValues(ClientPtr client, GrabParameters* param)
int int
GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
int button, GrabParameters *param, GrabType grabtype, int button, GrabParameters *param, enum InputLevel grabtype,
GrabMask *mask) GrabMask *mask)
{ {
WindowPtr pWin, confineTo; WindowPtr pWin, confineTo;
@ -1463,9 +1463,9 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (rc != Success) if (rc != Success)
return rc; return rc;
if (grabtype == GRABTYPE_XI) if (grabtype == XI)
type = DeviceButtonPress; type = DeviceButtonPress;
else if (grabtype == GRABTYPE_XI2) else if (grabtype == XI2)
type = XI_ButtonPress; type = XI_ButtonPress;
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype, grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
@ -1476,12 +1476,12 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
} }
/** /**
* Grab the given key. If grabtype is GRABTYPE_XI, the key is a keycode. If * Grab the given key. If grabtype is XI, the key is a keycode. If
* grabtype is GRABTYPE_XI2, the key is a keysym. * grabtype is XI2, the key is a keysym.
*/ */
int int
GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
int key, GrabParameters *param, GrabType grabtype, GrabMask *mask) int key, GrabParameters *param, enum InputLevel grabtype, GrabMask *mask)
{ {
WindowPtr pWin; WindowPtr pWin;
GrabPtr grab; GrabPtr grab;
@ -1494,7 +1494,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
return rc; return rc;
if ((dev->id != XIAllDevices && dev->id != XIAllMasterDevices) && k == NULL) if ((dev->id != XIAllDevices && dev->id != XIAllMasterDevices) && k == NULL)
return BadMatch; return BadMatch;
if (grabtype == GRABTYPE_XI) if (grabtype == XI)
{ {
if ((key > k->xkbInfo->desc->max_key_code || if ((key > k->xkbInfo->desc->max_key_code ||
key < k->xkbInfo->desc->min_key_code) key < k->xkbInfo->desc->min_key_code)
@ -1503,7 +1503,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
return BadValue; return BadValue;
} }
type = DeviceKeyPress; type = DeviceKeyPress;
} else if (grabtype == GRABTYPE_XI2) } else if (grabtype == XI2)
type = XI_KeyPress; type = XI_KeyPress;
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess); rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
@ -1558,7 +1558,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
if (rc != Success) if (rc != Success)
return rc; return rc;
grab = CreateGrab(client->index, dev, dev, pWin, GRABTYPE_XI2, grab = CreateGrab(client->index, dev, dev, pWin, XI2,
mask, param, (type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn, mask, param, (type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn,
0, NULL, cursor); 0, NULL, cursor);

View File

@ -130,7 +130,7 @@ ProcXGrabDevice(ClientPtr client)
rc = GrabDevice(client, dev, stuff->other_devices_mode, rc = GrabDevice(client, dev, stuff->other_devices_mode,
stuff->this_device_mode, stuff->grabWindow, stuff->this_device_mode, stuff->grabWindow,
stuff->ownerEvents, stuff->time, stuff->ownerEvents, stuff->time,
&mask, GRABTYPE_XI, None, None, &mask, XI, None, None,
&rep.status); &rep.status);
if (rc != Success) if (rc != Success)

View File

@ -137,7 +137,7 @@ ProcXGrabDeviceButton(ClientPtr client)
return ret; return ret;
memset(&param, 0, sizeof(param)); memset(&param, 0, sizeof(param));
param.grabtype = GRABTYPE_XI; param.grabtype = XI;
param.ownerEvents = stuff->ownerEvents; param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->this_device_mode; param.this_device_mode = stuff->this_device_mode;
param.other_devices_mode = stuff->other_devices_mode; param.other_devices_mode = stuff->other_devices_mode;
@ -146,7 +146,7 @@ ProcXGrabDeviceButton(ClientPtr client)
mask.xi = tmp[stuff->grabbed_device].mask; mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabButton(client, dev, mdev, stuff->button, &param, ret = GrabButton(client, dev, mdev, stuff->button, &param,
GRABTYPE_XI, &mask); XI, &mask);
return ret; return ret;
} }

View File

@ -135,7 +135,7 @@ ProcXGrabDeviceKey(ClientPtr client)
memset(&param, 0, sizeof(param)); memset(&param, 0, sizeof(param));
param.grabtype = GRABTYPE_XI; param.grabtype = XI;
param.ownerEvents = stuff->ownerEvents; param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->this_device_mode; param.this_device_mode = stuff->this_device_mode;
param.other_devices_mode = stuff->other_devices_mode; param.other_devices_mode = stuff->other_devices_mode;
@ -143,7 +143,7 @@ ProcXGrabDeviceKey(ClientPtr client)
param.modifiers = stuff->modifiers; param.modifiers = stuff->modifiers;
mask.xi = tmp[stuff->grabbed_device].mask; mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabKey(client, dev, mdev, stuff->key, &param, GRABTYPE_XI, &mask); ret = GrabKey(client, dev, mdev, stuff->key, &param, XI, &mask);
return ret; return ret;
} }

View File

@ -102,7 +102,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->grabtype == GRABTYPE_XI) (grab) && SameClient(grab, client) && grab->grabtype == XI)
(*dev->deviceGrab.DeactivateGrab) (dev); (*dev->deviceGrab.DeactivateGrab) (dev);
return Success; return Success;
} }

View File

@ -134,7 +134,7 @@ ProcXUngrabDeviceButton(ClientPtr client)
temporaryGrab->device = dev; temporaryGrab->device = dev;
temporaryGrab->window = pWin; temporaryGrab->window = pWin;
temporaryGrab->type = DeviceButtonPress; temporaryGrab->type = DeviceButtonPress;
temporaryGrab->grabtype = GRABTYPE_XI; temporaryGrab->grabtype = XI;
temporaryGrab->modifierDevice = mdev; temporaryGrab->modifierDevice = mdev;
temporaryGrab->modifiersDetail.exact = stuff->modifiers; temporaryGrab->modifiersDetail.exact = stuff->modifiers;
temporaryGrab->modifiersDetail.pMask = NULL; temporaryGrab->modifiersDetail.pMask = NULL;

View File

@ -141,7 +141,7 @@ ProcXUngrabDeviceKey(ClientPtr client)
temporaryGrab->device = dev; temporaryGrab->device = dev;
temporaryGrab->window = pWin; temporaryGrab->window = pWin;
temporaryGrab->type = DeviceKeyPress; temporaryGrab->type = DeviceKeyPress;
temporaryGrab->grabtype = GRABTYPE_XI; temporaryGrab->grabtype = XI;
temporaryGrab->modifierDevice = mdev; temporaryGrab->modifierDevice = mdev;
temporaryGrab->modifiersDetail.exact = stuff->modifiers; temporaryGrab->modifiersDetail.exact = stuff->modifiers;
temporaryGrab->modifiersDetail.pMask = NULL; temporaryGrab->modifiersDetail.pMask = NULL;

View File

@ -96,7 +96,7 @@ ProcXIGrabDevice(ClientPtr client)
stuff->owner_events, stuff->owner_events,
stuff->time, stuff->time,
&mask, &mask,
GRABTYPE_XI2, XI2,
stuff->cursor, stuff->cursor,
None /* confineTo */, None /* confineTo */,
&status); &status);
@ -148,7 +148,7 @@ ProcXIUngrabDevice(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->grabtype == GRABTYPE_XI2) (grab) && SameClient(grab, client) && grab->grabtype == XI2)
(*dev->deviceGrab.DeactivateGrab) (dev); (*dev->deviceGrab.DeactivateGrab) (dev);
return Success; return Success;

View File

@ -139,7 +139,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
rep.num_modifiers = 0; rep.num_modifiers = 0;
memset(&param, 0, sizeof(param)); memset(&param, 0, sizeof(param));
param.grabtype = GRABTYPE_XI2; param.grabtype = XI2;
param.ownerEvents = stuff->owner_events; param.ownerEvents = stuff->owner_events;
param.this_device_mode = stuff->grab_mode; param.this_device_mode = stuff->grab_mode;
param.other_devices_mode = stuff->paired_device_mode; param.other_devices_mode = stuff->paired_device_mode;
@ -183,11 +183,11 @@ ProcXIPassiveGrabDevice(ClientPtr client)
{ {
case XIGrabtypeButton: case XIGrabtypeButton:
status = GrabButton(client, dev, mod_dev, stuff->detail, status = GrabButton(client, dev, mod_dev, stuff->detail,
&param, GRABTYPE_XI2, &mask); &param, XI2, &mask);
break; break;
case XIGrabtypeKeycode: case XIGrabtypeKeycode:
status = GrabKey(client, dev, mod_dev, stuff->detail, status = GrabKey(client, dev, mod_dev, stuff->detail,
&param, GRABTYPE_XI2, &mask); &param, XI2, &mask);
break; break;
case XIGrabtypeEnter: case XIGrabtypeEnter:
case XIGrabtypeFocusIn: case XIGrabtypeFocusIn:
@ -313,7 +313,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
case XIGrabtypeEnter: tempGrab->type = XI_Enter; break; case XIGrabtypeEnter: tempGrab->type = XI_Enter; break;
case XIGrabtypeFocusIn: tempGrab->type = XI_FocusIn; break; case XIGrabtypeFocusIn: tempGrab->type = XI_FocusIn; break;
} }
tempGrab->grabtype = GRABTYPE_XI2; tempGrab->grabtype = XI2;
tempGrab->modifierDevice = mod_dev; tempGrab->modifierDevice = mod_dev;
tempGrab->modifiersDetail.pMask = NULL; tempGrab->modifiersDetail.pMask = NULL;
tempGrab->detail.exact = stuff->detail; tempGrab->detail.exact = stuff->detail;

View File

@ -1484,7 +1484,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
Bool isPassive = autoGrab & ~ImplicitGrabMask; Bool isPassive = autoGrab & ~ImplicitGrabMask;
/* slave devices need to float for the duration of the grab. */ /* slave devices need to float for the duration of the grab. */
if (grab->grabtype == GRABTYPE_XI2 && if (grab->grabtype == XI2 &&
!(autoGrab & ImplicitGrabMask) && !IsMaster(mouse)) !(autoGrab & ImplicitGrabMask) && !IsMaster(mouse))
DetachFromMaster(mouse); DetachFromMaster(mouse);
@ -1543,7 +1543,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
if (grab->cursor) if (grab->cursor)
FreeCursor(grab->cursor, (Cursor)0); FreeCursor(grab->cursor, (Cursor)0);
if (!wasImplicit && grab->grabtype == GRABTYPE_XI2) if (!wasImplicit && grab->grabtype == XI2)
ReattachToOldMaster(mouse); ReattachToOldMaster(mouse);
ComputeFreezes(); ComputeFreezes();
@ -1561,7 +1561,7 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool pass
WindowPtr oldWin; WindowPtr oldWin;
/* slave devices need to float for the duration of the grab. */ /* slave devices need to float for the duration of the grab. */
if (grab->grabtype == GRABTYPE_XI2 && if (grab->grabtype == XI2 &&
!(passive & ImplicitGrabMask) && !(passive & ImplicitGrabMask) &&
!IsMaster(keybd)) !IsMaster(keybd))
DetachFromMaster(keybd); DetachFromMaster(keybd);
@ -1616,7 +1616,7 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
} }
DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
if (!wasImplicit && grab->grabtype == GRABTYPE_XI2) if (!wasImplicit && grab->grabtype == XI2)
ReattachToOldMaster(keybd); ReattachToOldMaster(keybd);
ComputeFreezes(); ComputeFreezes();
@ -1974,14 +1974,14 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win,
GrabPtr tempGrab; GrabPtr tempGrab;
OtherInputMasks *inputMasks; OtherInputMasks *inputMasks;
CARD8 type = event->u.u.type; CARD8 type = event->u.u.type;
GrabType grabtype; enum InputLevel grabtype;
if (type == ButtonPress) if (type == ButtonPress)
grabtype = GRABTYPE_CORE; grabtype = CORE;
else if (type == DeviceButtonPress) else if (type == DeviceButtonPress)
grabtype = GRABTYPE_XI; grabtype = XI;
else if ((type = xi2_get_type(event)) == XI_ButtonPress) else if ((type = xi2_get_type(event)) == XI_ButtonPress)
grabtype = GRABTYPE_XI2; grabtype = XI2;
else else
return FALSE; return FALSE;
@ -3656,13 +3656,13 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event)
/* The only consumers of corestate are Xi 1.x and core events, which /* The only consumers of corestate are Xi 1.x and core events, which
* are guaranteed to come from DeviceEvents. */ * are guaranteed to come from DeviceEvents. */
if (grab->grabtype == GRABTYPE_XI || grab->grabtype == GRABTYPE_CORE) if (grab->grabtype == XI || grab->grabtype == CORE)
{ {
DeviceIntPtr gdev; DeviceIntPtr gdev;
event->device_event.corestate &= 0x1f00; event->device_event.corestate &= 0x1f00;
if (grab->grabtype == GRABTYPE_CORE) if (grab->grabtype == CORE)
gdev = GetMaster(device, KEYBOARD_OR_FLOAT); gdev = GetMaster(device, KEYBOARD_OR_FLOAT);
else else
gdev = grab->modifierDevice; gdev = grab->modifierDevice;
@ -3672,7 +3672,7 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event)
gdev->key->xkbInfo->state.grab_mods & (~0x1f00); gdev->key->xkbInfo->state.grab_mods & (~0x1f00);
} }
if (grab->grabtype == GRABTYPE_CORE) if (grab->grabtype == CORE)
{ {
rc = EventToCore(event, &xE, &count); rc = EventToCore(event, &xE, &count);
if (rc != Success) if (rc != Success)
@ -3681,7 +3681,7 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event)
"(%d, %d).\n", device->name, event->any.type, rc); "(%d, %d).\n", device->name, event->any.type, rc);
return FALSE; return FALSE;
} }
} else if (grab->grabtype == GRABTYPE_XI2) } else if (grab->grabtype == XI2)
{ {
rc = EventToXI2(event, &xE); rc = EventToXI2(event, &xE);
if (rc != Success) if (rc != Success)
@ -3737,7 +3737,7 @@ CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab)
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
GrabPtr othergrab = other->deviceGrab.grab; GrabPtr othergrab = other->deviceGrab.grab;
if (othergrab && othergrab->grabtype == GRABTYPE_CORE && if (othergrab && othergrab->grabtype == CORE &&
SameClient(grab, rClient(othergrab)) && SameClient(grab, rClient(othergrab)) &&
((IsPointerDevice(grab->device) && ((IsPointerDevice(grab->device) &&
IsPointerDevice(othergrab->device)) || IsPointerDevice(othergrab->device)) ||
@ -3781,18 +3781,18 @@ MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level, int event_t
switch(level) switch(level)
{ {
case XI2: case XI2:
grabtype = GRABTYPE_XI2; grabtype = XI2;
evtype = GetXI2Type(event_type); evtype = GetXI2Type(event_type);
BUG_WARN(!evtype); BUG_WARN(!evtype);
match = XI2_MATCH; match = XI2_MATCH;
break; break;
case XI: case XI:
grabtype = GRABTYPE_XI; grabtype = XI;
evtype = GetXIType(event_type); evtype = GetXIType(event_type);
match = XI_MATCH; match = XI_MATCH;
break; break;
case CORE: case CORE:
grabtype = GRABTYPE_CORE; grabtype = CORE;
evtype = GetCoreType(event_type); evtype = GetCoreType(event_type);
match = CORE_MATCH; match = CORE_MATCH;
ignore_device = TRUE; ignore_device = TRUE;
@ -3830,10 +3830,10 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
enum MatchFlags match = 0; enum MatchFlags match = 0;
gdev = grab->modifierDevice; gdev = grab->modifierDevice;
if (grab->grabtype == GRABTYPE_CORE) if (grab->grabtype == CORE)
{ {
gdev = GetMaster(device, KEYBOARD_OR_FLOAT); gdev = GetMaster(device, KEYBOARD_OR_FLOAT);
} else if (grab->grabtype == GRABTYPE_XI2) } else if (grab->grabtype == XI2)
{ {
/* if the device is an attached slave device, gdev must be the /* if the device is an attached slave device, gdev must be the
* attached master keyboard. Since the slave may have been * attached master keyboard. Since the slave may have been
@ -3868,7 +3868,7 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
* device. * device.
*/ */
if (grab->grabtype == GRABTYPE_CORE) if (grab->grabtype == CORE)
{ {
/* A passive grab may have been created for a different device /* A passive grab may have been created for a different device
than it is assigned to at this point in time. than it is assigned to at this point in time.
@ -4272,7 +4272,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
sendCore = (IsMaster(thisDev) && thisDev->coreEvents); sendCore = (IsMaster(thisDev) && thisDev->coreEvents);
/* try core event */ /* try core event */
if (sendCore && grab->grabtype == GRABTYPE_CORE) if (sendCore && grab->grabtype == CORE)
{ {
deliveries = DeliverOneGrabbedEvent(event, thisDev, CORE); deliveries = DeliverOneGrabbedEvent(event, thisDev, CORE);
} }
@ -4970,7 +4970,7 @@ ProcGrabPointer(ClientPtr client)
rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode, rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode,
stuff->grabWindow, stuff->ownerEvents, stuff->time, stuff->grabWindow, stuff->ownerEvents, stuff->time,
&mask, GRABTYPE_CORE, stuff->cursor, &mask, CORE, stuff->cursor,
stuff->confineTo, &rep.status); stuff->confineTo, &rep.status);
if (rc != Success) if (rc != Success)
return rc; return rc;
@ -5178,9 +5178,9 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
tempGrab->ownerEvents = ownerEvents; tempGrab->ownerEvents = ownerEvents;
tempGrab->keyboardMode = keyboard_mode; tempGrab->keyboardMode = keyboard_mode;
tempGrab->pointerMode = pointer_mode; tempGrab->pointerMode = pointer_mode;
if (grabtype == GRABTYPE_CORE) if (grabtype == CORE)
tempGrab->eventMask = mask->core; tempGrab->eventMask = mask->core;
else if (grabtype == GRABTYPE_XI) else if (grabtype == XI)
tempGrab->eventMask = mask->xi; tempGrab->eventMask = mask->xi;
else else
xi2mask_merge(tempGrab->xi2mask, mask->xi2mask); xi2mask_merge(tempGrab->xi2mask, mask->xi2mask);
@ -5217,7 +5217,7 @@ ProcGrabKeyboard(ClientPtr client)
result = GrabDevice(client, keyboard, stuff->pointerMode, result = GrabDevice(client, keyboard, stuff->pointerMode,
stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents,
stuff->time, &mask, GRABTYPE_CORE, None, None, stuff->time, &mask, CORE, None, None,
&rep.status); &rep.status);
if (result != Success) if (result != Success)
@ -5250,7 +5250,7 @@ ProcUngrabKeyboard(ClientPtr client)
time = ClientTimeToServerTime(stuff->id); time = ClientTimeToServerTime(stuff->id);
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
(grab) && SameClient(grab, client) && grab->grabtype == GRABTYPE_CORE) (grab) && SameClient(grab, client) && grab->grabtype == CORE)
(*device->deviceGrab.DeactivateGrab)(device); (*device->deviceGrab.DeactivateGrab)(device);
return Success; return Success;
} }
@ -5542,7 +5542,7 @@ ProcUngrabKey(ClientPtr client)
tempGrab->modifiersDetail.pMask = NULL; tempGrab->modifiersDetail.pMask = NULL;
tempGrab->modifierDevice = keybd; tempGrab->modifierDevice = keybd;
tempGrab->type = KeyPress; tempGrab->type = KeyPress;
tempGrab->grabtype = GRABTYPE_CORE; tempGrab->grabtype = CORE;
tempGrab->detail.exact = stuff->key; tempGrab->detail.exact = stuff->key;
tempGrab->detail.pMask = NULL; tempGrab->detail.pMask = NULL;
tempGrab->next = NULL; tempGrab->next = NULL;
@ -5575,7 +5575,7 @@ ProcGrabKey(ClientPtr client)
REQUEST_SIZE_MATCH(xGrabKeyReq); REQUEST_SIZE_MATCH(xGrabKeyReq);
memset(&param, 0, sizeof(param)); memset(&param, 0, sizeof(param));
param.grabtype = GRABTYPE_CORE; param.grabtype = CORE;
param.ownerEvents = stuff->ownerEvents; param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->keyboardMode; param.this_device_mode = stuff->keyboardMode;
param.other_devices_mode = stuff->pointerMode; param.other_devices_mode = stuff->pointerMode;
@ -5599,7 +5599,7 @@ ProcGrabKey(ClientPtr client)
mask.core = (KeyPressMask | KeyReleaseMask); mask.core = (KeyPressMask | KeyReleaseMask);
grab = CreateGrab(client->index, keybd, keybd, pWin, GRABTYPE_CORE, &mask, grab = CreateGrab(client->index, keybd, keybd, pWin, CORE, &mask,
&param, KeyPress, stuff->key, NullWindow, NullCursor); &param, KeyPress, stuff->key, NullWindow, NullCursor);
if (!grab) if (!grab)
return BadAlloc; return BadAlloc;
@ -5690,7 +5690,7 @@ ProcGrabButton(ClientPtr client)
return rc; return rc;
memset(&param, 0, sizeof(param)); memset(&param, 0, sizeof(param));
param.grabtype = GRABTYPE_CORE; param.grabtype = CORE;
param.ownerEvents = stuff->ownerEvents; param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->keyboardMode; param.this_device_mode = stuff->keyboardMode;
param.other_devices_mode = stuff->pointerMode; param.other_devices_mode = stuff->pointerMode;
@ -5699,7 +5699,7 @@ ProcGrabButton(ClientPtr client)
mask.core = stuff->eventMask; mask.core = stuff->eventMask;
grab = CreateGrab(client->index, ptr, modifierDevice, pWin, grab = CreateGrab(client->index, ptr, modifierDevice, pWin,
GRABTYPE_CORE, &mask, &param, ButtonPress, CORE, &mask, &param, ButtonPress,
stuff->button, confineTo, cursor); stuff->button, confineTo, cursor);
if (!grab) if (!grab)
return BadAlloc; return BadAlloc;
@ -5744,7 +5744,7 @@ ProcUngrabButton(ClientPtr client)
tempGrab->modifierDevice = GetMaster(ptr, MASTER_KEYBOARD); tempGrab->modifierDevice = GetMaster(ptr, MASTER_KEYBOARD);
tempGrab->type = ButtonPress; tempGrab->type = ButtonPress;
tempGrab->detail.exact = stuff->button; tempGrab->detail.exact = stuff->button;
tempGrab->grabtype = GRABTYPE_CORE; tempGrab->grabtype = CORE;
tempGrab->detail.pMask = NULL; tempGrab->detail.pMask = NULL;
tempGrab->next = NULL; tempGrab->next = NULL;
@ -6151,7 +6151,7 @@ PickPointer(ClientPtr client)
for(it = inputInfo.devices; it; it = it->next) for(it = inputInfo.devices; it; it = it->next)
{ {
GrabPtr grab = it->deviceGrab.grab; GrabPtr grab = it->deviceGrab.grab;
if (grab && grab->grabtype == GRABTYPE_CORE && SameClient(grab, client)) if (grab && grab->grabtype == CORE && SameClient(grab, client))
{ {
it = GetMaster(it, MASTER_POINTER); it = GetMaster(it, MASTER_POINTER);
return it; /* Always return a core grabbed device */ return it; /* Always return a core grabbed device */

View File

@ -81,8 +81,8 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):", ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):",
(unsigned long) grab->resource, (unsigned long) grab->resource,
(grab->grabtype == GRABTYPE_XI2) ? "xi2" : (grab->grabtype == XI2) ? "xi2" :
((grab->grabtype == GRABTYPE_CORE) ? "core" : "xi1"), ((grab->grabtype == CORE) ? "core" : "xi1"),
dev->name, dev->id); dev->name, dev->id);
client = clients[CLIENT_ID(grab->resource)]; client = clients[CLIENT_ID(grab->resource)];
@ -111,18 +111,18 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
devGrab->sync.frozen ? "frozen" : "thawed", devGrab->sync.frozen ? "frozen" : "thawed",
devGrab->sync.state); devGrab->sync.state);
if (grab->grabtype == GRABTYPE_CORE) if (grab->grabtype == CORE)
{ {
ErrorF(" core event mask 0x%lx\n", ErrorF(" core event mask 0x%lx\n",
(unsigned long) grab->eventMask); (unsigned long) grab->eventMask);
} }
else if (grab->grabtype == GRABTYPE_XI) else if (grab->grabtype == XI)
{ {
ErrorF(" xi1 event mask 0x%lx\n", ErrorF(" xi1 event mask 0x%lx\n",
devGrab->implicitGrab ? (unsigned long) grab->deviceMask : devGrab->implicitGrab ? (unsigned long) grab->deviceMask :
(unsigned long) grab->eventMask); (unsigned long) grab->eventMask);
} }
else if (grab->grabtype == GRABTYPE_XI2) else if (grab->grabtype == XI2)
{ {
for (i = 0; i < xi2mask_num_masks(grab->xi2mask); i++) for (i = 0; i < xi2mask_num_masks(grab->xi2mask); i++)
{ {
@ -206,7 +206,7 @@ CreateGrab(
DeviceIntPtr device, DeviceIntPtr device,
DeviceIntPtr modDevice, DeviceIntPtr modDevice,
WindowPtr window, WindowPtr window,
GrabType grabtype, enum InputLevel grabtype,
GrabMask *mask, GrabMask *mask,
GrabParameters *param, GrabParameters *param,
int type, int type,
@ -238,7 +238,7 @@ CreateGrab(
grab->cursor = cursor; grab->cursor = cursor;
grab->next = NULL; grab->next = NULL;
if (grabtype == GRABTYPE_XI2) if (grabtype == XI2)
xi2mask_merge(grab->xi2mask, mask->xi2mask); xi2mask_merge(grab->xi2mask, mask->xi2mask);
if (cursor) if (cursor)
cursor->refcnt++; cursor->refcnt++;
@ -410,7 +410,7 @@ DetailSupersedesSecond(
static Bool static Bool
GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab) GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
{ {
unsigned int any_modifier = (pFirstGrab->grabtype == GRABTYPE_XI2) ? unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ?
(unsigned int)XIAnyModifier : (unsigned int)XIAnyModifier :
(unsigned int)AnyModifier; (unsigned int)AnyModifier;
if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail, if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail,
@ -441,14 +441,14 @@ GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
Bool Bool
GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice) GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice)
{ {
unsigned int any_modifier = (pFirstGrab->grabtype == GRABTYPE_XI2) ? unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ?
(unsigned int)XIAnyModifier : (unsigned int)XIAnyModifier :
(unsigned int)AnyModifier; (unsigned int)AnyModifier;
if (pFirstGrab->grabtype != pSecondGrab->grabtype) if (pFirstGrab->grabtype != pSecondGrab->grabtype)
return FALSE; return FALSE;
if (pFirstGrab->grabtype == GRABTYPE_XI2) if (pFirstGrab->grabtype == XI2)
{ {
if (pFirstGrab->device == inputInfo.all_devices || if (pFirstGrab->device == inputInfo.all_devices ||
pSecondGrab->device == inputInfo.all_devices) pSecondGrab->device == inputInfo.all_devices)
@ -500,7 +500,7 @@ GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice)
static Bool static Bool
GrabsAreIdentical(GrabPtr pFirstGrab, GrabPtr pSecondGrab) GrabsAreIdentical(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
{ {
unsigned int any_modifier = (pFirstGrab->grabtype == GRABTYPE_XI2) ? unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ?
(unsigned int)XIAnyModifier : (unsigned int)XIAnyModifier :
(unsigned int)AnyModifier; (unsigned int)AnyModifier;
@ -550,7 +550,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab)
for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next)
{ {
if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == GRABTYPE_CORE))) if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == CORE)))
{ {
if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource)) if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource))
{ {
@ -628,9 +628,9 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
return FALSE; return FALSE;
} }
any_modifier = (pMinuendGrab->grabtype == GRABTYPE_XI2) ? any_modifier = (pMinuendGrab->grabtype == XI2) ?
(unsigned int)XIAnyModifier : (unsigned int)AnyModifier; (unsigned int)XIAnyModifier : (unsigned int)AnyModifier;
any_key = (pMinuendGrab->grabtype == GRABTYPE_XI2) ? any_key = (pMinuendGrab->grabtype == XI2) ?
(unsigned int)XIAnyKeycode : (unsigned int)AnyKey; (unsigned int)XIAnyKeycode : (unsigned int)AnyKey;
ndels = nadds = nups = 0; ndels = nadds = nups = 0;
ok = TRUE; ok = TRUE;
@ -640,7 +640,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
{ {
if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource)) || if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource)) ||
!GrabMatchesSecond(grab, pMinuendGrab, !GrabMatchesSecond(grab, pMinuendGrab,
(grab->grabtype == GRABTYPE_CORE))) (grab->grabtype == CORE)))
continue; continue;
if (GrabSupersedesSecond(pMinuendGrab, grab)) if (GrabSupersedesSecond(pMinuendGrab, grab))
{ {

View File

@ -40,7 +40,7 @@ extern GrabPtr CreateGrab(
DeviceIntPtr /* device */, DeviceIntPtr /* device */,
DeviceIntPtr /* modDevice */, DeviceIntPtr /* modDevice */,
WindowPtr /* window */, WindowPtr /* window */,
GrabType /* grabtype */, enum InputLevel /* grabtype */,
GrabMask * /* mask */, GrabMask * /* mask */,
struct _GrabParameters * /* param */, struct _GrabParameters * /* param */,
int /* type */, int /* type */,

View File

@ -31,12 +31,6 @@
#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16)) #define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16))
enum InputLevel {
CORE,
XI,
XI2,
};
_X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count); _X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count);
_X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count); _X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count);
_X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi); _X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi);

View File

@ -159,7 +159,7 @@ typedef struct _XIClientRec {
typedef struct _GrabParameters { typedef struct _GrabParameters {
int grabtype; /* GRABTYPE_CORE, etc. */ int grabtype; /* CORE, etc. */
unsigned int ownerEvents; unsigned int ownerEvents;
unsigned int this_device_mode; unsigned int this_device_mode;
unsigned int other_devices_mode; unsigned int other_devices_mode;
@ -200,7 +200,7 @@ GrabButton(
DeviceIntPtr /* modifier_device */, DeviceIntPtr /* modifier_device */,
int /* button */, int /* button */,
GrabParameters* /* param */, GrabParameters* /* param */,
GrabType /* grabtype */, enum InputLevel /* grabtype */,
GrabMask* /* eventMask */); GrabMask* /* eventMask */);
extern int extern int
@ -210,7 +210,7 @@ GrabKey(
DeviceIntPtr /* modifier_device */, DeviceIntPtr /* modifier_device */,
int /* key */, int /* key */,
GrabParameters* /* param */, GrabParameters* /* param */,
GrabType /* grabtype */, enum InputLevel /* grabtype */,
GrabMask* /* eventMask */); GrabMask* /* eventMask */);
extern int extern int

View File

@ -102,6 +102,12 @@ SOFTWARE.
#define RevertToFollowKeyboard 3 #define RevertToFollowKeyboard 3
#endif #endif
enum InputLevel {
CORE,
XI,
XI2,
};
typedef unsigned long Leds; typedef unsigned long Leds;
typedef struct _OtherClients *OtherClientsPtr; typedef struct _OtherClients *OtherClientsPtr;
typedef struct _InputClients *InputClientsPtr; typedef struct _InputClients *InputClientsPtr;

View File

@ -167,12 +167,6 @@ typedef struct _DetailRec { /* Grab details may be bit masks */
Mask *pMask; Mask *pMask;
} DetailRec; } DetailRec;
typedef enum {
GRABTYPE_CORE,
GRABTYPE_XI,
GRABTYPE_XI2
} GrabType;
union _GrabMask { union _GrabMask {
Mask core; Mask core;
Mask xi; Mask xi;
@ -200,7 +194,7 @@ typedef struct _GrabRec {
unsigned ownerEvents:1; unsigned ownerEvents:1;
unsigned keyboardMode:1; unsigned keyboardMode:1;
unsigned pointerMode:1; unsigned pointerMode:1;
GrabType grabtype; enum InputLevel grabtype;
CARD8 type; /* event type */ CARD8 type; /* event type */
DetailRec modifiersDetail; DetailRec modifiersDetail;
DeviceIntPtr modifierDevice; DeviceIntPtr modifierDevice;

View File

@ -148,7 +148,7 @@ static void dix_check_grab_values(void)
memset(&client, 0, sizeof(client)); memset(&client, 0, sizeof(client));
param.grabtype = GRABTYPE_CORE; param.grabtype = CORE;
param.this_device_mode = GrabModeSync; param.this_device_mode = GrabModeSync;
param.other_devices_mode = GrabModeSync; param.other_devices_mode = GrabModeSync;
param.modifiers = AnyModifier; param.modifiers = AnyModifier;
@ -531,22 +531,22 @@ static void dix_grab_matching(void)
memset(&b, 0, sizeof(b)); memset(&b, 0, sizeof(b));
/* different grabtypes must fail */ /* different grabtypes must fail */
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
@ -568,8 +568,8 @@ static void dix_grab_matching(void)
inputInfo.all_devices = &xi_all_devices; inputInfo.all_devices = &xi_all_devices;
inputInfo.all_master_devices = &xi_all_master_devices; inputInfo.all_master_devices = &xi_all_master_devices;
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.device = &dev1; a.device = &dev1;
b.device = &dev2; b.device = &dev2;
@ -598,8 +598,8 @@ static void dix_grab_matching(void)
assert(rc == FALSE); assert(rc == FALSE);
/* ignoreDevice FALSE must fail for different devices for CORE and XI */ /* ignoreDevice FALSE must fail for different devices for CORE and XI */
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
a.device = &dev1; a.device = &dev1;
b.device = &dev2; b.device = &dev2;
a.modifierDevice = &dev1; a.modifierDevice = &dev1;
@ -607,8 +607,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
a.device = &dev1; a.device = &dev1;
b.device = &dev2; b.device = &dev2;
a.modifierDevice = &dev1; a.modifierDevice = &dev1;
@ -618,8 +618,8 @@ static void dix_grab_matching(void)
/* ignoreDevice FALSE must fail for different modifier devices for CORE /* ignoreDevice FALSE must fail for different modifier devices for CORE
* and XI */ * and XI */
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
a.device = &dev1; a.device = &dev1;
b.device = &dev1; b.device = &dev1;
a.modifierDevice = &dev1; a.modifierDevice = &dev1;
@ -627,8 +627,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
a.device = &dev1; a.device = &dev1;
b.device = &dev1; b.device = &dev1;
a.modifierDevice = &dev1; a.modifierDevice = &dev1;
@ -637,8 +637,8 @@ static void dix_grab_matching(void)
assert(rc == FALSE); assert(rc == FALSE);
/* different event type must fail */ /* different event type must fail */
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.device = &dev1; a.device = &dev1;
b.device = &dev1; b.device = &dev1;
a.modifierDevice = &dev1; a.modifierDevice = &dev1;
@ -650,8 +650,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&a, &b, TRUE); rc = GrabMatchesSecond(&a, &b, TRUE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
a.device = &dev1; a.device = &dev1;
b.device = &dev1; b.device = &dev1;
a.modifierDevice = &dev1; a.modifierDevice = &dev1;
@ -663,8 +663,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&a, &b, TRUE); rc = GrabMatchesSecond(&a, &b, TRUE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
a.device = &dev1; a.device = &dev1;
b.device = &dev1; b.device = &dev1;
a.modifierDevice = &dev1; a.modifierDevice = &dev1;
@ -677,8 +677,8 @@ static void dix_grab_matching(void)
assert(rc == FALSE); assert(rc == FALSE);
/* different modifiers must fail */ /* different modifiers must fail */
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.device = &dev1; a.device = &dev1;
b.device = &dev1; b.device = &dev1;
a.modifierDevice = &dev1; a.modifierDevice = &dev1;
@ -692,23 +692,23 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
/* AnyModifier must fail for XI2 */ /* AnyModifier must fail for XI2 */
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.modifiersDetail.exact = AnyModifier; a.modifiersDetail.exact = AnyModifier;
b.modifiersDetail.exact = 1; b.modifiersDetail.exact = 1;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
@ -717,8 +717,8 @@ static void dix_grab_matching(void)
assert(rc == FALSE); assert(rc == FALSE);
/* XIAnyModifier must fail for CORE and XI */ /* XIAnyModifier must fail for CORE and XI */
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
a.modifiersDetail.exact = XIAnyModifier; a.modifiersDetail.exact = XIAnyModifier;
b.modifiersDetail.exact = 1; b.modifiersDetail.exact = 1;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
@ -726,8 +726,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
a.modifiersDetail.exact = XIAnyModifier; a.modifiersDetail.exact = XIAnyModifier;
b.modifiersDetail.exact = 1; b.modifiersDetail.exact = 1;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
@ -736,8 +736,8 @@ static void dix_grab_matching(void)
assert(rc == FALSE); assert(rc == FALSE);
/* different detail must fail */ /* different detail must fail */
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.detail.exact = 1; a.detail.exact = 1;
b.detail.exact = 2; b.detail.exact = 2;
a.modifiersDetail.exact = 1; a.modifiersDetail.exact = 1;
@ -747,23 +747,23 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
/* detail of AnyModifier must fail */ /* detail of AnyModifier must fail */
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.detail.exact = AnyModifier; a.detail.exact = AnyModifier;
b.detail.exact = 1; b.detail.exact = 1;
a.modifiersDetail.exact = 1; a.modifiersDetail.exact = 1;
@ -773,23 +773,23 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
/* detail of XIAnyModifier must fail */ /* detail of XIAnyModifier must fail */
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.detail.exact = XIAnyModifier; a.detail.exact = XIAnyModifier;
b.detail.exact = 1; b.detail.exact = 1;
a.modifiersDetail.exact = 1; a.modifiersDetail.exact = 1;
@ -799,23 +799,23 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
rc = GrabMatchesSecond(&a, &b, FALSE); rc = GrabMatchesSecond(&a, &b, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == FALSE); assert(rc == FALSE);
/* XIAnyModifier or AnyModifer must succeed */ /* XIAnyModifier or AnyModifer must succeed */
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.detail.exact = 1; a.detail.exact = 1;
b.detail.exact = 1; b.detail.exact = 1;
a.modifiersDetail.exact = XIAnyModifier; a.modifiersDetail.exact = XIAnyModifier;
@ -825,8 +825,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == TRUE); assert(rc == TRUE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
a.detail.exact = 1; a.detail.exact = 1;
b.detail.exact = 1; b.detail.exact = 1;
a.modifiersDetail.exact = AnyModifier; a.modifiersDetail.exact = AnyModifier;
@ -836,8 +836,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == TRUE); assert(rc == TRUE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
a.detail.exact = 1; a.detail.exact = 1;
b.detail.exact = 1; b.detail.exact = 1;
a.modifiersDetail.exact = AnyModifier; a.modifiersDetail.exact = AnyModifier;
@ -848,8 +848,8 @@ static void dix_grab_matching(void)
assert(rc == TRUE); assert(rc == TRUE);
/* AnyKey or XIAnyKeycode must succeed */ /* AnyKey or XIAnyKeycode must succeed */
a.grabtype = GRABTYPE_XI2; a.grabtype = XI2;
b.grabtype = GRABTYPE_XI2; b.grabtype = XI2;
a.detail.exact = XIAnyKeycode; a.detail.exact = XIAnyKeycode;
b.detail.exact = 1; b.detail.exact = 1;
a.modifiersDetail.exact = 1; a.modifiersDetail.exact = 1;
@ -859,8 +859,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == TRUE); assert(rc == TRUE);
a.grabtype = GRABTYPE_CORE; a.grabtype = CORE;
b.grabtype = GRABTYPE_CORE; b.grabtype = CORE;
a.detail.exact = AnyKey; a.detail.exact = AnyKey;
b.detail.exact = 1; b.detail.exact = 1;
a.modifiersDetail.exact = 1; a.modifiersDetail.exact = 1;
@ -870,8 +870,8 @@ static void dix_grab_matching(void)
rc = GrabMatchesSecond(&b, &a, FALSE); rc = GrabMatchesSecond(&b, &a, FALSE);
assert(rc == TRUE); assert(rc == TRUE);
a.grabtype = GRABTYPE_XI; a.grabtype = XI;
b.grabtype = GRABTYPE_XI; b.grabtype = XI;
a.detail.exact = AnyKey; a.detail.exact = AnyKey;
b.detail.exact = 1; b.detail.exact = 1;
a.modifiersDetail.exact = 1; a.modifiersDetail.exact = 1;

View File

@ -49,7 +49,7 @@ struct test_data {
} testdata; } testdata;
int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
int button, GrabParameters *param, GrabType grabtype, int button, GrabParameters *param, enum InputLevel grabtype,
GrabMask *mask); GrabMask *mask);
static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, void *userdata); static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, void *userdata);
@ -69,7 +69,7 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access
} }
int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
int button, GrabParameters *param, GrabType grabtype, int button, GrabParameters *param, enum InputLevel grabtype,
GrabMask *mask) GrabMask *mask)
{ {
/* Fail every odd modifier */ /* Fail every odd modifier */