[PATCH 2/2] dix: use helper functions in EventIsDeliverable
Peter Hutterer
peter.hutterer at who-t.net
Wed Aug 10 18:13:28 PDT 2011
Proximity events don't have an XI2 type and caused error messages in the
log when trying to get the event filter. Use this opportunity to
clean up the code, instead of manually setting the fields that
GetEventFilter requires use EventTo(XI2|XI|Core) instead.
Co-Authored-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/events.c | 78 +++++++++++++++++++++++++++++----------------------------
1 files changed, 40 insertions(+), 38 deletions(-)
diff --git a/dix/events.c b/dix/events.c
index 8fc5c41..7ae4766 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2503,44 +2503,46 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
int filter = 0;
int type;
OtherInputMasks *inputMasks = wOtherInputMasks(win);
- xEvent ev;
-
- /* XXX: this makes me gag */
- type = GetXI2Type(event);
- ev.u.u.type = GenericEvent; /* GetEventFilter only cares about type and evtype*/
- ((xGenericEvent*)&ev)->extension = IReqCode;
- ((xGenericEvent*)&ev)->evtype = type;
- filter = GetEventFilter(dev, &ev);
- if (type && inputMasks &&
- ((inputMasks->xi2mask[XIAllDevices][type/8] & filter) ||
- ((inputMasks->xi2mask[XIAllMasterDevices][type/8] & filter) && IsMaster(dev)) ||
- (inputMasks->xi2mask[dev->id][type/8] & filter)))
- rc |= EVENT_XI2_MASK;
-
- type = GetXIType(event);
- ev.u.u.type = type;
- filter = GetEventFilter(dev, &ev);
-
- /* Check for XI mask */
- if (type && inputMasks &&
- (inputMasks->deliverableEvents[dev->id] & filter) &&
- (inputMasks->inputEvents[dev->id] & filter))
- rc |= EVENT_XI1_MASK;
-
- /* Check for XI DontPropagate mask */
- if (type && inputMasks &&
- (inputMasks->dontPropagateMask[dev->id] & filter))
- rc |= EVENT_DONT_PROPAGATE_MASK;
-
- /* Check for core mask */
- type = GetCoreType(event);
- if (type && (win->deliverableEvents & filter) &&
- ((wOtherEventMasks(win) | win->eventMask) & filter))
- rc |= EVENT_CORE_MASK;
-
- /* Check for core DontPropagate mask */
- if (type && (filter & wDontPropagateMask(win)))
- rc |= EVENT_DONT_PROPAGATE_MASK;
+
+ if ((type = GetXI2Type(event)) != 0)
+ {
+ filter = GetXI2EventFilterMask(type);
+
+ if (type && inputMasks &&
+ (GetXI2MaskByte(inputMasks->xi2mask, dev, type) & filter))
+ rc |= EVENT_XI2_MASK;
+ }
+
+ if ((type = GetXIType(event)) != 0)
+ {
+ filter = GetEventFilterMask(dev, type);
+
+ /* Check for XI mask */
+ if (type && inputMasks &&
+ (inputMasks->deliverableEvents[dev->id] & filter) &&
+ (inputMasks->inputEvents[dev->id] & filter))
+ rc |= EVENT_XI1_MASK;
+
+ /* Check for XI DontPropagate mask */
+ if (type && inputMasks &&
+ (inputMasks->dontPropagateMask[dev->id] & filter))
+ rc |= EVENT_DONT_PROPAGATE_MASK;
+
+ }
+
+ if ((type = GetCoreType(event)) != 0)
+ {
+ filter = GetEventFilterMask(dev, type);
+
+ /* Check for core mask */
+ if (type && (win->deliverableEvents & filter) &&
+ ((wOtherEventMasks(win) | win->eventMask) & filter))
+ rc |= EVENT_CORE_MASK;
+
+ /* Check for core DontPropagate mask */
+ if (type && (filter & wDontPropagateMask(win)))
+ rc |= EVENT_DONT_PROPAGATE_MASK;
+ }
return rc;
}
--
1.7.6
More information about the xorg-devel
mailing list