[PATCH 4/6] Input: Rename EventIsDeliverable return masks

Daniel Stone daniel at fooishbar.org
Tue Feb 15 03:28:00 PST 2011


Rename the return mask values for EventIsDeliverable:
    * CORE_MASK -> EVENT_CORE_MASK
    * XI_MASK -> EVENT_XI1_MASK
    * XI2_MASK -> EVENT_XI2_MASK
    * DONT_PROPAGATE_MASK -> EVENT_DONT_PROPAGATE_MASK

And don't undef them in dix/events.c, since they're supposed to be
global.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 dix/events.c    |   26 +++++++++++---------------
 include/input.h |   11 ++++++-----
 2 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 80792ee..2b6f9c0 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2287,8 +2287,8 @@ FixUpEventFromWindow(
  * @param[in] event The event that is to be sent.
  * @param[in] win The current event window.
  *
- * @return Bitmask of ::XI2_MASK, ::XI_MASK, ::CORE_MASK, and
- * ::DONT_PROPAGATE_MASK.
+ * @return Bitmask of ::EVENT_XI2_MASK, ::EVENT_XI1_MASK, ::EVENT_CORE_MASK, and
+ *         ::EVENT_DONT_PROPAGATE_MASK.
  */
 int
 EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
@@ -2309,7 +2309,7 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
         ((inputMasks->xi2mask[XIAllDevices][type/8] & filter) ||
          ((inputMasks->xi2mask[XIAllMasterDevices][type/8] & filter) && IsMaster(dev)) ||
          (inputMasks->xi2mask[dev->id][type/8] & filter)))
-        rc |= XI2_MASK;
+        rc |= EVENT_XI2_MASK;
 
     type = GetXIType(event);
     ev.u.u.type = type;
@@ -2319,22 +2319,22 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
     if (type && inputMasks &&
         (inputMasks->deliverableEvents[dev->id] & filter) &&
         (inputMasks->inputEvents[dev->id] & filter))
-        rc |= XI_MASK;
+        rc |= EVENT_XI1_MASK;
 
     /* Check for XI DontPropagate mask */
     if (type && inputMasks &&
         (inputMasks->dontPropagateMask[dev->id] & filter))
-        rc |= DONT_PROPAGATE_MASK;
+        rc |= EVENT_DONT_PROPAGATE_MASK;
 
     /* Check for core mask */
     type = GetCoreType(event);
     if (type && (win->deliverableEvents & filter) &&
         ((wOtherEventMasks(win) | win->eventMask) & filter))
-        rc |= CORE_MASK;
+        rc |= EVENT_CORE_MASK;
 
     /* Check for core DontPropagate mask */
     if (type && (filter & wDontPropagateMask(win)))
-        rc |= DONT_PROPAGATE_MASK;
+        rc |= EVENT_DONT_PROPAGATE_MASK;
 
     return rc;
 }
@@ -2377,7 +2377,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
         if ((mask = EventIsDeliverable(dev, event, pWin)))
         {
             /* XI2 events first */
-            if (mask & XI2_MASK)
+            if (mask & EVENT_XI2_MASK)
             {
                 xEvent *xi2 = NULL;
                 rc = EventToXI2(event, &xi2);
@@ -2397,7 +2397,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
             }
 
             /* XI events */
-            if (mask & XI_MASK)
+            if (mask & EVENT_XI1_MASK)
             {
                 rc = EventToXI(event, &xE, &count);
                 if (rc == Success) {
@@ -2415,7 +2415,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
             }
 
             /* Core event */
-            if ((mask & CORE_MASK) && IsMaster(dev) && dev->coreEvents)
+            if ((mask & EVENT_CORE_MASK) && IsMaster(dev) && dev->coreEvents)
             {
                 rc = EventToCore(event, &core);
                 if (rc == Success) {
@@ -2433,7 +2433,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
             }
 
             if ((deliveries < 0) || (pWin == stopAt) ||
-                (mask & DONT_PROPAGATE_MASK))
+                (mask & EVENT_DONT_PROPAGATE_MASK))
             {
                 deliveries = 0;
                 goto unwind;
@@ -2449,10 +2449,6 @@ unwind:
     return deliveries;
 }
 
-#undef XI_MASK
-#undef CORE_MASK
-#undef DONT_PROPAGATE_MASK
-
 /**
  * Deliver event to a window and it's immediate parent. Used for most window
  * events (CreateNotify, ConfigureNotify, etc.). Not useful for events that
diff --git a/include/input.h b/include/input.h
index f96a0a9..0dc725a 100644
--- a/include/input.h
+++ b/include/input.h
@@ -538,14 +538,15 @@ extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
 extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
                               WindowPtr win);
 /**
- * Return masks for EventIsDeliverable.
+ * Masks specifying the type of event to deliver for an InternalEvent; used
+ * by EventIsDeliverable.
  * @defgroup EventIsDeliverable return flags
  * @{
  */
-#define XI_MASK                 (1 << 0) /**< XI mask set on window */
-#define CORE_MASK               (1 << 1) /**< Core mask set on window */
-#define DONT_PROPAGATE_MASK     (1 << 2) /**< DontPropagate mask set on window */
-#define XI2_MASK                (1 << 3) /**< XI2 mask set on window */
+#define EVENT_XI1_MASK                (1 << 0) /**< XI1.x event */
+#define EVENT_CORE_MASK               (1 << 1) /**< Core event */
+#define EVENT_DONT_PROPAGATE_MASK     (1 << 2) /**< DontPropagate mask set */
+#define EVENT_XI2_MASK                (1 << 3) /**< XI2 mask set on window */
 /* @} */
 
 /* Implemented by the DDX. */
-- 
1.7.2.3



More information about the xorg-devel mailing list