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 108786 - Incorrect interpretation of XKB state (Control as 5th level shift)
Incorrect interpretation of XKB state (Control as 5th level shift)
Status: RESOLVED DUPLICATE of bug 100439
Product: gtk+
Classification: Platform
Component: Backend: X11
2.2.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2003-03-19 20:56 UTC by Danilo Segan
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.1/2.2



Description Danilo Segan 2003-03-19 20:56:07 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
Comment 1 Danilo Segan 2003-03-19 21:03:50 UTC
Remove the double
   include "pc/en_US"
line (the first, if you can't decide which ;) from file
symbols/pc/test, my mistake!
Comment 2 Owen Taylor 2003-03-21 14:18:46 UTC
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 ***