[PATCH 3/3] Xi: if a MD is removed, send a barrier leave event (if applicable)

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 12 21:22:07 PST 2012


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/xibarriers.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 1714634..7b7b83f 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -714,12 +714,41 @@ static void remove_master_func(pointer res, XID id, pointer devid)
     struct PointerBarrierDevice *pbd;
     struct PointerBarrierClient *barrier;
     struct PointerBarrier *b;
+    DeviceIntPtr dev;
     int *deviceid = devid;
+    int rc;
+    Time ms = GetTimeInMillis();
+
+    rc = dixLookupDevice(&dev, *deviceid, serverClient, DixSendAccess);
+    if (rc != Success)
+        return;
 
     b = res;
     barrier = container_of(b, struct PointerBarrierClient, barrier);
 
     pbd = GetBarrierDevice(barrier, *deviceid);
+
+    if (pbd->hit) {
+        BarrierEvent ev = {
+            .header = ET_Internal,
+            .type =ET_BarrierLeave,
+            .length = sizeof (BarrierEvent),
+            .time = ms,
+            .deviceid = *deviceid,
+            .sourceid = 0,
+            .dx = 0,
+            .dy = 0,
+            .root = barrier->screen->root->drawable.id,
+            .window = barrier->window,
+            .dt = ms - pbd->last_timestamp,
+            .flags = XIBarrierPointerReleased,
+            .event_id = pbd->barrier_event_id,
+            .barrierid = barrier->id,
+        };
+
+        mieqEnqueue(dev, (InternalEvent *) &ev);
+    }
+
     xorg_list_del(&pbd->entry);
     free(pbd);
 }
@@ -731,7 +760,6 @@ void XIBarrierNewMasterDevice(ClientPtr client, int deviceid)
 
 void XIBarrierRemoveMasterDevice(ClientPtr client, int deviceid)
 {
-    /* FIXME: send LeaveNotify */
     FindClientResourcesByType(client, PointerBarrierType, remove_master_func, &deviceid);
 }
 
-- 
1.8.0.2



More information about the xorg-devel mailing list