dix: restructure DeliverEventsToWindow, a little bit anyway.
Desperate attempt of making the code easy to read and understand. A failed desparate attempt, possibly.
This commit is contained in:
parent
891cfc8020
commit
8a8763f150
39
dix/events.c
39
dix/events.c
|
@ -187,6 +187,10 @@ typedef const char *string;
|
||||||
#define LastEventMask OwnerGrabButtonMask
|
#define LastEventMask OwnerGrabButtonMask
|
||||||
#define AllEventMasks (LastEventMask|(LastEventMask-1))
|
#define AllEventMasks (LastEventMask|(LastEventMask-1))
|
||||||
|
|
||||||
|
|
||||||
|
#define CORE_EVENT(event) \
|
||||||
|
(!((event)->u.u.type & EXTENSION_EVENT_BASE) && \
|
||||||
|
(event)->u.u.type != GenericEvent)
|
||||||
/**
|
/**
|
||||||
* Used to indicate a implicit passive grab created by a ButtonPress event.
|
* Used to indicate a implicit passive grab created by a ButtonPress event.
|
||||||
* See DeliverEventsToWindow().
|
* See DeliverEventsToWindow().
|
||||||
|
@ -1888,17 +1892,16 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
|
||||||
this mask is the mask of the grab. */
|
this mask is the mask of the grab. */
|
||||||
int type = pEvents->u.u.type;
|
int type = pEvents->u.u.type;
|
||||||
|
|
||||||
/* CantBeFiltered means only window owner gets the event */
|
|
||||||
if ((filter == CantBeFiltered) ||
|
/* Deliver to window owner */
|
||||||
(!(type & EXTENSION_EVENT_BASE) && type != GenericEvent))
|
if ((filter == CantBeFiltered) || CORE_EVENT(pEvents))
|
||||||
{
|
{
|
||||||
/* if nobody ever wants to see this event, skip some work */
|
/* if nobody ever wants to see this event, skip some work */
|
||||||
if (filter != CantBeFiltered &&
|
if (filter != CantBeFiltered &&
|
||||||
!((wOtherEventMasks(pWin)|pWin->eventMask) & filter))
|
!((wOtherEventMasks(pWin)|pWin->eventMask) & filter))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(type & EXTENSION_EVENT_BASE) &&
|
if (IsInterferingGrab(wClient(pWin), pDev, pEvents))
|
||||||
IsInterferingGrab(wClient(pWin), pDev, pEvents))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count))
|
if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count))
|
||||||
|
@ -1916,25 +1919,25 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
|
||||||
nondeliveries--;
|
nondeliveries--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CantBeFiltered means only window owner gets the event */
|
||||||
if (filter != CantBeFiltered)
|
if (filter != CantBeFiltered)
|
||||||
{
|
{
|
||||||
if (type & EXTENSION_EVENT_BASE)
|
if (CORE_EVENT(pEvents))
|
||||||
{
|
other = (InputClients *)wOtherClients(pWin);
|
||||||
OtherInputMasks *inputMasks;
|
else {
|
||||||
|
OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
|
||||||
inputMasks = wOtherInputMasks(pWin);
|
/* Has any client selected for the event? */
|
||||||
if (!inputMasks ||
|
if (!inputMasks ||
|
||||||
!(inputMasks->inputEvents[mskidx] & filter))
|
!(inputMasks->inputEvents[mskidx] & filter))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
other = inputMasks->inputClients;
|
other = inputMasks->inputClients;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
other = (InputClients *)wOtherClients(pWin);
|
|
||||||
for (; other; other = other->next)
|
for (; other; other = other->next)
|
||||||
{
|
{
|
||||||
/* core event? check for grab interference */
|
if (IsInterferingGrab(rClient(other), pDev, pEvents))
|
||||||
if (!(type & EXTENSION_EVENT_BASE) &&
|
|
||||||
IsInterferingGrab(rClient(other), pDev, pEvents))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin,
|
if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin,
|
||||||
|
@ -5455,9 +5458,6 @@ IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
|
||||||
{
|
{
|
||||||
DeviceIntPtr it = inputInfo.devices;
|
DeviceIntPtr it = inputInfo.devices;
|
||||||
|
|
||||||
if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
switch(event->u.u.type)
|
switch(event->u.u.type)
|
||||||
{
|
{
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
|
@ -5472,6 +5472,9 @@ IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
while(it)
|
while(it)
|
||||||
{
|
{
|
||||||
if (it != dev)
|
if (it != dev)
|
||||||
|
|
Loading…
Reference in New Issue