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 603190 - Allow setting GDK_META/SUPER/HYPER_MASK simultaneously?
Allow setting GDK_META/SUPER/HYPER_MASK simultaneously?
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-11-27 22:59 UTC by szunti
Modified: 2010-06-05 14:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a patch (5.48 KB, patch)
2009-11-29 05:33 UTC, Matthias Clasen
none Details | Review

Description szunti 2009-11-27 22:59:18 UTC
I'd like to use meta key in gnome-terminal. Libvte currently use Mod1 as Meta, which is only correct if Alt is the Meta key (the default in Gnome I think, but it's not an option here, because Alt with some common keys also triggers the menu in gnome-terminal). I reported a bug to libvte developers (https://bugzilla.gnome.org/show_bug.cgi?id=601926) and it turned out that libvte should use GDK_META_MASK to determine which modifier is really the Meta. 
The problem is that if I make with Gnome's keyboard settings the Win key to Meta, than it maps Meta Super and Hyper to Mod4 (xmodmap output):

  xmodmap:  up to 5 keys per modifier, (keycodes in parentheses):

  shift       Shift_L (0x32),  Shift_R (0x3e)
  lock        Caps_Lock (0x42)
  control     Control_L (0x25),  Control_R (0x69)
  mod1        Alt_L (0x40)
  mod2        Num_Lock (0x4d)
  mod3      
  mod4        Meta_L (0x85),  Meta_R (0x86),  Meta_L (0xcd),  Super_L (0xce), Hyper_L (0xcf)
  mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

And after testing GDK_META/SUPER/HYPER_MASK I found that only one of them is set. In my case it's SUPER, so pressing a combination with Win key is recognized as Super not as Meta. Adding just Meta keys to mod3 solves the problem, but gnome's keyboard settings is useless for GDK in my case. 
Different modifier keys on the same modifier bit happens in my case anyway, because I have only mod3 and mod4 free for the Meta Super and Hyper.

I had the idea that setting more than one of GDK_META/SUPER/HYPER_MASK-s could be a solution. As I understand ICCCM doesn't prohibit that, and this way if the program needs Super but not Meta and Hyper it works and it also works if the program needs Meta but not the others.
Comment 1 Matthias Clasen 2009-11-29 05:33:36 UTC
Created attachment 148676 [details] [review]
a patch

Here is a patch that makes GTK+ try harder to make sense of key combinations involving virtual modifiers. I need to meditate a bit more over this before committing it.
Comment 2 Tobias Mueller 2010-06-04 11:53:57 UTC
Hm. Has patch 148676 finally been committed?
Comment 3 Matthias Clasen 2010-06-04 14:13:50 UTC
See gdk_keymap_add_virtual_modifiers / gdk_keymap_map_virtual_modifiers
Comment 4 szunti 2010-06-05 14:44:07 UTC
On Karmic i think this patch solved my problem. (maybe i left my xmodmap setting modified) Now i use Lucid, and although the changelog of the gtk package contains this patch, my pygtk program used for testing still reports meta key only as super modifier.

xmodmap: 

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40)
mod2        Num_Lock (0x4d)
mod3      
mod4        Meta_L (0x85),  Meta_R (0x86),  Meta_L (0xcd),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)