[PATCH 4/5] compositor: Implement pointer_lock

Kristian Høgsberg hoegsberg at gmail.com
Thu Feb 28 10:24:27 PST 2013


On Tue, Feb 26, 2013 at 02:58:37PM +0200, Pekka Paalanen wrote:
> On Mon, 25 Feb 2013 21:33:24 -0500
> Kristian Høgsberg <krh at bitplanet.net> wrote:
> 
> > The pointer lock extension lets a client lock pointer motion and receive
> > relative pointer motion events.  This patch implements the weston side
> > of the extension.
> > ---
> >  src/compositor.c | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> >  src/compositor.h |   7 +++
> >  2 files changed, 189 insertions(+), 2 deletions(-)
> > 
> 
> Ah, forgot some things that came up while testing.
> 
> - it seems that you forgot to apply the surface transformation to the
>   relative events in weston, perhaps this would be a use for
>   weston_matrix_transform(..., {dx, dy, 0, 0}), assuming we are always
>   dealing with linear transformations?

Fixed.  I ended up keeping the global pointer position at enter time
and the surface coordinates at enter time.  Then I transform
pointer->x + dx and pointer->y + dy and subtrace the enter time
surface coordinates to get the surface local relative coordinates.

> - having pointer lock active will prevent all compositor pointer
>   bindings

Yes... I'm not sure if we want to make super+click still move the
window during pointer lock.  You can still alt-tab away and then
super+click the window to move it.

> - having pointer lock active while the client becomes unresponsive can
>   eventually lead to weston segfaulting. First it however seems to keep
>   the pointer hostage (didn't get to try alt+tab or anything before
>   weston crashed while killing the client).

The ping/pong already breaks the pointer lock if it's in effect, but
the problem is we only ping on certain events, like pointer and
keyboard focus enter.  We don't ping on motion events, and since the
pointer lock doesn't give you enter/leave events we don't detect
unresponsive clients just by mousing around.

The crash also happens if you just SIGSTOP any client and mouse around
inside the window (ie don't trigger enter/leave events).  So we need
to solve that (find a heuristic for sending ping events event if we're
only sending motion events) and fix the crash.

Kristian

> I made the client unresponsive with 'sleep 5 && kill -STOP <pid>'.
> 
> 
> Thanks,
> pq


More information about the wayland-devel mailing list