Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Fri, 22 Jun 2001 20:10:33 +0200 From: Marius Gedminas To: cygwin AT cygwin DOT com Subject: Re: cygwin 1.3.2 bug on non-us keyboard layouts Message-ID: <20010622201033.A2500@gintaras> Mail-Followup-To: cygwin AT cygwin DOT com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <20010622003740.C3530@cobold.toronto.redhat.com> User-Agent: Mutt/1.3.18i X-URL: http://ice.dammit.lt/~mgedmin/ --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jun 22, 2001 at 12:37:40AM +0200, Corinna Vinschen wrote: > Oops, a change of 45 lines is not a small patch anymore, unfortunately. 45 is the number wc -l gives; the actual number of code lines touched is much smaller. > You would have to fill out the copyright assignment form. Is that ok > for you? Yes, but I *hate* snail mail. Could you look at this patch and tellme if that is really necessary? > However, you can send the patch then to the cygwin list if you don't > want to subscribe to cygwin-patches, of course. Here it is. I have tested it on Win98 and on Win2000 with US English (101), US English (International), Lithuanian (Programers) and German (Standard) keyboard layouts. Marius Gedminas -- A bus station is where a bus stops, a train station is where a train stops. On my desk I have a work station... --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cygwin-altgr.changelog" Thu Jun 21 22:01:39 2001 Marius Gedminas * fhandler_console.cc (fhandler_console::read): Detect AltGr more robustly on WinNT. --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cygwin-altgr.patch" --- fhandler_console.cc.orig Sun Jun 17 14:15:36 2001 +++ fhandler_console.cc Thu Jun 21 21:54:51 2001 @@ -289,6 +289,8 @@ fhandler_console::read (void *pv, size_t #define ich (input_rec.Event.KeyEvent.uChar.AsciiChar) #define wch (input_rec.Event.KeyEvent.uChar.UnicodeChar) +#define ALT_PRESSED (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED) +#define CTRL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) if (wch == 0 || /* arrow/function keys */ @@ -306,8 +308,22 @@ fhandler_console::read (void *pv, size_t converting a CTRL-U. */ if ((unsigned char)ich > 0x7f) con_to_str (tmp + 1, tmp + 1, 1); - /* Determine if the keystroke is modified by META. */ - if (!(input_rec.Event.KeyEvent.dwControlKeyState & meta_mask)) + /* Determine if the keystroke is modified by META. The tricky + part is to distinguish whether the right Alt key should be + recognized as Alt, or as AltGr. */ + bool meta; + if (os_being_run == winNT) + /* WinNT: AltGr is reported as Ctrl+Alt, and Ctrl+Alt is + treated just like AltGr. However, if Ctrl+Alt+key generates + an ASCII control character, interpret is as META. */ + meta = (control_key_state & ALT_PRESSED) != 0 + && ((control_key_state & CTRL_PRESSED) == 0 + || (ich >= 0 && ich <= 0x1f || ich == 0x7f)); + else + /* Win9x: there's no way to distinguish Alt from AltGr, so rely + on meta_mask heuristic (see fhandler_console constructor). */ + meta = (control_key_state & meta_mask) != 0; + if (!meta) toadd = tmp + 1; else { @@ -319,6 +335,8 @@ fhandler_console::read (void *pv, size_t } #undef ich #undef wch +#undef ALT_PRESSED +#undef CTRL_PRESSED break; case MOUSE_EVENT: --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple --/04w6evG8XlLl3ft--