Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

All adding the U.S. English International (with dead keys) keyboard layout breaks my Alt_R key. Any ideas why?

I'm working on RHEL 5.5 using GNOME. The problem disappears if I remove the additional layout and reappears if I add it back.

Specific problems include Alt-F2 not working to start the run application app if using Alt_R and CTRL-Alt-L not working for screen looking again if using Alt_R.

I tried using xev to troubleshoot. Here's what I get with just the U.S. English layout:

KeyPress event, serial 29, synthetic NO, window 0x1e00001,
    root 0x3a2, subw 0x0, time 1766794207, (169,-13), root:(2099,35),
    state 0x0, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 29, synthetic NO, window 0x1e00001,
    root 0x3a2, subw 0x0, time 1766794447, (169,-13), root:(2099,35),
    state 0x8, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False  

Here's what I get with the U.S. English International (with dead keys) layout:

KeyPress event, serial 26, synthetic NO, window 0x1e00001,
    root 0x3a2, subw 0x0, time 1766853750, (169,-13), root:(2099,35),
    state 0x0, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 29, synthetic NO, window 0x1e00001,
    root 0x3a2, subw 0x0, time 1766853872, (169,-13), root:(2099,35),
    state 0x80, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

It makes no difference whether that layout is actually being used at the moment. Just having it in the selected list breaks things. If this is a bug, does anyone know where it should be filed (GNOME, Xorg, Redhat)?

EDIT: I realized now that I can see my modifier mapping using xmodmap. Initially, mod5 was mapped to mod5 Mode_switch (0x5d) and ISO_Level3_Shift (0x7c). Adding the international layout, maps Alt_R (0x71) to mod5 as well, which why I'm having this problem. Based on Caleb's recommendation, I switched Alt_R to be an ISO_Level3_Shift such that mod5 is now mapped to "mod5 Mode_switch (0x5d), ISO_Level3_Shift (0x71), ISO_Level3_Shift (0x7c)". This still breaks Alt_R as an Alt_L alternative though.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Most keyboard layouts outside the U.S. attribute the right Alt key to a different purpose, called AltGr (Alt Graph), which sort of makes the U.S. the exception to the rule. The AltGr key is sort of another kind of Shift key, intended to select extra characters available on the other keys. See the Wikipedia article on AltGr.

So, if you want to issue a key combination with the Alt modifier, like Alt-F2 or Ctrl-Alt-L, be sure to press the left Alt key, since the right one has another purpose. It is just in the U.S. English layout that has no other use for that key that reassigns it (or better, keeps the original old assignment) as an additional Alt key. Even the British English layout uses AltGr to issue characters like “€” and “£”.

share|improve this answer
    
just like I told Caleb, the problem is when I'm not actually using the layout. I don't see why simply enabling the layout should cause a problem if it's not being used at the moment, but maybe I'm misunderstanding how linux keymaps work? –  deuberger Apr 18 '11 at 18:10
    
@deuberger: Yes, it is likely that simply adding the layout as available will revert the right Alt key to its original meaning. The right-Alt-same-as-left-Alt is an exception that only makes sense if only U.S. English is used (and that is for backwards compatibility). If you add other layouts, it implies that you will use them. The modifier mapping and keyboard layout are achieved in different layers inside the xkb code. –  Juliano Apr 18 '11 at 20:11
    
Okay, that makes more sense, but I don't understand why the mapping should be updated based on my current layout? Is this a GNOME or xorg bug or am I still not getting it? I understand the technical behavior now, I just don't understand the why behind it. –  deuberger Apr 18 '11 at 21:28
    
It is not a bug, neither in GNOME, nor in Xorg. This is intended behavior. Right Alt is AltGr, not the same as the left Alt. It just so happens that U.S. English has no use for AltGr, so if it is the only keyboard layout loaded, it is mapped to the same modifier as left Alt, for compatibility with really old systems. –  Juliano Apr 18 '11 at 22:54

On most international layouts, Alt_R becomes an AltGr (alternate group?) key, otherwise known as a 3rd level chooser that gives you access to alternate letters, symbols, accents etc. Even though the keycode you are seeing is not properly remapped to this, I suspect the layout is EXPECTING it to be is hiccuping on the keycode.

I suggest you look through the other tabs of gnome keyboard options and manually setup an AltGr key, maybe as that one, so the international layout will work to full effect.

share|improve this answer
    
thanks for the response, but I'm having this problem even if I'm not currently using the international layout. When the layout is being used, everything works as expected. It's when it's not being used, that my regular layout is broken (just the Alt_R key). –  deuberger Apr 18 '11 at 18:09
1  
I see what you mean now, though that doesn't answer the question I was intending to ask, which now I know has to do with the modifier mapping. This does help me to get the full benefit of the international keyboard though, so +1. Also FYI for others, the way I got a proper AltGr key was by choosing third level chooser under layout options in the GNOME keyboard preferences. I chose right alt. –  deuberger Apr 18 '11 at 21:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.