[PATCH 1/2] cairo-util: Add frame_touch_motion support

Jason Ekstrand jason at jlekstrand.net
Wed May 7 18:36:51 PDT 2014


On Tue, May 6, 2014 at 9:46 PM, Boyan Ding <stu_dby at 126.com> wrote:

> ---
>  shared/cairo-util.h |  3 +++
>  shared/frame.c      | 24 ++++++++++++++++++++++++
>  2 files changed, 27 insertions(+)
>
> diff --git a/shared/cairo-util.h b/shared/cairo-util.h
> index 4493b0d..7aebb65 100644
> --- a/shared/cairo-util.h
> +++ b/shared/cairo-util.h
> @@ -211,6 +211,9 @@ void
>  frame_touch_up(struct frame *frame, void *data, int32_t id);
>
>  void
> +frame_touch_motion(struct frame *frame, void *data, int32_t id, int x,
> int y);
> +
> +void
>  frame_repaint(struct frame *frame, cairo_t *cr);
>
>  #endif
> diff --git a/shared/frame.c b/shared/frame.c
> index 35e6b65..df51eca 100644
> --- a/shared/frame.c
> +++ b/shared/frame.c
> @@ -837,6 +837,30 @@ frame_touch_up(struct frame *frame, void *data,
> int32_t id)
>  }
>
>  void
> +frame_touch_motion(struct frame *frame, void *data, int32_t id, int x,
> int y)
> +{
> +       struct frame_touch *touch = frame_touch_get(frame, data);
> +       struct frame_button *button = frame_find_button(frame, x, y);
> +
> +       if (id > 0 || !touch)
> +               return;
> +
> +       touch->x = x;
> +       touch->y = y;
> +
> +       if (touch->button == button)
> +               return ;
> +
> +       if (touch->button)
> +               frame_button_release(touch->button);
> +
> +       touch->button = button;
> +
> +       if (touch->button)
> +               frame_button_press(touch->button);
>

Are you sure that these are the semantics we want?  Most touch interfaces,
don't let you slide onto a button.  For instance, given the way this is
written, if you put your finger down, slide onto the close button and then
slide off without picking up your finger, the close button will see a press
and a release and the window will close.  I think what we want to do here
is to mirror what is done for a mouse pointer.  Only press the button on
finger down and then, on finger up either release or cancel the button
depending on whether the finger is still on the button or not.


> +}
> +
> +void
>  frame_repaint(struct frame *frame, cairo_t *cr)
>  {
>         struct frame_button *button;
> --
> 1.9.2
>
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140507/1fc17d17/attachment-0001.html>


More information about the wayland-devel mailing list