summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-03-06 23:22:00 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-03-20 15:17:55 +1000
commit97e89a59572a4be6757510a317c142ec1d82e8f8 (patch)
tree7f7288542cba555dd39a93f6911833275286aaf0
parent808a158182b0a3b985385899252c190947b4dbbd (diff)
Allow XI2 event selection for AllDevices and AllMasterDevices.
-rw-r--r--Xi/xiselectev.c9
-rw-r--r--dix/events.c12
2 files changed, 15 insertions, 6 deletions
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 87811dc2d..cdb9c6ff0 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -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);
}
diff --git a/dix/events.c b/dix/events.c
index 177fa0514..52729cad6 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -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);