[PATCH] randr: Make the RRConstrainCursorHarder logic the same as miPointerSetPosition

Keith Packard keithp at keithp.com
Wed Nov 2 21:33:40 PDT 2011


On Tue,  1 Nov 2011 21:32:36 +0000, Rui Matos <tiagomatos at gmail.com> wrote:

> -       if ((nx >= left) && (nx <= right) && (ny >= top) && (ny <= bottom)) {
> -           if ((*x <= left) || (*x >= right)) {
> -               int dx = *x - nx;
> -
> -               if (dx > 0)
> -                   *x = right;
> -               else if (dx < 0)
> -                   *x = left;
> -           }
> -
> -           if ((*y <= top) || (*y >= bottom)) {
> -               int dy = *y - ny;
> -
> -               if (dy > 0)
> -                   *y = bottom;
> -               else if (dy < 0)
> -                   *y = top;
> -           }

Ajax: Can you please try to explain this logic and why it isn't
equivalent to the obvious replacement provided in this patch?

I can't figure out why the fancy bits are any different, given the
surrounding constraints (nx and ny inside the CRTC, x and/or y outside
the CRTC).

Either I'm missing some subtlety, or ajax was off his meds when he wrote
this stuff.

> +       if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom)) {
> +           if (*x < left)
> +               *x = left;
> +           if (*x >= right)
> +               *x = right - 1;
> +           if (*y < top)
> +               *y = top;
> +           if (*y >= bottom)
> +               *y = bottom - 1;

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111102/4752f900/attachment.pgp>


More information about the xorg-devel mailing list