[PATCH weston v2 02/21] input: Make pointer grab motion callbacks take an event struct

Daniel Stone daniel at fooishbar.org
Tue Oct 27 10:40:33 PDT 2015


Hi Jonas,

On 13 May 2015 at 11:26, Jonas Ã…dahl <jadahl at gmail.com> wrote:
> @@ -3182,18 +3182,20 @@ popup_grab_focus(struct weston_pointer_grab *grab)
>
>  static void
>  popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
> -                 wl_fixed_t x, wl_fixed_t y)
> +                 struct weston_pointer_motion_event *event)
>  {
>         struct weston_pointer *pointer = grab->pointer;
>         struct wl_resource *resource;
> +       wl_fixed_t x, y;
>         wl_fixed_t sx, sy;
>
>         if (pointer->focus) {
> +               weston_pointer_motion_to_abs(pointer, event, &x, &y);
>                 weston_view_from_global_fixed(pointer->focus, x, y,
>                                               &pointer->sx, &pointer->sy);
>         }
>
> -       weston_pointer_move(pointer, x, y);
> +       weston_pointer_move(pointer, event);
>
>         wl_resource_for_each(resource, &pointer->focus_resource_list) {
>                 weston_view_from_global_fixed(pointer->focus,
> diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
> index bad2418..5cd5ac9 100644
> --- a/ivi-shell/hmi-controller.c
> +++ b/ivi-shell/hmi-controller.c
> @@ -1360,16 +1360,19 @@ layer_set_pos(struct ivi_layout_layer *layer, wl_fixed_t pos_x,
>
>  static void
>  pointer_move_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
> -                        wl_fixed_t x, wl_fixed_t y)
> +                        struct weston_pointer_motion_event *event)
>  {
>         struct pointer_move_grab *pnt_move_grab =
>                 (struct pointer_move_grab *)grab;
> -       wl_fixed_t pointer_pos[2] = {x, y};
> +       wl_fixed_t pointer_pos[2] = {
> +               wl_fixed_from_double(event->x),
> +               wl_fixed_from_double(event->y),
> +       };

Should this also be weston_pointer_motion_to_abs()?

> diff --git a/src/compositor-x11.c b/src/compositor-x11.c
> index 5129e85..57a7d11 100644
> --- a/src/compositor-x11.c
> +++ b/src/compositor-x11.c
> @@ -1105,8 +1106,14 @@ x11_compositor_deliver_motion_event(struct x11_compositor *c,
>                                            wl_fixed_from_int(motion_notify->event_y),
>                                            &x, &y);
>
> +       event = (struct weston_pointer_motion_event) {
> +               .mask = WESTON_POINTER_MOTION_REL,
> +               .dx = wl_fixed_to_double(x - c->prev_x),
> +               .dy = wl_fixed_to_double(y - c->prev_y)
> +       };
> +

To be honest, I'm somewhat skeptical of faking relative motion from
abs in general.

Cheers,
Daniel


More information about the wayland-devel mailing list