[PATCH 5/6] Input: Reduce use of filter in DeliverEvents

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


Instead of switching on the event filter to determine delivery, use the
event type instead.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 dix/events.c |   44 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 2b6f9c0..0dbe6e6 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2466,9 +2466,8 @@ int
 DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
               WindowPtr otherParent)
 {
-    Mask filter;
-    int     deliveries;
     DeviceIntRec dummy;
+    int     deliveries;
 
 #ifdef PANORAMIX
     if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
@@ -2479,11 +2478,42 @@ DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
 	return 0;
 
     dummy.id = XIAllDevices;
-    filter = GetEventFilter(&dummy, xE);
-    if ((filter & SubstructureNotifyMask) && (xE->u.u.type != CreateNotify))
-	xE->u.destroyNotify.event = pWin->drawable.id;
-    if (filter != StructureAndSubMask)
-	return DeliverEventsToWindow(&dummy, pWin, xE, count, filter, NullGrab);
+
+    switch (xE->u.u.type)
+    {
+        case DestroyNotify:
+        case UnmapNotify:
+        case MapNotify:
+        case MapRequest:
+        case ReparentNotify:
+        case ConfigureNotify:
+        case ConfigureRequest:
+        case GravityNotify:
+        case CirculateNotify:
+        case CirculateRequest:
+            xE->u.destroyNotify.event = pWin->drawable.id;
+            break;
+    }
+
+    switch (xE->u.u.type)
+    {
+        case DestroyNotify:
+        case UnmapNotify:
+        case MapNotify:
+        case ReparentNotify:
+        case ConfigureNotify:
+        case GravityNotify:
+        case CirculateNotify:
+            break;
+        default:
+        {
+            Mask filter;
+            filter = GetEventFilter(&dummy, xE);
+            return DeliverEventsToWindow(&dummy, pWin, xE, count, filter,
+                                         NullGrab);
+        }
+    }
+
     deliveries = DeliverEventsToWindow(&dummy, pWin, xE, count,
                                        StructureNotifyMask, NullGrab);
     if (pWin->parent)
-- 
1.7.2.3



More information about the xorg-devel mailing list