X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_73,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Thu, 4 Jun 2009 21:26:28 +0100 Message-ID: <416096c60906041326k6cf6e17fkf15ee58909be351e@mail.gmail.com> Subject: AltGr troubles (was: Re: Suggestion for terminal package maintainers) From: Andy Koppe To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 >>> =C2=A0Right-Control+Right-Alt should each be interpreted as Control+Alt= . =C2=A0Someone >>> deliberately trying to enter Control+Alt+some-other-key is not =C2=A0li= kely to >>> use different hands for Control and Alt. >> >> Wrong, imho. =C2=A0If 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. =C2=A0We had kind of the same discussion 10 or so years ago. > > OK. =C2=A0I'm not interested in repeating an old discussion. =C2=A0But it= does seem > that the release of 1.7 is a good time to decide whether the cygwin conso= le > 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 =3D=3D 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/