diff options
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r-- | winsup/cygwin/select.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 578973741..1195951cb 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -12,6 +12,7 @@ details. */ #define __INSIDE_CYGWIN_NET__ #include "winsup.h" +#include <dinput.h> #include <stdlib.h> #include <sys/param.h> #include "ntdll.h" @@ -893,9 +894,28 @@ peek_console (select_record *me, bool) fh->send_winch_maybe (); if (irec.EventType == KEY_EVENT) { - if (irec.Event.KeyEvent.bKeyDown - && (irec.Event.KeyEvent.uChar.AsciiChar - || fhandler_console::get_nonascii_key (irec, tmpbuf))) + if (irec.Event.KeyEvent.bKeyDown) + { + /* Ignore Alt+Numpad keys. These are used to enter codepoints + not available in the current keyboard layout. They are + eventually handled in the key-up case below. For details see + http://www.fileformat.info/tip/microsoft/enter_unicode.htm */ + if (irec.Event.KeyEvent.uChar.UnicodeChar == 0 + && irec.Event.KeyEvent.dwControlKeyState == LEFT_ALT_PRESSED + && irec.Event.KeyEvent.wVirtualScanCode >= DIK_NUMPAD7 + && irec.Event.KeyEvent.wVirtualScanCode <= DIK_NUMPAD0 + && irec.Event.KeyEvent.wVirtualScanCode != DIK_SUBTRACT) + ; + /* Handle normal input. */ + else if (irec.Event.KeyEvent.uChar.UnicodeChar + || fhandler_console::get_nonascii_key (irec, tmpbuf)) + return me->read_ready = true; + } + /* Ignore key up events, except for left alt events with + non-zero character */ + else if (irec.Event.KeyEvent.uChar.UnicodeChar != 0 + && irec.Event.KeyEvent.wVirtualKeyCode == VK_MENU + && irec.Event.KeyEvent.wVirtualScanCode == 0x38) return me->read_ready = true; } else |