Allow XI2 event selection for AllDevices and AllMasterDevices.

This commit is contained in:
Peter Hutterer 2009-03-06 23:22:00 +10:00
parent 808a158182
commit 97e89a5957
2 changed files with 15 additions and 6 deletions

View File

@ -67,6 +67,7 @@ ProcXISelectEvent(ClientPtr client)
int rc, num_masks, i;
WindowPtr win;
DeviceIntPtr dev;
DeviceIntRec dummy;
xXIDeviceEventMask *evmask;
int *types = NULL;
@ -109,7 +110,13 @@ ProcXISelectEvent(ClientPtr client)
num_masks = stuff->num_masks;
while(num_masks--)
{
dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess);
if (evmask->deviceid == AllDevices ||
evmask->deviceid == AllMasterDevices)
{
dummy.id = evmask->deviceid;
dev = &dummy;
} else
dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess);
XISetEventMask(dev, win, client, evmask->mask_len * 4, (unsigned char*)&evmask[1]);
evmask = (xXIDeviceEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
}

View File

@ -459,7 +459,9 @@ GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients* other)
if (XI2_EVENT(event))
{
int byte = ((xGenericEvent*)event)->evtype / 8;
return other->xi2mask[dev->id][byte];
return (other->xi2mask[dev->id][byte] |
other->xi2mask[AllDevices][byte] |
(dev->isMaster? other->xi2mask[AllMasterDevices][byte] : 0));
} else if (CORE_EVENT(event))
return other->mask[AllDevices];
else
@ -1995,10 +1997,8 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
else if (XI2_EVENT(pEvents))
{
OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
int evtype = ((xGenericEvent*)pEvents)->evtype;
/* Has any client selected for the event? */
if (!inputMasks ||
!(inputMasks->xi2mask[mskidx][evtype/8] & filter))
if (!GetWindowXI2Mask(pDev, pWin, pEvents))
return 0;
other = inputMasks->inputClients;
} else {
@ -2291,7 +2291,9 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
((xGenericEvent*)&ev)->evtype = type;
filter = GetEventFilter(dev, &ev);
if (type && (inputMasks = wOtherInputMasks(win)) &&
inputMasks->xi2mask[dev->id][type / 8] & filter)
((inputMasks->xi2mask[AllDevices][type/8] & filter) ||
((inputMasks->xi2mask[AllMasterDevices][type/8] & filter) && dev->isMaster) ||
(inputMasks->xi2mask[dev->id][type/8] & filter)))
rc |= XI2_MASK;
type = GetXIType(event);