[PATCH] dix: if owner-events is true for passive grabs, add the window mask (#25400)

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 16 21:32:38 PDT 2010


A client requesting a GrabModeSync button grab, owner-events true, with only
the ButtonRelease mask set would never receive the press event even if the
grab window had the ButtonPress mask set.

The protocol requires that if owner-events is true, then the delivery mask
is the combination of the grab mask + the window event mask.

X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400>

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Tested-by: Jim Ramsay <i.am at jimramsay.com>
---
Keith,

I know this isn't the patch you wanted, but the testing results are
significantly less abysimal than the nicer DeliverGrabbedEvents patch. So
far, it seems to work for all but CDE (see bugreport).

So I'd rather have a fix that works for most clients than the current
situation (and we've been carring this fix in Fedora for a while now too).

Cheers,
  Peter

 dix/events.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index c085a75..c0f35ec 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3579,6 +3579,8 @@ CheckPassiveGrabsOnWindow(
                 xE = &core;
                 count = 1;
                 mask = grab->eventMask;
+                if (grab->ownerEvents)
+                    mask |= pWin->eventMask;
             } else if (match & XI2_MATCH)
             {
                 rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3600,6 +3602,24 @@ CheckPassiveGrabsOnWindow(
                     mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
                 else if (event->type == XI_Enter || event->type == XI_FocusIn)
                     mask = grab->xi2mask[device->id][event->type/8];
+
+                if (grab->ownerEvents && wOtherInputMasks(grab->window))
+                {
+                    InputClientsPtr icp =
+                        wOtherInputMasks(grab->window)->inputClients;
+
+                    while(icp)
+                    {
+                        if (rClient(icp) == rClient(grab))
+                        {
+                            int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
+                            mask |= icp->xi2mask[device->id][evtype/8];
+                            break;
+                        }
+
+                        icp = icp->next;
+                    }
+                }
             } else
             {
                 rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3611,6 +3631,22 @@ CheckPassiveGrabsOnWindow(
                     continue;
                 }
                 mask = grab->eventMask;
+                if (grab->ownerEvents && wOtherInputMasks(grab->window))
+                {
+                    InputClientsPtr icp =
+                        wOtherInputMasks(grab->window)->inputClients;
+
+                    while(icp)
+                    {
+                        if (rClient(icp) == rClient(grab))
+                        {
+                            mask |= icp->mask[device->id];
+                            break;
+                        }
+
+                        icp = icp->next;
+                    }
+                }
             }
 
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
-- 
1.6.6.1



More information about the xorg-devel mailing list