[PATCH weston] input: add a motion signal to weston_pointer

Giulio Camuffo giuliocamuffo at gmail.com
Fri Aug 30 13:42:55 PDT 2013


2013/8/30 Kristian Høgsberg <hoegsberg at gmail.com>

> On Sun, Aug 25, 2013 at 11:18:20AM +0200, Giulio Camuffo wrote:
> > The signal will be emitted after the pointer is moved. A shell plugin
> > can listen to the signal and activate certain effects when the pointer
> > touches the screen corners, for instance.
>
> I wonder how we would implement something like the X barrier feature
> in weston.  GNOME Shell uses hot corners too and in case you have a
> setup like this:
>
>    ┌─────────────────────────┬─────────────────┐
>    │                         │ ↖ Panel         │
>    │                         ├─────────────────┤
>    │                         │                 │
>    │                         │                 │
>    │                         │                 │
>    │                         │                 │
>    │                         ├─────────────────┘
>    │                         │
>    └─────────────────────────┘
>
> with the hot corner in the panel marked by the arrow.  When you throw
> the cursor into the hot corner you don't want it to continue onto the
> left-side output but if you move under the panel you do.  I think the
> best way may be to let a shell provide a custom default_grab in that
> case.
>
> I think the motion signal may be useful on its own still.  What do you
> think?
>

I never thought of using a overriding the default_grab for this. It's a
nice idea but more
complex than just listening to a signal. Besides, it's different, because
the
signal here is emitted whatever the current grab, so i think the two
approaches
are a bit orthogonal.

Giulio



> Kristian
>
> > ---
> >  src/compositor.h | 1 +
> >  src/input.c      | 2 ++
> >  2 files changed, 3 insertions(+)
> >
> > diff --git a/src/compositor.h b/src/compositor.h
> > index ee7853b..a2f8073 100644
> > --- a/src/compositor.h
> > +++ b/src/compositor.h
> > @@ -307,6 +307,7 @@ struct weston_pointer {
> >       struct wl_listener focus_listener;
> >       uint32_t focus_serial;
> >       struct wl_signal focus_signal;
> > +     struct wl_signal motion_signal;
> >
> >       struct weston_surface *sprite;
> >       struct wl_listener sprite_destroy_listener;
> > diff --git a/src/input.c b/src/input.c
> > index ad21be1..1aba210 100644
> > --- a/src/input.c
> > +++ b/src/input.c
> > @@ -315,6 +315,7 @@ weston_pointer_create(void)
> >       pointer->default_grab.pointer = pointer;
> >       pointer->grab = &pointer->default_grab;
> >       wl_signal_init(&pointer->focus_signal);
> > +     wl_signal_init(&pointer->motion_signal);
> >
> >       pointer->sprite_destroy_listener.notify =
> pointer_handle_sprite_destroy;
> >
> > @@ -630,6 +631,7 @@ notify_motion(struct weston_seat *seat,
> >
> >       pointer->grab->interface->focus(pointer->grab);
> >       pointer->grab->interface->motion(pointer->grab, time);
> > +     wl_signal_emit(&pointer->motion_signal, pointer);
> >  }
> >
> >  WL_EXPORT void
> > --
> > 1.8.4
> >
> > _______________________________________________
> > 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/20130830/68901b18/attachment-0001.html>


More information about the wayland-devel mailing list