[PATCH weston] input: don't send to clients key events eaten by bindings

Pekka Paalanen ppaalanen at gmail.com
Wed Nov 5 06:50:58 PST 2014


On Wed, 5 Nov 2014 16:23:29 +0200
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> On Tue,  7 Oct 2014 22:30:25 +0300
> Giulio Camuffo <giuliocamuffo at gmail.com> wrote:
> 
> > weston key bindings are supposed to eat the key events, and not pass it
> > on to clients, and indeed the wl_keyboard.key event is not sent. But
> > we must also not put the key in the keys array to pass to client with
> > the wl_keyboard.enter event, or else we may send the 'eaten' one too.
> > In the case of a key binding hiding a surface having the keyboard focus,
> > the shell may decide to give the focus to another surface, but that will
> > happen before the key is released, so the new focus surface will receive
> > the code of the bound key in the wl_keyboard.enter array.
> > ---
> >  src/bindings.c   |  7 +++++--
> >  src/compositor.h |  2 +-
> >  src/input.c      | 35 +++++++++++++++++++----------------
> >  3 files changed, 25 insertions(+), 19 deletions(-)
> 
> Ok, reproducing this problem with visible effects requires Xwayland.
> Here's how I did it:
> 
> - open xterm (via Xwayland)
> - open weston-terminal
> - press Mod
> - press 'k' (Mod+k is a weston hotkey for killing an app)
> - weston-terminal gets killed, focus moves to xterm
> - before xterm gets killed too, release Mod
> - 'k' starts repeating in xterm until you release 'k'
> 
> The premise here is that since 'k' was the final key that triggered a
> keybinding, the press and release of 'k' must not be sent to any client.
> 
> This obviously fails in the above experiment, not via a key-press event
> but via the list of pressed keys in keyboard enter event. (You cannot
> see it with WAYLAND_DEBUG, because it cannot decode wl_array type.)
> 
> So, problem confirmed.

...

> Hmm, btw, why does the repeating of 'k' stop when I release the key in
> my experiment? I suppose the grab ends when I release the Mod key, so
> the release event gets sent. And that's actually correct in that case,
> because on keyboard enter the 'k' was listed depressed. So my test case
> is actually wrong! ...is it? This is starting to hurt my head now.

Sorry, the test case is correct, I just did it wrong. Here's how it
really works:

- open xterm (via Xwayland)
- open weston-terminal
- press Mod
- press 'k' (Mod+k is a weston hotkey for killing an app)
- weston-terminal gets killed, focus moves to xterm
- 'k' starts repeating in xterm

The 'k' repeating continues even if you release Mod and 'k', until
keyboard leaves the xterm or you press another key.


Thanks,
pq


More information about the wayland-devel mailing list