[PATCH 1/5] cursor: Revise edge cases for the pointer moving towards barriers

Peter Hutterer peter.hutterer at who-t.net
Thu Nov 22 18:10:36 PST 2012


On Tue, Nov 20, 2012 at 02:50:41PM -0500, Jasper St. Pierre wrote:
> From: "Jasper St. Pierre" <jstpierre at mecheye.net>
> 
> Since barriers block the invisible line between pixels, that means
> that we need to explicitly check the boundaries, or else we'll have
> a potential off-by-one error. This fixes issues when trying to move
> down or right across a barrier and having the pointer visibly bounce.
> 
> Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.net>

I've merged this into my branch, it's a fix for the current system. thanks

Cheers,
   Peter

> ---
>  xfixes/cursor.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/xfixes/cursor.c b/xfixes/cursor.c
> index bd175b4..ffee4d6 100644
> --- a/xfixes/cursor.c
> +++ b/xfixes/cursor.c
> @@ -1093,7 +1093,11 @@ barrier_is_blocking(const struct PointerBarrier * barrier,
>          if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
>              return FALSE;
>          /* startpoint adjacent to barrier, moving towards -> block */
> -        if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
> +        if (dir & BarrierPositiveX && x1 == (barrier->x1 - 1) && y1 >= barrier->y1 && y1 <= barrier->y2) {
> +            *distance = 0;
> +            return TRUE;
> +        }
> +        if (dir & BarrierNegativeX && x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
>              *distance = 0;
>              return TRUE;
>          }
> @@ -1105,7 +1109,11 @@ barrier_is_blocking(const struct PointerBarrier * barrier,
>          if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
>              return FALSE;
>          /* startpoint adjacent to barrier, moving towards -> block */
> -        if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
> +        if (dir & BarrierPositiveY && y1 == (barrier->y1 - 1) && x1 >= barrier->x1 && x1 <= barrier->x2) {
> +            *distance = 0;
> +            return TRUE;
> +        }
> +        if (dir & BarrierNegativeY && y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
>              *distance = 0;
>              return TRUE;
>          }
> -- 
> 1.8.0
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list