[PATCH weston v3] input: use doubles in the interfaces to notify of input events
Giulio Camuffo
giuliocamuffo at gmail.com
Tue Mar 22 11:10:07 UTC 2016
2016-03-22 11:47 GMT+02:00 Daniel Stone <daniel at fooishbar.org>:
> Hey Giulio,
>
> On 21 March 2016 at 11:29, Giulio Camuffo <giuliocamuffo at gmail.com> wrote:
>> @@ -1275,11 +1275,15 @@ input_set_cursor(struct wayland_input *input)
>> static void
>> input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
>> uint32_t serial, struct wl_surface *surface,
>> - wl_fixed_t x, wl_fixed_t y)
>> + wl_fixed_t fixed_x, wl_fixed_t fixed_y)
>> {
>> struct wayland_input *input = data;
>> int32_t fx, fy;
>> enum theme_location location;
>> + double x, y;
>> +
>> + x = wl_fixed_to_double(fixed_x);
>> + y = wl_fixed_to_double(fixed_y);
>>
>> /* XXX: If we get a modifier event immediately before the focus,
>> * we should try to keep the same serial. */
>> @@ -1288,11 +1292,10 @@ input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
>>
>> if (input->output->frame) {
>> location = frame_pointer_enter(input->output->frame, input,
>> - wl_fixed_to_int(x),
>> - wl_fixed_to_int(y));
>> + x, y);
>> frame_interior(input->output->frame, &fx, &fy, NULL, NULL);
>> - x -= wl_fixed_from_int(fx);
>> - y -= wl_fixed_from_int(fy);
>> + x -= fx;
>> + y -= fy;
>>
>> if (frame_status(input->output->frame) & FRAME_STATUS_REPAINT)
>> weston_output_schedule_repaint(&input->output->base);
>> @@ -1300,6 +1303,8 @@ input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
>> location = THEME_LOCATION_CLIENT_AREA;
>> }
>>
>> + x = wl_fixed_to_double(fixed_x);
>> + y = wl_fixed_to_double(fixed_y);
>> weston_output_transform_coordinate(&input->output->base, x, y, &x, &y);
>
> I think the second pair of wl_fixed_to_double calls here is broken; at
> the very least, it's a change in behaviour from previously.
Ah, you're right. It's redundant at least.
Cheers,
Giulio
>
> The rest, as far as I can tell (had to dig a little bit to convince
> myself that the grab interface didn't require any changes), looks
> good:
> Reviewed-by: Daniel Stone <daniels at collabora.com>
>
> Thanks for taking this on!
>
> Cheers,
> Daniel
More information about the wayland-devel
mailing list