After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753948 - Nested X11: use KeymapNotify events to fix key state on FocusIn
Nested X11: use KeymapNotify events to fix key state on FocusIn
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2015-08-21 20:33 UTC by Owen Taylor
Modified: 2015-09-08 15:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Nested X11: use KeymapNotify events to fix key state on FocusIn (8.01 KB, patch)
2015-08-21 20:33 UTC, Owen Taylor
committed Details | Review
build: Fix non-wayland build (1.68 KB, patch)
2015-09-07 17:58 UTC, Ting-Wei Lan
committed Details | Review

Description Owen Taylor 2015-08-21 20:33:40 UTC
If the user Alt-Tabs out of the window, we will be left thinking
the Alt key is still pressed since we don't see a release for it.

Solve this and other related issues for the nested X11 compositor
by selecting for KeymapStateMask which causes a KeymapNotify event
to be sent after each FocusIn, and when we get these events, update
the internal XKB state and send any necessary modifiers events to
clients.
Comment 1 Owen Taylor 2015-08-21 20:33:43 UTC
Created attachment 309840 [details] [review]
Nested X11: use KeymapNotify events to fix key state on FocusIn
Comment 2 Jasper St. Pierre (not reading bugmail) 2015-08-22 02:27:07 UTC
Review of attachment 309840 [details] [review]:

Looks good.

::: src/backends/x11/meta-backend-x11.c
@@ +280,3 @@
+          /* Since we've selected for KeymapStateMask, every FocusIn is followed immediately
+           * by a KeymapNotify event */
+          XMaskEvent(priv->xdisplay, KeymapStateMask, &xev);

Jeez, that's an obscure Xlib call I've never heard of.
Comment 3 Owen Taylor 2015-09-03 20:03:35 UTC
Attachment 309840 [details] pushed as 614d6bd - Nested X11: use KeymapNotify events to fix key state on FocusIn
Comment 4 Ting-Wei Lan 2015-09-04 07:50:01 UTC
Attachment 309840 [details] breaks non-wayland build:

./.libs/libmutter.so: undefined reference to `meta_wayland_compositor_update_key_state'
./.libs/libmutter.so: undefined reference to `meta_wayland_compositor_get_default'
Comment 5 Ting-Wei Lan 2015-09-07 17:58:11 UTC
Created attachment 310855 [details] [review]
build: Fix non-wayland build

This fixes build error caused by commit 614d6bd. We can simply remove
the usage of meta-wayland.c functions in non-wayland build because
META_BACKEND_X11_MODE_NESTED is only used in wayland.
Comment 6 Owen Taylor 2015-09-08 14:51:49 UTC
Review of attachment 310855 [details] [review]:

Looks good, thanks!
Comment 7 Ting-Wei Lan 2015-09-08 15:26:02 UTC
Attachment 310855 [details] pushed as 5066eaf - build: Fix non-wayland build