[PATCH 1/3] dix: add implicit passive grabs to the resource system

Peter Hutterer peter.hutterer at who-t.net
Thu Nov 1 22:17:11 PDT 2012


Implicit passive grabs are now properly allocated grabs
(b601ea769f1b8a4d7f19e9d4a13541c78e865fe5), but they are not added to the
resource system. This makes client lookup later hard for touch pointer
emulation.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/events.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/dix/events.c b/dix/events.c
index d57ce6a..f47820b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1541,6 +1541,9 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
         if (ti->active && TouchResourceIsOwner(ti, grab_resource))
             TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch);
     }
+
+    if (wasImplicit)
+        FreeResource(grab->resource, RT_NONE);
 }
 
 /**
@@ -1584,6 +1587,9 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
     grabinfo->implicitGrab = passive & ImplicitGrabMask;
     CheckGrabForSyncs(keybd, (Bool) grab->keyboardMode,
                       (Bool) grab->pointerMode);
+
+    if (passive & ImplicitGrabMask)
+        FreeResource(grab->resource, RT_NONE);
 }
 
 /**
@@ -1984,9 +1990,13 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win,
     if (inputMasks)
         xi2mask_merge(tempGrab->xi2mask, inputMasks->xi2mask);
 
+    if (!AddResource(tempGrab->resource, RT_PASSIVEGRAB, tempGrab)) {
+        BUG_WARN_MSG(1, "Failed to activate implicit grab. Behavior will be weird\n");
+        return FALSE;
+    }
+
     (*dev->deviceGrab.ActivateGrab) (dev, tempGrab,
                                      currentTime, TRUE | ImplicitGrabMask);
-    FreeGrab(tempGrab);
     return TRUE;
 }
 
-- 
1.7.11.7



More information about the xorg-devel mailing list