[PATCH] randr: Fix logic in RRPointerToNearestCrtc

Keith Packard keithp at keithp.com
Mon Jul 28 13:07:28 PDT 2014


David Ung <davidu at nvidia.com> writes:

>>> RRPointerToNearestCrtc is suppose to snap to the nearest Crtc,
>>> but the code is buggy.  Correct the calculation of delta x/y
>>> values and choose the closest Crtc.
>>
>> This comment isn't terribly descriptive of the problems it's
>> solving. There are two -- one where the dx/dy values end up off-by-one
>> and another where it's simply forgetting to actually set the 'best' value.
>
> but its more that dx/dy off-by-one.
>
> previously best_dx/dy is always positive, if x > scan_width, 
> when you call SetCursorPosition, the cursor's x position is gonna be
> even further away from the crtc's right edge.

Right.

> RRPointerToNearestCrtc is suppose to snap to the nearest Crtc,
> but best_x and best_y is always positive, hence when calling 
> SetCursorPosition it will make the cursor even further away.
> Correct delta x/y to allow negative values and also use
>  "width/height -1" in the calculation.  Also choose the closest Crtc
> by setting the "best" value.

Thanks. That describes the patch better.

Reviewed-by: Keith Packard <keithp at keithp.com>

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


More information about the xorg-devel mailing list