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; int rc, num_masks, i;
WindowPtr win; WindowPtr win;
DeviceIntPtr dev; DeviceIntPtr dev;
DeviceIntRec dummy;
xXIDeviceEventMask *evmask; xXIDeviceEventMask *evmask;
int *types = NULL; int *types = NULL;
@ -109,6 +110,12 @@ ProcXISelectEvent(ClientPtr client)
num_masks = stuff->num_masks; num_masks = stuff->num_masks;
while(num_masks--) while(num_masks--)
{ {
if (evmask->deviceid == AllDevices ||
evmask->deviceid == AllMasterDevices)
{
dummy.id = evmask->deviceid;
dev = &dummy;
} else
dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess); dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess);
XISetEventMask(dev, win, client, evmask->mask_len * 4, (unsigned char*)&evmask[1]); XISetEventMask(dev, win, client, evmask->mask_len * 4, (unsigned char*)&evmask[1]);
evmask = (xXIDeviceEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4); 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)) if (XI2_EVENT(event))
{ {
int byte = ((xGenericEvent*)event)->evtype / 8; 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)) } else if (CORE_EVENT(event))
return other->mask[AllDevices]; return other->mask[AllDevices];
else else
@ -1995,10 +1997,8 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
else if (XI2_EVENT(pEvents)) else if (XI2_EVENT(pEvents))
{ {
OtherInputMasks *inputMasks = wOtherInputMasks(pWin); OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
int evtype = ((xGenericEvent*)pEvents)->evtype;
/* Has any client selected for the event? */ /* Has any client selected for the event? */
if (!inputMasks || if (!GetWindowXI2Mask(pDev, pWin, pEvents))
!(inputMasks->xi2mask[mskidx][evtype/8] & filter))
return 0; return 0;
other = inputMasks->inputClients; other = inputMasks->inputClients;
} else { } else {
@ -2291,7 +2291,9 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
((xGenericEvent*)&ev)->evtype = type; ((xGenericEvent*)&ev)->evtype = type;
filter = GetEventFilter(dev, &ev); filter = GetEventFilter(dev, &ev);
if (type && (inputMasks = wOtherInputMasks(win)) && 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; rc |= XI2_MASK;
type = GetXIType(event); type = GetXIType(event);