Merge remote-tracking branch 'whot/for-keith'

This commit is contained in:
Keith Packard 2011-12-14 11:40:10 -08:00
commit 7da7aa96a0
29 changed files with 799 additions and 590 deletions

View File

@ -703,6 +703,55 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
XISendDeviceChangedEvent(device, dce); XISendDeviceChangedEvent(device, dce);
} }
/**
* Add state and motionMask to the filter for this event. The protocol
* supports some extra masks for motion when a button is down:
* ButtonXMotionMask and the DeviceButtonMotionMask to trigger only when at
* least one button (or that specific button is down). These masks need to
* be added to the filters for core/XI motion events.
*
* @param device The device to update the mask for
* @param state The current button state mask
* @param motion_mask The motion mask (DeviceButtonMotionMask or 0)
*/
static void
UpdateDeviceMotionMask(DeviceIntPtr device, unsigned short state,
Mask motion_mask)
{
Mask mask;
mask = DevicePointerMotionMask | state | motion_mask;
SetMaskForEvent(device->id, mask, DeviceMotionNotify);
mask = PointerMotionMask | state | motion_mask;
SetMaskForEvent(device->id, mask, MotionNotify);
}
static void
IncreaseButtonCount(DeviceIntPtr dev, int key, CARD8 *buttons_down,
Mask *motion_mask, unsigned short *state)
{
if (dev->valuator)
dev->valuator->motionHintWindow = NullWindow;
(*buttons_down)++;
*motion_mask = DeviceButtonMotionMask;
if (dev->button->map[key] <= 5)
*state |= (Button1Mask >> 1) << dev->button->map[key];
}
static void
DecreaseButtonCount(DeviceIntPtr dev, int key, CARD8 *buttons_down,
Mask *motion_mask, unsigned short *state)
{
if (dev->valuator)
dev->valuator->motionHintWindow = NullWindow;
if (*buttons_down >= 1 && !--(*buttons_down))
*motion_mask = 0;
if (dev->button->map[key] <= 5)
*state &= ~((Button1Mask >> 1) << dev->button->map[key]);
}
/** /**
* Update the device state according to the data in the event. * Update the device state according to the data in the event.
* *
@ -801,7 +850,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
device->valuator->motionHintWindow = NullWindow; device->valuator->motionHintWindow = NullWindow;
set_key_up(device, key, KEY_PROCESSED); set_key_up(device, key, KEY_PROCESSED);
} else if (event->type == ET_ButtonPress) { } else if (event->type == ET_ButtonPress) {
Mask mask;
if (!b) if (!b)
return DONT_PROCESS; return DONT_PROCESS;
@ -809,22 +857,13 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
return DONT_PROCESS; return DONT_PROCESS;
set_button_down(device, key, BUTTON_PROCESSED); set_button_down(device, key, BUTTON_PROCESSED);
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (!b->map[key]) if (!b->map[key])
return DONT_PROCESS; return DONT_PROCESS;
b->buttonsDown++;
b->motionMask = DeviceButtonMotionMask;
if (b->map[key] <= 5)
b->state |= (Button1Mask >> 1) << b->map[key];
/* Add state and motionMask to the filter for this event */ IncreaseButtonCount(device, key, &b->buttonsDown, &b->motionMask, &b->state);
mask = DevicePointerMotionMask | b->state | b->motionMask; UpdateDeviceMotionMask(device, b->state, b->motionMask);
SetMaskForEvent(device->id, mask, DeviceMotionNotify);
mask = PointerMotionMask | b->state | b->motionMask;
SetMaskForEvent(device->id, mask, MotionNotify);
} else if (event->type == ET_ButtonRelease) { } else if (event->type == ET_ButtonRelease) {
Mask mask;
if (!b) if (!b)
return DONT_PROCESS; return DONT_PROCESS;
@ -850,20 +889,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
} }
} }
set_button_up(device, key, BUTTON_PROCESSED); set_button_up(device, key, BUTTON_PROCESSED);
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (!b->map[key]) if (!b->map[key])
return DONT_PROCESS; return DONT_PROCESS;
if (b->buttonsDown >= 1 && !--b->buttonsDown)
b->motionMask = 0;
if (b->map[key] <= 5)
b->state &= ~((Button1Mask >> 1) << b->map[key]);
/* Add state and motionMask to the filter for this event */ DecreaseButtonCount(device, key, &b->buttonsDown, &b->motionMask, &b->state);
mask = DevicePointerMotionMask | b->state | b->motionMask; UpdateDeviceMotionMask(device, b->state, b->motionMask);
SetMaskForEvent(device->id, mask, DeviceMotionNotify);
mask = PointerMotionMask | b->state | b->motionMask;
SetMaskForEvent(device->id, mask, MotionNotify);
} else if (event->type == ET_ProximityIn) } else if (event->type == ET_ProximityIn)
device->proximity->in_proximity = TRUE; device->proximity->in_proximity = TRUE;
else if (event->type == ET_ProximityOut) else if (event->type == ET_ProximityOut)
@ -885,7 +915,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
int key = 0, rootX, rootY; int key = 0, rootX, rootY;
ButtonClassPtr b; ButtonClassPtr b;
int ret = 0; int ret = 0;
int corestate, i; int corestate;
DeviceIntPtr mouse = NULL, kbd = NULL; DeviceIntPtr mouse = NULL, kbd = NULL;
DeviceEvent *event = &ev->device_event; DeviceEvent *event = &ev->device_event;
@ -915,33 +945,8 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
mouse = NULL; mouse = NULL;
} }
/* core state needs to be assembled BEFORE the device is updated. */ corestate = event_get_corestate(mouse, kbd);
corestate = (kbd && kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0; event_set_state(mouse, kbd, event);
corestate |= (mouse && mouse->button) ? (mouse->button->state) : 0;
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
if (BitIsOn(mouse->button->down, i))
SetBit(event->buttons, i);
if (kbd && kbd->key)
{
XkbStatePtr state;
/* we need the state before the event happens */
if (event->type == ET_KeyPress || event->type == ET_KeyRelease)
state = &kbd->key->xkbInfo->prev_state;
else
state = &kbd->key->xkbInfo->state;
event->mods.base = state->base_mods;
event->mods.latched = state->latched_mods;
event->mods.locked = state->locked_mods;
event->mods.effective = state->mods;
event->group.base = state->base_group;
event->group.latched = state->latched_group;
event->group.locked = state->locked_group;
event->group.effective = state->group;
}
ret = UpdateDeviceState(device, event); ret = UpdateDeviceState(device, event);
if (ret == DONT_PROCESS) if (ret == DONT_PROCESS)
@ -996,9 +1001,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
case ET_KeyRelease: case ET_KeyRelease:
if (grab && device->deviceGrab.fromPassiveGrab && if (grab && device->deviceGrab.fromPassiveGrab &&
(key == device->deviceGrab.activatingKey) && (key == device->deviceGrab.activatingKey) &&
(device->deviceGrab.grab->type == KeyPress || GrabIsKeyboardGrab(device->deviceGrab.grab))
device->deviceGrab.grab->type == DeviceKeyPress ||
device->deviceGrab.grab->type == XI_KeyPress))
deactivateDeviceGrab = TRUE; deactivateDeviceGrab = TRUE;
break; break;
case ET_ButtonPress: case ET_ButtonPress:
@ -1018,9 +1021,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
event->detail.button = b->map[key]; event->detail.button = b->map[key];
if (grab && !b->buttonsDown && if (grab && !b->buttonsDown &&
device->deviceGrab.fromPassiveGrab && device->deviceGrab.fromPassiveGrab &&
(device->deviceGrab.grab->type == ButtonPress || GrabIsPointerGrab(device->deviceGrab.grab))
device->deviceGrab.grab->type == DeviceButtonPress ||
device->deviceGrab.grab->type == XI_ButtonPress))
deactivateDeviceGrab = TRUE; deactivateDeviceGrab = TRUE;
default: default:
break; break;
@ -1388,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;
@ -1407,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;
@ -1422,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;
@ -1462,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,
@ -1475,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;
@ -1493,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)
@ -1502,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);
@ -1557,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

