[PATCH 3/3] XWayland: Use FocusIn events for keyboard enter

Keith Packard keithp at keithp.com
Mon Nov 24 18:38:18 PST 2014


Daniel Stone <daniel at fooishbar.org> writes:

> Because that's still a bunch of work,

I think it's just:

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index b8c543c..5ca27c8 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -396,8 +396,10 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
 
     wl_array_copy(&xwl_seat->keys, keys);
     valuator_mask_zero(&mask);
-    wl_array_for_each(k, &xwl_seat->keys)
-        QueueKeyboardEvents(xwl_seat->keyboard, KeyPress, *k + 8, &mask);
+    wl_array_for_each(k, &xwl_seat->keys) {
+        if (xwl_seat->keyboard->key->xkbInfo->desc->map->modmap[*k+8] != 0)
+            QueueKeyboardEvents(xwl_seat->keyboard, KeyPress, *k + 8, &mask);
+    }
 }

> and even then doesn't
> necessarily get us correct results. It also fixes apps which do trust
> that the KeymapNotify isn't a pack of lies, which isn't an
> unreasonable demand to make.

Yeah, that would be "nice to have", but as we don't see the key state
change while X doesn't have focus, I'm not sure what you're gaining
here in reality; I mean, you're not getting the ability to snoop the
keyboard by polling...

> This patch isn't the end of the road; in the end, it should be
> entirely possible to achieve perfect nesting wrt KeymapNotify events
> with XWayland, Xephyr, XQuartz, and any combination thereof. This is a
> relatively start in that direction.

Yeah, I'm fine with figuring out how to make it perfect; if the above
patch will suffice to get modifiers handled correctly for now, I'd like
to go with that for this release and pend the perfect solution until
after 1.17; just too many changes outside of hw/xwayland to make me
happy at this point in the release cycle.

In particular, I can imagine passing a new boolean in, or setting some
device state, that muted event generation and avoided having to check
for ET_KeyFocusIn in a bunch of places now and in the future. That would
also encourage us to actually deal with this case in Xephyr and Xnest.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20141124/631deea9/attachment-0001.sig>


More information about the xorg-devel mailing list