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 145272 - Keyboard shortcuts do not reflect changes in keymap
Keyboard shortcuts do not reflect changes in keymap
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: media-keys
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
: 420186 604423 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-07-01 21:30 UTC by Vesa Halttunen
Modified: 2013-04-18 10:29 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6



Description Vesa Halttunen 2004-07-01 21:30:58 UTC
If the key mappings are changed while gnome-settings-daemon is running the
daemon still uses the old keycodes for the keyboard shortcuts.

To reproduce:
- Open the Keyboard Shortcuts control panel
- Defined a shortcut that uses the key XF86Mail (for example)
- Use xmodmap to map XF86Mail to another key and map some other symbol to the
key that used to be XF86Mail
- Press the key that is now the new XF86Mail key: nothing happens
- Press the key that used to be the XF86Mail key: the shortcut action is executed

What should happen:
- The shortcut action should only be executed when the key to which XF86Mail is
currently being mapped is pressed
Comment 1 Bastien Nocera 2006-01-11 14:04:16 UTC
"- Defined a shortcut that uses the key XF86Mail (for example)"
How do you know it uses XF86Mail? Because it actually doesn't and uses the keycode directly.
Comment 2 Vesa Halttunen 2006-01-11 17:13:09 UTC
That's exactly the bug.

> xmodmap -pke | grep Mail
keycode 236 = XF86Mail
> xmodmap -e "keycode 236 = "
> xmodmap -e "keycode 146 = XF86Mail"
> xmodmap -pke | grep Mail
keycode 146 = XF86Mail

After this pressing the old mail key still launches the action it used to and pressing the new mail key does nothing.
Comment 3 Vesa Halttunen 2006-01-11 17:16:48 UTC
I guess this is irrelevant for most people anyway though. I guess it's not common to change mappings (and not log out/login after that).
Comment 4 Bastien Nocera 2006-01-11 17:44:09 UTC
"After this pressing the old mail key still launches the action it used to and
pressing the new mail key does nothing."
Your setup just so happens to use the key that's bound to XF86Mail for the "Mail" action. 
Comment 5 Vesa Halttunen 2006-01-11 18:08:37 UTC
Yes, it uses the keycode that was bound to XF86Mail when the daemon was run. But if I map XF86Mail to another keycode while the daemon is running the old keycode is still used. This can happen, for example, when switching from a keyboard model to another and changing the mappings to reflect the other keyboard.

Maybe I'm missing your point.
Comment 6 Bastien Nocera 2006-01-11 18:21:18 UTC
My point is whether or not this key was bound to XF86Mail is irrelevant to the gnome-settings-daemon.
Comment 7 Vesa Halttunen 2006-01-11 18:36:00 UTC
Yes, I understand that internally the daemon is only interested in keycodes. It doesn't, however, notice when the mappings are changed. The Keyboard Shortcuts preferences dialog uses names such as XF86Mail so as a user I would expect that if some action is specified to XF86Mail the XF86Mail key always runs that action, no matter which keycode it happens to be when the XF86Mail key is pressed.

Anyway, this is not very serious since practically it only affects the situations in which the user changes the keymap for some reason - usually due to switching to another keyboard. The user can then log off and log on again. However, in this case the user may encounter bug 145271, which is far more serious. This bug can be left as it is (at least if there's no easy to way to inform the daemon about changes in mappings).
Comment 8 Bastien Nocera 2006-01-11 18:39:05 UTC
Ha, if the dialogue shows the name, then it should use that, not the keycode.
Comment 9 Jens Granseuer 2007-03-19 17:25:59 UTC
*** Bug 420186 has been marked as a duplicate of this bug. ***
Comment 10 Henry Zhao 2009-03-13 00:40:37 UTC
Xorg 1.5 and above now supports input device hotplug. After a new keyboard
device is hotplugged in, when X server receives first keystroke from a
new keyboard device, it automatically switches the keymap to that of new 
keyboard device.  The new keyboard may have new keysym definitions that
are different from what GNOME grabbed during startup.  GNOME must respond
to keymap changes accordingly.

Technically I don't think it is too difficult to implement. GNOME needs
to grab MappingNotify events from X, and when a MappingNotify occurs,
simply do another keysym to keycode conversion and do another round of 
grabbing.
Comment 11 Jens Granseuer 2009-12-13 10:02:26 UTC
*** Bug 604423 has been marked as a duplicate of this bug. ***
Comment 12 Bastien Nocera 2011-02-09 15:30:40 UTC
Mass move to new component "Keyboard" where the keyboard shortcuts live in GNOME 3.
Comment 13 Bastien Nocera 2013-04-18 10:29:48 UTC
That's been fixed by using gnome-shell for keyboard shortcut capture in GNOME 3.8.