[PATCH weston 1/5] compositor: When clipping pointer motions, don't loose precision

Kristian Høgsberg krh at bitplanet.net
Wed May 9 19:26:18 PDT 2012

On Wed, May 9, 2012 at 9:53 PM, Kristian Høgsberg <krh at bitplanet.net> wrote:
> On Wed, May 9, 2012 at 9:07 PM, Daniel Stone <daniel at fooishbar.org> wrote:
>> Hi,
>> On 10 May 2012 00:12, Kristian Høgsberg <krh at bitplanet.net> wrote:
>>> We just need min/max_x/y to be wl_fixed_t and then we need
>>> #define WL_FIXED_MAX INT32_MAX
>>> #define WL_FIXED_MIN INT32_MIN
>> Err? An int32_t can never be greater than INT32_MAX nor less than
>> INT32_MIN - it just overflows - so I'm not sure what this check would
>> actually gain us.
> The code in question determines the bounding rect for all the outputs.
>  min_x is initialized to INT_MAX, and if a  smaller value is seen,
> min_x is updated.  What I was saying (tersely) was that we should just
> make min_x a wl_fixed_t and initialize it to WL_FIXED_MAX (which is
> INT32_MAX).

And now that I read the code again, what Jonas' patch does is fine.
It computes the bounding box of all outputs in integers and then
converts to fixed point and clips the pointer position against that.
Which works.  But I also ended up rewriting the clipping logic to be
simpler and avoid dead areas: areas inside the bounding box but not in
any output.  This happens if you have differently sized outputs.  In
the end, the code is simpler and wont lose your pointer.


More information about the wayland-devel mailing list