[PATCH 22/29] Xi: deliver barrier events as grabbed events where necessary

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 11 23:19:15 PST 2012


If the grab_window is the barrier window and the client owns the grab,
deliver as normal grabbed event (respecting owner_events). Otherwise,
deliver as usual.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/exevents.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index e606d9e..a7ec0c4 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1647,6 +1647,7 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
     BarrierEvent *be = &e->barrier_event;
     xEvent *ev;
     int rc;
+    GrabPtr grab = dev->deviceGrab.grab;
 
     if (!IsMaster(dev))
         return;
@@ -1660,10 +1661,21 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
         return;
     }
 
-    filter = GetEventFilter(dev, ev);
+    /* A client has a grab, deliver to this client if the grab_window is the
+       barrier window.
+
+       Otherwise, deliver normally to the client.
+     */
+    if (grab &&
+        CLIENT_ID(be->barrierid) == CLIENT_ID(grab->resource) &&
+        grab->window->drawable.id == be->window) {
+        DeliverGrabbedEvent(e, dev, FALSE);
+    } else {
+        filter = GetEventFilter(dev, ev);
 
-    DeliverEventsToWindow(dev, pWin, ev, 1,
-                          filter, NullGrab);
+        DeliverEventsToWindow(dev, pWin, ev, 1,
+                              filter, NullGrab);
+    }
     free(ev);
 }
 
-- 
1.8.0.1



More information about the xorg-devel mailing list