delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/10/23/13:45:19

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Date: Tue, 23 Oct 2001 13:46:05 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Cc: ian DOT ray AT nokia DOT com
Subject: [ian DOT ray AT nokia DOT com: incoming fax! at last!]
Message-ID: <20011023134605.A23357@redhat.com>
Mail-Followup-To: cygwin-developers AT cygwin DOT com, ian DOT ray AT nokia DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.3.21i

Does anyone have any insight into this patch:

http://sources.redhat.com/ml/cygwin/2001-10/msg00626.html

It feels wrong to me to be doing a WFMO followed by a PeekConsoleInput
followed by a ReadConsoleInput.

I've just received the assignments from Ian so I can officially start
commenting on this now...

I've included the patch below from the web page but I don't think it
will cleanly apply as is.

cgf

--- fhandler_console.cc-orig	Thu Oct 11 15:44:55 2001
+++ fhandler_console.cc	Thu Oct 11 15:47:15 2001
@@ -248,11 +248,34 @@ fhandler_console::read (void *pv, size_t
       INPUT_RECORD input_rec;
       const char *toadd = NULL;
 
-      if (!ReadConsoleInput (h, &input_rec, 1, &nread))
+      if (!PeekConsoleInput (h, &input_rec, 1, &nread))
 	{
 	  __seterrno ();
 	  syscall_printf ("ReadConsoleInput failed, %E");
 	  return -1;		/* seems to be failure */
+	}
+
+      /*
+       * On Win95, the Caps Lock key toggles all keys, not just the alpha keys;
+       * we work around this by reading non-enhanced key-*presses* using the
+       * ReadConsole() function.
+       */
+      int is_win95_workaround =
+	   (!wincap.is_winnt())
+	&& (input_rec.EventType == KEY_EVENT)
+	&& (input_rec.Event.KeyEvent.bKeyDown)
+	&& (!(input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
+	;
+
+      if (is_win95_workaround)
+        {
+	  DWORD  ch;
+	  (void) ReadConsole (h, &ch, 1, &nread, NULL);
+	  input_rec.Event.KeyEvent.uChar.AsciiChar = (unsigned char)ch;
+	}
+      else
+        {
+          (void) ReadConsoleInput (h, &input_rec, 1, &nread);
 	}
 
       /* check the event that occurred */

- Raw text -


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