[PATCH 0/15] Modifier fixups (especially for nested)

Kristian Høgsberg hoegsberg at gmail.com
Fri Jun 22 12:02:03 PDT 2012


On Fri, Jun 22, 2012 at 01:21:25PM +0100, Daniel Stone wrote:
> Hi,
> The following series makes nested compositors in particular track their
> parent server's state more aggressively.  The main highlight is probably
> that the stuck modifiers bug under X11 should be completely gone, as
> well as enabling key bindings under GNOME Shell and other compositors
> that grab modifiers.
> 
> The X11 integration works best if you have a fixed XCB, i.e. xcbproto
> and libxcb from git from today, with XKB explicitly enabled.  However,
> I've done what I could for the non-XKB case and it seems to work just
> fine.

Thanks, all applied.  I fixed a typo in wayland where you send out the
modifier event through the pointer resource.  Also I added a commit to
send out the modifier event to the pointer focus if it's different
from keyboard focus.  I believe that with this we now send out the
modifier event in all the right places.

Under X the stuck modifer problem is gone (yay!), but without XKB
support, my Alt now doesn't work.  Ctrl, Shift, Super etc does, which
is a little odd... this fixes it:

diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 9c46b27..d1e1bfb 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -673,9 +673,9 @@ update_xkb_state_from_core(struct x11_compositor *c, uint16_
        struct wl_keyboard *keyboard = &c->base.seat->keyboard;
 
        xkb_state_update_mask(c->base.seat->xkb_state.state,
-                             keyboard->modifiers.mods_depressed & mask,
-                             keyboard->modifiers.mods_latched & mask,
-                             keyboard->modifiers.mods_locked & mask,
+                             mask,
+                             0,
+                             0,
                              0,
                              0,
                              (x11_mask >> 13) & 3);

so I guess the problem is that when we drive the xkb state from the
core X events we somehow miss Alt.  The mask is correct, but the
keypresses that we feed to xkb_state doesn't make it think Alt is
down.  I run resizor with WAYLAND_DEBUG=1, press down Alt and then
mouse into the window, but don't see the Alt bit in the modifier
event.  Or just try Alt-backspace in weston-terminal.

Maybe we should just always get the modifiers from X, whether core X
or XKB and never use update_modifier_state() for compositor-x11.c (or
compositor-wayland, I guess).  I was thinking that the update_state
arg could be a weston_seat flag instead?  Or just split out the call
to update_modifier_state() and make backends call it if they need to
(ie, only evdev).

Kristian


More information about the wayland-devel mailing list