[PATCH weston 1/1] xwayland - input size calculation correction

Daniel Stone daniel at fooishbar.org
Thu Jan 18 11:50:00 UTC 2018


Hi all,

On 23 December 2017 at 01:13, Scott Moreau <oreaus at gmail.com> wrote:
> I tested the initial patch and verified it does not fix the scenario I'm
> trying, which is with two partially overlapping xcalc windows and hovering
> the mouse over the buttons of the one below.
>
> Ian:
>
> The patch you submitted fixes the problem. A couple topical things I noticed
> are:

Thanks for the patch and testing both!

>> @@ -1086,6 +1103,21 @@ weston_wm_window_create_frame(struct
>> weston_wm_window *window)
>>
>> &wm->format_rgba,
>>                                                              width,
>> height);
>>
>> +       weston_wm_window_get_input_rect(window, &rect.x, &rect.y,
>> &rect.width, &rect.height);
>
>
> Perhaps a cast could be used when calling weston_wm_window_get_input_rect()
> something like
>
> weston_wm_window_get_input_rect(window, (int32_t *)&rect.x, (int32_t
> *)&rect.y,
>                                         (int32_t *)&rect.width, (int32_t
> *)&rect.height);

Yeah. I fixed this up whilst applying, to just use the local
x/y/width/height as intermediate variables. Passing an int16_t by
pointer to something which will try to write an int32_t isn't safe, as
it might overwrite adjacent variables; it works in this case because
the assignments are made in memory order, so as long as your numbers
aren't negative, you do happen to just avoid the damage of overwriting
...

Cheers,
Daniel


More information about the wayland-devel mailing list