[PATCH wayland] Add a relative_grab request to the wl_shell_surface interface

Kristian Høgsberg hoegsberg at gmail.com
Wed Aug 29 12:29:44 PDT 2012

On Mon, Aug 27, 2012 at 01:45:17PM -0700, Daniel Stone wrote:
> Hi,
> On 27 August 2012 11:55, Philipp Brüschweiler <blei42 at gmail.com> wrote:
> > This request can be used to grab the pointer of a specified seat. A
> > pointer grabbed in this way will be made invisible and won't send any
> > more motion events. Instead it reports relative motion using the motion
> > event on the returned object.
> >
> > A grab can be broken by the application by destroying the wl_relative_grab
> > object, or by the compositor, in which case the compositor sends a
> > destroy_me event to the application.
> >
> > Recommended behaviour for compositors is to break grabs when the keyboard
> > focus changes to a different window, e.g. by alt-tabbing out of the
> > grabbing application.

Very cool, thanks for looking into this.

> This mostly looks good to me, but I think it'd be better structured
> along the lines of wl_pointer.  So, perhaps call it wl_pointer_raw,
> have it send enter and leave events, and perhaps duplicate the button
> and motion events too.  You could basically copy the wl_pointer
> interface, really ...
> The other other alternative, now I think of it, is to add a
> wl_pointer_raw capability to wl_seat, with a wl_seat_get_pointer_raw,
> which just returns another wl_pointer interface, except that it
> returns relative co-ordinates instead.  Either way, following the
> enter and leave pattern (with surfaces) would be great.

Yup, good points here.  I think we could reuse the wl_pointer
interface, but just send relative motion in the motion event and it
should go throught the wl_seat capability feature as Daniel describes.

I think we can just say that if you have a raw pointer (ie, you've
called wl_seat_get_pointer_raw), then that takes precedence over the
normal pointer interface (that is, the normal pointer stops sending
events).  And the normal pointer needs to send a leave event and the
relative pointer should send an enter event.  If we alt-tab away, the
relative pointer sends a leave event.  Mousing over a surface that is
in relative mode should not "capture" the pointer, only activating the
surface (either alt-tabbing back, or click-to-focus).  When we mouse
over the surface, we could either just not send events if the client
has a raw_pointer, or we could send wl_pointer.enter, motion, and then
wl_pointer.leave + raw_pointer.enter when the surface is activated and
we switch to relative motion.

I think we may want to keep a pointer surface in raw pointer mode, but
let the client hide it, if it wants to.


More information about the wayland-devel mailing list