GNOME Bugzilla – Bug 108786
Incorrect interpretation of XKB state (Control as 5th level shift)
Last modified: 2004-12-22 21:47:04 UTC
If I press only "A" key where CTRL+A is defined as accelerator (eg. in Gedit, Galeon text fields, et cetera), Gtk+ acts as if CTRL+A is pressed (in Gedit, it selects all the text when no standard shortcut is redefined). Of course, all of that happens only when following map (I tried to make it minimal) is loaded. When XKB is set with: $XROOT/lib/X11/xkb/types/test: // This should be include-d in $XROOT/lib/X11/xkb/complete partial default xkb_types "default" { virtual_modifiers LevelThree; type "TEST_ALPHABETIC" { modifiers = Shift+LevelThree+Control; map[None] = Level1; map[Shift] = Level2; map[LevelThree] = Level3; map[Shift+LevelThree] = Level4; map[Control] = Level5; map[Shift+Control] = Level6; level_name[Level1] = "Base"; level_name[Level2] = "Shift"; level_name[Level3] = "AltGr Base"; level_name[Level4] = "Shift AltGr"; level_name[Level5] = "Five Base"; level_name[Level6] = "Shift Five"; }; }; $XROOT/lib/X11/xkb/symbols/pc/test: default partial alphanumeric_keys xkb_symbols "basic" { include "pc/en_US" name[Group1]= "Test ControlCyr"; include "pc/en_US" key <AC01> { type[Group1]="TEST_ALPHABETIC", [ Cyrillic_a, Cyrillic_A, NoSymbol, NoSymbol, a, A ] }; }; This map can be loaded with "setxkbmap test" (in XFree86 4.3; other versions might need some changes, eg. placing it in the "symbols" directory instead of the "symbols/pc", and modifying include directive). If neccessary, I might provide you with the map generated through "setxkbmap test -print | xkbcomp -xkb -", which should probably run in any XFree86 and Xkb version. This sort of map works in many other X programs (KDE apps for instance), though there are some errors of entirely different matter in Xterm. I guess there are some incompatibilities between Xkb and Gdk keyboard processing, but I didn't expect them. I just glanced through the code, and it seems to be the gdkkeys-x11.c file which performs key processing. If I get the time, I may try to provide a fix, but someone with the knowledge of Gdk internals would probably do it faster than I would. Of course, if this is NOTABUG, I apologize, and please tell me where did I do wrong. I've seen the relation with bugs 50300, and others, but they're a bit old now. Feel free to mark it as duplicate, but then also reopen it. Mailing lists were also of no help. Thanks
Remove the double include "pc/en_US" line (the first, if you can't decide which ;) from file symbols/pc/test, my mistake!
The problem here, is, I think, that GTK+ for each key divides modifiers into: consumed modifiers - modifiers that affect the resulting key symbol non-consumed modifiers And treats consumed modifiers as not affecting key binding matching. The reason for this is to fix problem we had in earlier versions of GTK+, where, for instance, a keybinding for '+' had to be specified as <Shift>+ on US keyboards, and '+' on other keyboards. Since Shift-Control gives you level 6, GTK+ decides that control is a consumed modifier on your keyboard. This is the same problem as bug 100439, where Control-Backspace isn't distinguished from Backspace on the standard XFree86-4.3.0 keymaps because Control-Alt-Backspace gives TerminateServer. *** This bug has been marked as a duplicate of 100439 ***