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 <jstpierre@mecheye.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
This commit is contained in:
parent
a1ee26e624
commit
3b2fbcfa6c
|
@ -267,6 +267,9 @@ barrier_find_nearest(BarrierScreenPtr cs, DeviceIntPtr dev,
|
||||||
struct PointerBarrier *b = &c->barrier;
|
struct PointerBarrier *b = &c->barrier;
|
||||||
double distance;
|
double distance;
|
||||||
|
|
||||||
|
if (c->hit)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!barrier_is_blocking_direction(b, dir))
|
if (!barrier_is_blocking_direction(b, dir))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -321,7 +324,6 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
|
||||||
int x = dest_x,
|
int x = dest_x,
|
||||||
y = dest_y;
|
y = dest_y;
|
||||||
int dir;
|
int dir;
|
||||||
int i;
|
|
||||||
struct PointerBarrier *nearest = NULL;
|
struct PointerBarrier *nearest = NULL;
|
||||||
PointerBarrierClientPtr c;
|
PointerBarrierClientPtr c;
|
||||||
Time ms = GetTimeInMillis();
|
Time ms = GetTimeInMillis();
|
||||||
|
@ -349,8 +351,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
|
||||||
*/
|
*/
|
||||||
dir = barrier_get_direction(current_x, current_y, x, y);
|
dir = barrier_get_direction(current_x, current_y, x, y);
|
||||||
|
|
||||||
#define MAX_BARRIERS 2
|
while (dir != 0) {
|
||||||
for (i = 0; i < MAX_BARRIERS; i++) {
|
|
||||||
c = barrier_find_nearest(cs, dev, dir, current_x, current_y, x, y);
|
c = barrier_find_nearest(cs, dev, dir, current_x, current_y, x, y);
|
||||||
if (!c)
|
if (!c)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user