[PATCH 09/29] barriers: Add support for edge cases when releasing barriers

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


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

If we release a barrier, we want to ensure that we block all
other barriers afterwards, rather than capping the limit to
the two nearest barriers.

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

diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 8f12253..ac94927 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -267,6 +267,9 @@ barrier_find_nearest(BarrierScreenPtr cs, DeviceIntPtr dev,
         struct PointerBarrier *b = &c->barrier;
         double distance;
 
+        if (c->hit)
+            continue;
+
         if (!barrier_is_blocking_direction(b, dir))
             continue;
 
@@ -321,7 +324,6 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
     int x = dest_x,
         y = dest_y;
     int dir;
-    int i;
     struct PointerBarrier *nearest = NULL;
     PointerBarrierClientPtr c;
     Time ms = GetTimeInMillis();
@@ -349,8 +351,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
      */
     dir = barrier_get_direction(current_x, current_y, x, y);
 
-#define MAX_BARRIERS 2
-    for (i = 0; i < MAX_BARRIERS; i++) {
+    while (dir != 0) {
         c = barrier_find_nearest(cs, dev, dir, current_x, current_y, x, y);
         if (!c)
             break;
-- 
1.8.0.1



More information about the xorg-devel mailing list