diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2017-01-19 21:41:21 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2017-01-19 21:42:10 +0100 |
commit | 3b7b65b2f8a809af30eb1eff6f26df5907e6f0ba (patch) | |
tree | 160a0f33d8b66563ea76f624fcadc923b2185cbb /winsup/cygwin/select.cc | |
parent | 9985cf66e99121964c830502f68498e062802811 (diff) | |
download | cygnal-3b7b65b2f8a809af30eb1eff6f26df5907e6f0ba.tar.gz cygnal-3b7b65b2f8a809af30eb1eff6f26df5907e6f0ba.tar.bz2 cygnal-3b7b65b2f8a809af30eb1eff6f26df5907e6f0ba.zip |
Simplify check for Alt-Numpad
Create two new inline functions is_alt_numpad_key(PINPUT_RECORD) and
is_alt_numpad_event(PINPUT_RECORD) which contain the actual checks.
Call these functions from fhandler_console::read and peek_console for
better readability.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r-- | winsup/cygwin/select.cc | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 1195951cb..158de6af7 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -12,7 +12,6 @@ details. */ #define __INSIDE_CYGWIN_NET__ #include "winsup.h" -#include <dinput.h> #include <stdlib.h> #include <sys/param.h> #include "ntdll.h" @@ -896,26 +895,17 @@ peek_console (select_record *me, bool) { 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) + /* Ignore Alt+Numpad keys. They are eventually handled in the + key-up case below. */ + if (is_alt_numpad_key (&irec)) ; /* 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) + /* Ignore key up events, except for Alt+Numpad events. */ + else if (is_alt_numpad_event (&irec)) return me->read_ready = true; } else |