[PATCH 4/5] barriers: Add support for edge cases when releasing barriers

Jasper St. Pierre jstpierre at mecheye.net
Tue Nov 20 11:50:44 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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 9b5f657..85a9e64 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -270,6 +270,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;
 
@@ -350,8 +353,7 @@ BarrierConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
         dx = unclamped_x - ox;
         dy = unclamped_y - oy;
 
-#define MAX_BARRIERS 2
-        for (i = 0; i < MAX_BARRIERS; i++) {
+        while (dir != 0) {
             c = barrier_find_nearest(cs, dev, dir, ox, oy, *x, *y);
             if (!c)
                 break;
-- 
1.8.0



More information about the xorg-devel mailing list