[PATCH 11/29] barriers: Increment event ID on hit box leave

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


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

We eventually want to send a new notify event on hitbox leave,
which signifies the dawn of a new barrier event ID, so it's
convenient if we can put the code here.

Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.net>
---
 Xi/xibarriers.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 95a62ae..45e97cf 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -418,8 +418,16 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
 
     xorg_list_for_each_entry(c, &cs->barriers, entry) {
         c->seen = FALSE;
-        if (c->hit && !barrier_inside_hit_box(&c->barrier, x, y))
-            c->hit = FALSE;
+        if (!c->hit)
+            continue;
+
+        if (barrier_inside_hit_box(&c->barrier, x, y))
+            continue;
+
+        c->hit = FALSE;
+        /* If we've left the hit box, this is the
+         * start of a new event ID. */
+        c->barrier_event_id++;
     }
 
  out:
@@ -486,7 +494,7 @@ CreatePointerBarrierClient(ClientPtr client,
     }
 
     ret->id = stuff->barrier;
-    ret->barrier_event_id = 0;
+    ret->barrier_event_id = 1;
     ret->release_event_id = 0;
     ret->hit = FALSE;
     ret->seen = FALSE;
-- 
1.8.0.1



More information about the xorg-devel mailing list