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.
This commit is contained in:
parent
91dc8c43d2
commit
379f057646
34
Xext/geext.c
34
Xext/geext.c
|
@ -378,4 +378,38 @@ void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
|
||||||
GERecalculateWinMask(pWin);
|
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);
|
void GEInitEvent(xGenericEvent* ev, int extension);
|
||||||
|
BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
|
||||||
|
int extension, Mask mask);
|
||||||
|
|
||||||
void GEExtensionInit(void);
|
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.
|
/* if we get here, filter should be set to the GE specific mask.
|
||||||
check if any client wants it */
|
check if any client wants it */
|
||||||
if (!GEMaskIsSet(pWin, GEEXT(pEvents), filter))
|
if (!GEDeviceMaskIsSet(pWin, pDev, GEEXT(pEvents), filter))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* run through all clients, deliver event */
|
/* run through all clients, deliver event */
|
||||||
|
@ -2471,7 +2471,7 @@ DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
|
||||||
|
|
||||||
while(win)
|
while(win)
|
||||||
{
|
{
|
||||||
if (GEMaskIsSet(win, GEEXT(xE), filter))
|
if (GEDeviceMaskIsSet(win, dev, GEEXT(xE), filter))
|
||||||
{
|
{
|
||||||
if (GEExtensions[GEEXTIDX(xE)].evfill)
|
if (GEExtensions[GEEXTIDX(xE)].evfill)
|
||||||
GEExtensions[GEEXTIDX(xE)].evfill(ge, dev, win, grab);
|
GEExtensions[GEEXTIDX(xE)].evfill(ge, dev, win, grab);
|
||||||
|
|
Loading…
Reference in New Issue