GNOME Bugzilla – Bug 675167
GtkPlug gets key translation wrong with multiple layouts
Last modified: 2012-06-08 20:38:41 UTC
In gtkplug.c: keymap = gdk_keymap_get_for_display (display); gdk_keymap_translate_keyboard_state (keymap, event->key.hardware_keycode, event->key.state, event->key.group, &event->key.keyval, NULL, NULL, &consumed); [...] /* FIXME: These should be filled in properly */ event->key.group = 0; event->key.is_modifier = FALSE; So, not only is event->key.group always 0, it's used before it is set explicitly to zero. See: https://bugzilla.redhat.com/show_bug.cgi?id=817385 and maybe https://bugzilla.gnome.org/show_bug.cgi?id=661254 for the effect this has on gnome-screensaver which uses plug/socket. If you look at _gdk_x11gdkdevicemanager-xi2.c for comparison, _gdk_x11_get_group_for_state (display, event->key.state); and _gdk_x11_keymap_key_is_modifier (keymap, event->key.hardware_keycode); need to be exposed to GTK+.
*** Bug 662992 has been marked as a duplicate of this bug. ***
Created attachment 213132 [details] [review] GtkPlug: fix handling of key events for different layouts Here's the most straightforward way to get things working. Tested to work correctly with testsocket. The other thing to do - arguably better - would be to make GDK handle KeyPress and Release events with send_event=True - this would handle not only this case but conceivably other cases where code is forwarding events. I don't know if there was some reason putting the code in gtkplug.c was chosen instead.
The following fix has been pushed: 0aa989a GtkPlug: fix handling of key events for different layouts
Created attachment 213139 [details] [review] GtkPlug: fix handling of key events for different layouts GtkPlug directly handles X KeyPress/Release events, instead of using translation in GDK (which expects XI2 events for XI2). When this was done, the handling of the group was stubbed out and never replaced. Export gdk_keymap_x11_group_for_state() and gdk_keymap_x11_is_modifier() so we can fill out the fields correctly.
*** Bug 676293 has been marked as a duplicate of this bug. ***
*** Bug 677729 has been marked as a duplicate of this bug. ***