Commit 379f0576 authored by Peter Hutterer's avatar Peter Hutterer

Xext: add GEDeviceMaskIsSet (GE mask checking per device)

If a mask was set for the NULL device, then we pretend the mask is set for all
devices.
parent 91dc8c43
......@@ -378,4 +378,38 @@ void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
GERecalculateWinMask(pWin);
}
/**
* Return TRUE if the mask for the given device is set.
* @param pWin Window the event may be delivered to.
* @param pDev Device the device originating the event. May be NULL.
* @param extension Extension ID
* @param mask Event mask
*/
BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
int extension, Mask mask)
{
GenericMaskPtr gemask;
if (!pWin->optional || !pWin->optional->geMasks)
return FALSE;
extension &= 0x7F;
if (!pWin->optional->geMasks->eventMasks[extension] & mask)
return FALSE;
gemask = pWin->optional->geMasks->geClients;
while(gemask)
{
if ((!gemask->dev || gemask->dev == pDev) &&
(gemask->eventMask[extension] & mask))
return TRUE;
gemask = gemask->next;
}
return FALSE;
}
......@@ -106,7 +106,8 @@ void GERegisterExtension(
);
void GEInitEvent(xGenericEvent* ev, int extension);
BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
int extension, Mask mask);
void GEExtensionInit(void);
......
......@@ -2151,7 +2151,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
/* if we get here, filter should be set to the GE specific mask.
check if any client wants it */
if (!GEMaskIsSet(pWin, GEEXT(pEvents), filter))
if (!GEDeviceMaskIsSet(pWin, pDev, GEEXT(pEvents), filter))
return 0;
/* run through all clients, deliver event */
......@@ -2471,7 +2471,7 @@ DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
while(win)
{
if (GEMaskIsSet(win, GEEXT(xE), filter))
if (GEDeviceMaskIsSet(win, dev, GEEXT(xE), filter))
{
if (GEExtensions[GEEXTIDX(xE)].evfill)
GEExtensions[GEEXTIDX(xE)].evfill(ge, dev, win, grab);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment