AltGr troubles (was: Re: Suggestion for terminal package maintainers)
Andy Koppe
andy.koppe@gmail.com
Thu Jun 4 20:26:00 GMT 2009
Back to the cygwin list, since this is getting off-topic for cygwin-apps.
2009/6/3 Ken Brown:
> On 6/3/2009 10:32 AM, Corinna Vinschen wrote:
>>>> On non-English keyboards, the right Alt key is called AltGr and returns
>>>> the modifiers Left-Control/Right-Alt.
>>>
>>> So maybe the answer is that Left-Control+Left-Alt and
>>> Right-Control+Right-Alt should each be interpreted as Control+Alt. Someone
>>> deliberately trying to enter Control+Alt+some-other-key is not likely to
>>> use different hands for Control and Alt.
>>
>> Wrong, imho. If the non-modifier key is on the right side of the
>> keyboard, many users tend to press left-ctrl/right-alt/non-mod-key.
>> Trust me. We had kind of the same discussion 10 or so years ago.
>
> OK. I'm not interested in repeating an old discussion. But it does seem
> that the release of 1.7 is a good time to decide whether the cygwin console
> is emulating linux or xterm or something else and then make this happen as
> much as possible.
>
> FWIW, I just tried Andy's echokeys program in xterm and in mintty
> [with Ctrl+Alt+A combinations].
> In xterm the output is \x81 with all four combinations of left/right.
That's with the "Meta sends Escape" option off, where Meta sets the
highest bit of the character instead of prefixing it with escape. That
only works with plain old 7-bit ASCII though.
> In mintty, the output is ^[^A with three of the four combinations,
> and nothing in the fourth. The one that generates nothing
> is left-ctrl/right-alt (corresponding to AltGr).
Consider it a bug. I tried to do something too clever with AltGr in
mintty-0.3, but it didn't really make sense, so I gave up on it for
0.4. (Partly because afaik, the Win32 interface doesn't even give you
a way to find out whether a keyboard layout actually has an AltGr
key.)
So MinTTY is now back to standard AltGr == Ctrl + Alt behaviour. It
first tries the Windows keyboard layout, and if that comes back
empty-handed, it sends the Ctrl+Alt-modified keycode such as ^[^A. If
the keyboard layout does have an AltGr keycode, you can use
Ctrl+Shift+A instead to get the ^[^A code anyway. That's non-standard
though, and not exactly obvious.
One approach that would make some sense is to not consult the keyboard
layout for Ctrl+LeftAlt combinations (since the AltGr key is always on
the right). Trouble is, some people do use that to get AltGr codes for
keys on the right-hand side of the keyboard.
Michael Kaplan, Microsoft internationalisation expert and author of
the MS Keyboard Layout Creator utility, has had a long-running feud
with the MS Office team about this whole sorry topic, e.g.:
http://blogs.msdn.com/michkap/archive/2006/04/17/577196.aspx
Xwin, however, does manage to treat AltGr as a completely independent
modifier key, so I had a look how it does that. Turns out it's got a
rather interesting hack that ignores LeftCtrl key messages if they're
followed by a RightAlt message with the same timestamp. That doesn't
seem to be entirely reliable though, according to this post earlier
today:
http://www.cygwin.com/ml/cygwin-xfree/2009-06/msg00001.html
Advice on what to do about this whole problem welcome.
Andy
ps: The latest MinTTY 0.4 "release candidate" can be found at
http://mintty.googlecode.com.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list