delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/02/23/21:43:52

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Fri, 23 Feb 2001 18:42:22 -0800 (Pacific Standard Time)
From: Jason Tiller <jtiller AT sjm DOT com>
To: <cygwin AT cygwin DOT com>
Subject: Query about right <ALT> (AltGr) code
Message-ID: <Pine.WNT.4.32.0102231725370.-361801@tiller2.ventritex.com>
X-X-Sender: jdtiller AT shell3 DOT ba DOT best DOT com
MIME-Version: 1.0

Hello, All, :)

[I've been trying to figure out why the right <alt> key (AltGr)
doesn't generate META in bash.  My previous missive noted that the
Cygwin changelog for one of the later B* releases specifically
indicated that AltGr was changed to not be trapped by Cygwin so that
it could be used for special character entry by non-US keyboards.]

In looking through the Cygwin source (for 1.1.8-1), it looks like the
the relevant code is here:

>>>>>>>>>>

cygwin-1.1.8-1/winsup/cygwin/fhandler_console.cc:

...

int
fhandler_console::read (void *pv, size_t buflen)
{
...
      switch (input_rec.EventType)
        {
        case KEY_EVENT:
          if (!input_rec.Event.KeyEvent.bKeyDown)
            continue;

#define ich (input_rec.Event.KeyEvent.uChar.AsciiChar)
#define wch (input_rec.Event.KeyEvent.uChar.UnicodeChar)

          if (wch == 0 ||
              /* arrow/function keys */
              (input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
            {
              toadd = get_nonascii_key (input_rec, tmp);
              if (!toadd)
                continue;
              nread = strlen (toadd);
            }
          else
            {
              tmp[1] = ich;
              /* Need this check since US code page seems to have a bug when
                 converting a CTRL-U. */
              if ((unsigned char)ich > 0x7f && current_codepage == ansi_cp)
                OemToCharBuff (tmp + 1, tmp + 1, 1);
              if (!(input_rec.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED))
                toadd = tmp + 1;
              else
                {
                  tmp[0] = '\033';
                  tmp[1] = cyg_tolower (tmp[1]);
                  toadd = tmp;
                  nread++;
                }
            }

<<<<<<<<<<

I don't pretend to understand most of this, but it looks to me that
when the left <alt> key is held down during a keystroke entry, the
console handler stuffs a \033 in the keyboard buffer, which is
equivalent to <ESC> (ASCII 27) and is interpreted by bash as META.
Fine.  That makes sense.

I'm attempting to rebuild the cygwin1.dll in preparation for modifying
the above code to support RIGHT_ALT_PRESSED, but I've run into a
problem.  After a 'configure' and then a 'make', make dies with:

make[2]: Entering directory `/cygwin-1.1.8-1/i586-pc-cygwin/winsup/cygwin'
make[2]: *** No rule to make target `all'.  Stop.
make[2]: Leaving directory `/cygwin-1.1.8-1/i586-pc-cygwin/winsup/cygwin'
make[1]: *** [cygwin] Error 2
make[1]: Leaving directory `/cygwin-1.1.8-1/i586-pc-cygwin/winsup'
make: *** [all-target-winsup] Error 2

(It died after probably 20 minutes of churning on a PII-400 on
Win95b).

I searched the FAQ but didn't find any entries relating to building
Cygwin itself, and searching the archives is worse than hopeless
because the searcher won't let you specify strings surrounded in
double-quotes so you get back massive numbers of hits.  Anyone want to
guess on how many hits you get when cygwin1.dll is part of the search
string? ;>

Can anyone quickly guide me towards resolving this make issue?

Also, while I don't have the skill to do it, it would be awfully handy
to provide a Cygwin run-time option via the CYGWIN environment
variable that allowed the user to choose how AltGr should operate.
The default could be as it is today (AltGr unaffected), and a
"altgrmeta" would force left and right <alt> to be the same.  Just an
idea...

As always, thanks for your help. :)

---Jason Tiller
jdtiller AT best DOT com
http://www.sonos.org/


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019