[PATCH 2/2] dix: Let GenericEvents with the "send event" flag set go through.

carlosg at gnome.org carlosg at gnome.org
Fri Nov 26 15:00:11 PST 2010


From: Carlos Garnacho <carlosg at gnome.org>

ProcGESendEvent() puts GenericEvents with the 0x80 mask into the queue,
these changes are necessary so such events aren't mishandled.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 dix/events.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 62f8e5f..a8a02f5 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -181,7 +181,7 @@ typedef const char *string;
     (!((event)->u.u.type & EXTENSION_EVENT_BASE) && \
       (event)->u.u.type != GenericEvent)
 #define XI2_EVENT(event) \
-    (((event)->u.u.type == GenericEvent) && \
+    ((((event)->u.u.type & 0x7f) == GenericEvent) &&    \
     ((xGenericEvent*)(event))->extension == IReqCode)
 
 /**
@@ -418,7 +418,7 @@ static Mask filters[MAXDEVICES][128] = {
 Mask
 GetEventFilter(DeviceIntPtr dev, xEvent *event)
 {
-    if (event->u.u.type != GenericEvent)
+    if ((event->u.u.type & 0x7f) != GenericEvent)
         return filters[dev ? dev->id : 0][event->u.u.type];
     else if (XI2_EVENT(event))
         return (1 << (((xXIDeviceEvent*)event)->evtype % 8));
@@ -5666,14 +5666,14 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
      * makes things easier for me right now. (whot) */
     for (i = 1; i < count; i++)
     {
-        if (events[i].u.u.type == GenericEvent)
+        if ((events[i].u.u.type & 0x7f) == GenericEvent)
         {
             ErrorF("[dix] TryClientEvents: Only one GenericEvent at a time.\n");
             return;
         }
     }
 
-    if (events->u.u.type == GenericEvent)
+    if ((events->u.u.type & 0x7f) == GenericEvent)
     {
         eventlength += ((xGenericEvent*)events)->length * 4;
     }
-- 
1.7.3.2



More information about the xorg-devel mailing list