summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-08-11 10:59:07 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-08-22 15:56:53 +1000
commit3be379f5076566edaf92c27df5a4d447bcf5d015 (patch)
treed75a9b3b454083d67395dd8573362de88c2ae319
parent799879797505a5e891ccaec2bea73fd838c94b7a (diff)
dix: use helper functions in EventIsDeliverable
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@keithp.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--dix/events.c77
1 files changed, 39 insertions, 38 deletions
diff --git a/dix/events.c b/dix/events.c
index 0e22fdc20..27c317290 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2503,44 +2503,45 @@ 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 (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 (inputMasks &&
+ (inputMasks->deliverableEvents[dev->id] & filter) &&
+ (inputMasks->inputEvents[dev->id] & filter))
+ rc |= EVENT_XI1_MASK;
+
+ /* Check for XI DontPropagate mask */
+ if (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 ((win->deliverableEvents & filter) &&
+ ((wOtherEventMasks(win) | win->eventMask) & filter))
+ rc |= EVENT_CORE_MASK;
+
+ /* Check for core DontPropagate mask */
+ if (filter & wDontPropagateMask(win))
+ rc |= EVENT_DONT_PROPAGATE_MASK;
+ }
return rc;
}