[PATCH 12/29] barriers: Send a BarrierLeave event when we leave the hitbox

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


From: "Jasper St. Pierre" <jstpierre at mecheye.net>

Additionally, add flags when the pointer is released.

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

diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 45e97cf..75ea4f7 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -417,6 +417,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
     }
 
     xorg_list_for_each_entry(c, &cs->barriers, entry) {
+        int flags = 0;
         c->seen = FALSE;
         if (!c->hit)
             continue;
@@ -425,6 +426,22 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
             continue;
 
         c->hit = FALSE;
+
+        ev.type = ET_BarrierLeave;
+
+        if (c->barrier_event_id == c->release_event_id)
+            flags |= XIBarrierPointerReleased;
+
+        ev.flags = flags;
+        ev.event_id = c->barrier_event_id;
+        ev.barrierid = c->id;
+
+        ev.dt = ms - c->last_timestamp;
+        ev.window = c->window->drawable.id;
+        c->last_timestamp = ms;
+
+        mieqEnqueue(dev, (InternalEvent *) &ev);
+
         /* If we've left the hit box, this is the
          * start of a new event ID. */
         c->barrier_event_id++;
-- 
1.8.0.1



More information about the xorg-devel mailing list