From 3b2fbcfa6c75ab072926ab9659adf785b324ce28 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 8 Nov 2012 01:17:40 -0500 Subject: [PATCH] barriers: Add support for edge cases when releasing barriers 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 Reviewed-by: Jasper St. Pierre --- Xi/xibarriers.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c index 8f122537a..ac94927bf 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;