@ -275,6 +275,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab; dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab; dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
dev->deviceGrab.activeGrab = AllocGrab(); dev->deviceGrab.activeGrab = AllocGrab();
dev->deviceGrab.sync.event = calloc(1, sizeof(DeviceEvent));
XkbSetExtension(dev, ProcessKeyboardEvent); XkbSetExtension(dev, ProcessKeyboardEvent);

View File

@ -647,7 +647,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
xde = (xXIDeviceEvent*)*xi; xde = (xXIDeviceEvent*)*xi;
xde->type = GenericEvent; xde->type = GenericEvent;
xde->extension = IReqCode; xde->extension = IReqCode;
xde->evtype = GetXI2Type((InternalEvent*)ev); xde->evtype = GetXI2Type(ev->type);
xde->time = ev->time; xde->time = ev->time;
xde->length = bytes_to_int32(len - sizeof(xEvent)); xde->length = bytes_to_int32(len - sizeof(xEvent));
xde->detail = ev->detail.button; xde->detail = ev->detail.button;
@ -714,7 +714,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
raw = (xXIRawEvent*)*xi; raw = (xXIRawEvent*)*xi;
raw->type = GenericEvent; raw->type = GenericEvent;
raw->extension = IReqCode; raw->extension = IReqCode;
raw->evtype = GetXI2Type((InternalEvent*)ev); raw->evtype = GetXI2Type(ev->type);
raw->time = ev->time; raw->time = ev->time;
raw->length = bytes_to_int32(len - sizeof(xEvent)); raw->length = bytes_to_int32(len - sizeof(xEvent));
raw->detail = ev->detail.button; raw->detail = ev->detail.button;
@ -746,10 +746,10 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
* equivalent exists. * equivalent exists.
*/ */
int int
GetCoreType(InternalEvent *event) GetCoreType(enum EventType type)
{ {
int coretype = 0; int coretype = 0;
switch(event->any.type) switch(type)
{ {
case ET_Motion: coretype = MotionNotify; break; case ET_Motion: coretype = MotionNotify; break;
case ET_ButtonPress: coretype = ButtonPress; break; case ET_ButtonPress: coretype = ButtonPress; break;
@ -767,10 +767,10 @@ GetCoreType(InternalEvent *event)
* equivalent exists. * equivalent exists.
*/ */
int int
GetXIType(InternalEvent *event) GetXIType(enum EventType type)
{ {
int xitype = 0; int xitype = 0;
switch(event->any.type) switch(type)
{ {
case ET_Motion: xitype = DeviceMotionNotify; break; case ET_Motion: xitype = DeviceMotionNotify; break;
case ET_ButtonPress: xitype = DeviceButtonPress; break; case ET_ButtonPress: xitype = DeviceButtonPress; break;
@ -790,11 +790,11 @@ GetXIType(InternalEvent *event)
* equivalent exists. * equivalent exists.
*/ */
int int
GetXI2Type(InternalEvent *event) GetXI2Type(enum EventType type)
{ {
int xi2type = 0; int xi2type = 0;
switch(event->any.type) switch(type)
{ {
case ET_Motion: xi2type = XI_Motion; break; case ET_Motion: xi2type = XI_Motion; break;
case ET_ButtonPress: xi2type = XI_ButtonPress; break; case ET_ButtonPress: xi2type = XI_ButtonPress; break;

File diff suppressed because it is too large Load Diff

View File

@ -61,7 +61,6 @@ SOFTWARE.
#include "registry.h" #include "registry.h"
#include "xace.h" #include "xace.h"
#define LAST_EVENT 128
#define LAST_ERROR 255 #define LAST_ERROR 255
static ExtensionEntry **extensions = (ExtensionEntry **)NULL; static ExtensionEntry **extensions = (ExtensionEntry **)NULL;
@ -82,7 +81,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
if (!MainProc || !SwappedMainProc || !MinorOpcodeProc) if (!MainProc || !SwappedMainProc || !MinorOpcodeProc)
return((ExtensionEntry *) NULL); return((ExtensionEntry *) NULL);
if ((lastEvent + NumEvents > LAST_EVENT) || if ((lastEvent + NumEvents > MAXEVENTS) ||
(unsigned)(lastError + NumErrors > LAST_ERROR)) { (unsigned)(lastError + NumErrors > LAST_ERROR)) {
LogMessage(X_ERROR, "Not enabling extension %s: maximum number of " LogMessage(X_ERROR, "Not enabling extension %s: maximum number of "
"events or errors exceeded.\n", name); "events or errors exceeded.\n", name);

View File

@ -1094,6 +1094,30 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
valuator_mask_set_double(mask, 1, y); valuator_mask_set_double(mask, 1, y);
} }
static void
storeLastValuators(DeviceIntPtr dev, ValuatorMask *mask,
int xaxis, int yaxis,
double devx, double devy)
{
int i;
/* store desktop-wide in last.valuators */
if (valuator_mask_isset(mask, xaxis))
dev->last.valuators[0] = devx;
if (valuator_mask_isset(mask, yaxis))
dev->last.valuators[1] = devy;
for (i = 0; i < valuator_mask_size(mask); i++)
{
if (i == xaxis || i == yaxis)
continue;
if (valuator_mask_isset(mask, i))
dev->last.valuators[i] = valuator_mask_get_double(mask, i);
}
}
/** /**
* Generate internal events representing this pointer event and enqueue them * Generate internal events representing this pointer event and enqueue them
* on the event queue. * on the event queue.
@ -1162,7 +1186,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
int buttons, CARD32 ms, int flags, int buttons, CARD32 ms, int flags,
const ValuatorMask *mask_in) const ValuatorMask *mask_in)
{ {
int num_events = 1, i; int num_events = 1;
DeviceEvent *event; DeviceEvent *event;
RawDeviceEvent *raw; RawDeviceEvent *raw;
double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */ double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */
@ -1237,17 +1261,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
clipValuators(pDev, &mask); clipValuators(pDev, &mask);
/* store desktop-wide in last.valuators */ storeLastValuators(pDev, &mask, 0, 1, devx, devy);
if (valuator_mask_isset(&mask, 0))
pDev->last.valuators[0] = devx;
if (valuator_mask_isset(&mask, 1))
pDev->last.valuators[1] = devy;
for (i = 2; i < valuator_mask_size(&mask); i++)
{
if (valuator_mask_isset(&mask, i))
pDev->last.valuators[i] = valuator_mask_get_double(&mask, i);
}
/* Update the MD's co-ordinates, which are always in desktop space. */ /* Update the MD's co-ordinates, which are always in desktop space. */
if (!IsMaster(pDev) || !IsFloating(pDev)) { if (!IsMaster(pDev) || !IsFloating(pDev)) {

View File

@ -60,7 +60,9 @@ SOFTWARE.
#include "dixgrabs.h" #include "dixgrabs.h"
#include "xace.h" #include "xace.h"
#include "exevents.h" #include "exevents.h"
#include "exglobals.h"
#include "inpututils.h" #include "inpututils.h"
#include "client.h"
#define BITMASK(i) (((Mask)1) << ((i) & 31)) #define BITMASK(i) (((Mask)1) << ((i) & 31))
#define MASKIDX(i) ((i) >> 5) #define MASKIDX(i) ((i) >> 5)
@ -77,25 +79,41 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
int i, j; int i, j;
GrabInfoPtr devGrab = &dev->deviceGrab; GrabInfoPtr devGrab = &dev->deviceGrab;
GrabPtr grab = devGrab->grab; GrabPtr grab = devGrab->grab;
Bool clientIdPrinted = FALSE;
ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):", ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):\n",
(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)];
if (client && GetLocalClientCreds(client, &lcc) != -1) if (client)
{ {
ErrorF(" client pid %ld uid %ld gid %ld\n", pid_t clientpid = GetClientPid(client);
(lcc->fieldsSet & LCC_PID_SET) ? (long) lcc->pid : 0, const char *cmdname = GetClientCmdName(client);
(lcc->fieldsSet & LCC_UID_SET) ? (long) lcc->euid : 0, const char *cmdargs = GetClientCmdArgs(client);
(lcc->fieldsSet & LCC_GID_SET) ? (long) lcc->egid : 0);
FreeLocalClientCreds(lcc); if ((clientpid > 0) && (cmdname != NULL))
{
ErrorF(" client pid %ld %s %s\n",
(long) clientpid, cmdname, cmdargs ? cmdargs : "");
clientIdPrinted = TRUE;
}
else if (GetLocalClientCreds(client, &lcc) != -1)
{
ErrorF(" client pid %ld uid %ld gid %ld\n",
(lcc->fieldsSet & LCC_PID_SET) ? (long) lcc->pid : 0,
(lcc->fieldsSet & LCC_UID_SET) ? (long) lcc->euid : 0,
(lcc->fieldsSet & LCC_GID_SET) ? (long) lcc->egid : 0);
FreeLocalClientCreds(lcc);
clientIdPrinted = TRUE;
}
} }
else if (!clientIdPrinted)
{ {
ErrorF(" (no client information available)\n"); ErrorF(" (no client information available for client %d)\n",
CLIENT_ID(grab->resource));
} }
/* XXX is this even correct? */ /* XXX is this even correct? */
@ -110,18 +128,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++)
{ {
@ -205,7 +223,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,
@ -237,7 +255,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++;
@ -409,7 +427,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,
@ -440,14 +458,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)
@ -499,7 +517,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;
@ -549,7 +567,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))
{ {
@ -627,9 +645,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;
@ -639,7 +657,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))
{ {
@ -737,3 +755,19 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
#undef UPDATE #undef UPDATE
} }
Bool
GrabIsPointerGrab(GrabPtr grab)
{
return (grab->type == ButtonPress ||
grab->type == DeviceButtonPress ||
grab->type == XI_ButtonPress);
}
Bool
GrabIsKeyboardGrab(GrabPtr grab)
{
return (grab->type == KeyPress ||
grab->type == DeviceKeyPress ||
grab->type == XI_KeyPress);
}

View File

@ -626,7 +626,7 @@ void verify_internal_event(const InternalEvent *ev)
if (ev && ev->any.header != ET_Internal) if (ev && ev->any.header != ET_Internal)
{ {
int i; int i;
unsigned char *data = (unsigned char*)ev; const unsigned char *data = (const unsigned char*)ev;
ErrorF("dix: invalid event type %d\n", ev->any.header); ErrorF("dix: invalid event type %d\n", ev->any.header);
@ -657,6 +657,64 @@ void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms)
event->sourceid = dev->id; event->sourceid = dev->id;
} }
int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd)
{
int corestate;
/* core state needs to be assembled BEFORE the device is updated. */
corestate = (kbd && kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0;
corestate |= (mouse && mouse->button) ? (mouse->button->state) : 0;
return corestate;
}
void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event)
{
int i;
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
if (BitIsOn(mouse->button->down, i))
SetBit(event->buttons, i);
if (kbd && kbd->key)
{
XkbStatePtr state;
/* we need the state before the event happens */
if (event->type == ET_KeyPress || event->type == ET_KeyRelease)
state = &kbd->key->xkbInfo->prev_state;
else
state = &kbd->key->xkbInfo->state;
event->mods.base = state->base_mods;
event->mods.latched = state->latched_mods;
event->mods.locked = state->locked_mods;
event->mods.effective = state->mods;
event->group.base = state->base_group;
event->group.latched = state->latched_group;
event->group.locked = state->locked_group;
event->group.effective = state->group;
}
}
/**
* Return the event filter mask for the given device and the given core or
* XI1 protocol type.
*/
Mask
event_get_filter_from_type(DeviceIntPtr dev, int evtype)
{
return event_filters[dev ? dev->id : 0][evtype];
}
/**
* Return the event filter mask for the given device and the given core or
* XI2 protocol type.
*/
Mask
event_get_filter_from_xi2type(int evtype)
{
return (1 << (evtype % 8));
}
Bool Bool
point_on_screen(ScreenPtr pScreen, int x, int y) point_on_screen(ScreenPtr pScreen, int x, int y)
{ {

View File

@ -592,7 +592,7 @@ int (* SwappedProcVector[256]) (
ProcBadRequest ProcBadRequest
}; };
EventSwapPtr EventSwapVector[128] = EventSwapPtr EventSwapVector[MAXEVENTS] =
{ {
(EventSwapPtr)SErrorEvent, (EventSwapPtr)SErrorEvent,
NotImplemented, NotImplemented,

View File

@ -1037,7 +1037,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd)
if (pScreenPriv->client) if (pScreenPriv->client)
{ {
dgaEvent de; dgaEvent de;
de.u.u.type = *XDGAEventBase + GetCoreType((InternalEvent*)&ev); de.u.u.type = *XDGAEventBase + GetCoreType(ev.type);
de.u.u.detail = event->detail; de.u.u.detail = event->detail;
de.u.event.time = event->time; de.u.event.time = event->time;
de.u.event.dx = event->dx; de.u.event.dx = event->dx;
@ -1091,7 +1091,7 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
dgaEvent de; dgaEvent de;
int coreEquiv; int coreEquiv;
coreEquiv = GetCoreType((InternalEvent*)&ev); coreEquiv = GetCoreType(ev.type);
de.u.u.type = *XDGAEventBase + coreEquiv; de.u.u.type = *XDGAEventBase + coreEquiv;
de.u.u.detail = event->detail; de.u.u.detail = event->detail;

View File

@ -400,6 +400,11 @@ extern int DeliverDeviceEvents(
WindowPtr /* stopAt */, WindowPtr /* stopAt */,
DeviceIntPtr /* dev */); DeviceIntPtr /* dev */);
extern int DeliverOneGrabbedEvent(
InternalEvent* /* event*/,
DeviceIntPtr /* dev */,
enum InputLevel /* level */);
extern void InitializeSprite( extern void InitializeSprite(
DeviceIntPtr /* pDev */, DeviceIntPtr /* pDev */,
WindowPtr /* pWin */); WindowPtr /* pWin */);

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 */,
@ -64,4 +64,6 @@ extern _X_EXPORT int AddPassiveGrabToList(
extern _X_EXPORT Bool DeletePassiveGrabFromList( extern _X_EXPORT Bool DeletePassiveGrabFromList(
GrabPtr /* pMinuendGrab */); GrabPtr /* pMinuendGrab */);
extern Bool GrabIsPointerGrab(GrabPtr grab);
extern Bool GrabIsKeyboardGrab(GrabPtr grab);
#endif /* DIXGRABS_H */ #endif /* DIXGRABS_H */

View File

@ -27,14 +27,15 @@
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "input.h" #include "input.h"
#include "events.h" #include "events.h"
#include "eventstr.h"
#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16)) #define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16))
_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);
_X_INTERNAL int GetCoreType(InternalEvent* ev); _X_INTERNAL int GetCoreType(enum EventType type);
_X_INTERNAL int GetXIType(InternalEvent* ev); _X_INTERNAL int GetXIType(enum EventType type);
_X_INTERNAL int GetXI2Type(InternalEvent* ev); _X_INTERNAL int GetXI2Type(enum EventType type);
#endif /* _EVENTCONVERT_H_ */ #endif /* _EVENTCONVERT_H_ */

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

@ -57,6 +57,7 @@ SOFTWARE.
#include "xkbrules.h" #include "xkbrules.h"
#include "events.h" #include "events.h"
#include "list.h" #include "list.h"
#include <X11/extensions/XI2.h>
#define DEVICE_INIT 0 #define DEVICE_INIT 0
#define DEVICE_ON 1 #define DEVICE_ON 1
@ -101,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;
@ -537,14 +544,16 @@ extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients); extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev); extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type);
void FixUpEventFromWindow(SpritePtr pSprite, void FixUpEventFromWindow(SpritePtr pSprite,
xEvent *xE, xEvent *xE,
WindowPtr pWin, WindowPtr pWin,
Window child, Window child,
Bool calcChild); Bool calcChild);
extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y); extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win);
WindowPtr win); extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
InternalEvent *ev);
/** /**
* Masks specifying the type of event to deliver for an InternalEvent; used * Masks specifying the type of event to deliver for an InternalEvent; used
* by EventIsDeliverable. * by EventIsDeliverable.
@ -557,6 +566,13 @@ extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
#define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */ #define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */
/* @} */ /* @} */
enum EventDeliveryState {
EVENT_DELIVERED, /**< Event has been delivered to a client */
EVENT_NOT_DELIVERED, /**< Event was not delivered to any client */
EVENT_SKIP, /**< Event can be discarded by the caller */
EVENT_REJECTED, /**< Event was rejected for delivery to the client */
};
/* Implemented by the DDX. */ /* Implemented by the DDX. */
extern _X_EXPORT int NewInputDeviceRequest( extern _X_EXPORT int NewInputDeviceRequest(
InputOption *options, InputOption *options,

View File

@ -57,7 +57,7 @@ SOFTWARE.
#include "geext.h" #include "geext.h"
#include "privates.h" #include "privates.h"
#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) #define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
extern _X_EXPORT int CountBits(const uint8_t *mask, int len); extern _X_EXPORT int CountBits(const uint8_t *mask, int len);
@ -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

@ -32,6 +32,8 @@
#include "input.h" #include "input.h"
#include <X11/extensions/XI2proto.h> #include <X11/extensions/XI2proto.h>
extern Mask event_filters[MAXDEVICES][MAXEVENTS];
struct _ValuatorMask { struct _ValuatorMask {
int8_t last_bit; /* highest bit set in mask */ int8_t last_bit; /* highest bit set in mask */
uint8_t mask[(MAX_VALUATORS + 7)/8]; uint8_t mask[(MAX_VALUATORS + 7)/8];
@ -40,6 +42,10 @@ struct _ValuatorMask {
extern void verify_internal_event(const InternalEvent *ev); extern void verify_internal_event(const InternalEvent *ev);
extern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms); extern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms);
extern int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd);
extern void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event);
extern Mask event_get_filter_from_type(DeviceIntPtr dev, int evtype);
extern Mask event_get_filter_from_xi2type(int evtype);
FP3232 double_to_fp3232(double in); FP3232 double_to_fp3232(double in);
FP1616 double_to_fp1616(double in); FP1616 double_to_fp1616(double in);

View File

@ -89,6 +89,8 @@ OF THIS SOFTWARE.
#define MAXFORMATS 8 #define MAXFORMATS 8
#define MAXDEVICES 40 /* input devices */ #define MAXDEVICES 40 /* input devices */
/* 128 event opcodes for core + extension events, excluding GE */
#define MAXEVENTS 128
#define EXTENSION_EVENT_BASE 64 #define EXTENSION_EVENT_BASE 64
#define EXTENSION_BASE 128 #define EXTENSION_BASE 128

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

@ -59,7 +59,7 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
assert(out->type == GenericEvent); assert(out->type == GenericEvent);
assert(out->extension == 0); /* IReqCode defaults to 0 */ assert(out->extension == 0); /* IReqCode defaults to 0 */
assert(out->evtype == GetXI2Type((InternalEvent*)in)); assert(out->evtype == GetXI2Type(in->type));
assert(out->time == in->time); assert(out->time == in->time);
assert(out->detail == in->detail.button); assert(out->detail == in->detail.button);
assert(out->deviceid == in->deviceid); assert(out->deviceid == in->deviceid);
@ -305,7 +305,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
} }
assert(out->extension == 0); /* IReqCode defaults to 0 */ assert(out->extension == 0); /* IReqCode defaults to 0 */
assert(out->evtype == GetXI2Type((InternalEvent*)in)); assert(out->evtype == GetXI2Type(in->type));
assert(out->time == in->time); assert(out->time == in->time);
assert(out->detail == in->detail.button); assert(out->detail == in->detail.button);
assert(out->length >= 12); assert(out->length >= 12);
@ -662,7 +662,7 @@ static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
assert(out->type == GenericEvent); assert(out->type == GenericEvent);
assert(out->extension == 0); /* IReqCode defaults to 0 */ assert(out->extension == 0); /* IReqCode defaults to 0 */
assert(out->evtype == GetXI2Type((InternalEvent*)in)); assert(out->evtype == GetXI2Type(in->type));
assert(out->time == in->time); assert(out->time == in->time);
assert(out->deviceid == in->deviceid); assert(out->deviceid == in->deviceid);
assert(out->sourceid == in->sourceid); assert(out->sourceid == in->sourceid);

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 */