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/fhandler_console.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/fhandler_console.cc')
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 13450d892..1f89acd56 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -7,7 +7,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #include "winsup.h" -#include <dinput.h> #include "miscfuncs.h" #include <stdio.h> #include <stdlib.h> @@ -399,33 +398,16 @@ fhandler_console::read (void *pv, size_t& buflen) break; } -#define ich (input_rec.Event.KeyEvent.uChar.AsciiChar) #define wch (input_rec.Event.KeyEvent.uChar.UnicodeChar) - /* Ignore key up events, except for left alt events with non-zero character - */ + /* Ignore key up events, except for Alt+Numpad events. */ if (!input_rec.Event.KeyEvent.bKeyDown && - /* - Event for left alt, with a non-zero character, comes from - "alt + numerics" key sequence. - e.g. <left-alt> 0233 => é - */ - !(wch != 0 - // ?? experimentally determined on an XP system - && virtual_key_code == VK_MENU - // left alt -- see http://www.microsoft.com/hwdev/tech/input/Scancode.asp - && input_rec.Event.KeyEvent.wVirtualScanCode == 0x38)) + !is_alt_numpad_event (&input_rec)) continue; - /* Ignore Alt+Numpad keys. These are used to enter codepoints not - available in the current keyboard layout. They are eventually - handled below after releasing the Alt key. For details see - http://www.fileformat.info/tip/microsoft/enter_unicode.htm */ + /* Ignore Alt+Numpad keys. They are eventually handled below after + releasing the Alt key. */ if (input_rec.Event.KeyEvent.bKeyDown - && wch == 0 - && input_rec.Event.KeyEvent.dwControlKeyState == LEFT_ALT_PRESSED - && input_rec.Event.KeyEvent.wVirtualScanCode >= DIK_NUMPAD7 - && input_rec.Event.KeyEvent.wVirtualScanCode <= DIK_NUMPAD0 - && input_rec.Event.KeyEvent.wVirtualScanCode != DIK_SUBTRACT) + && is_alt_numpad_key (&input_rec)) continue; if (control_key_state & SHIFT_PRESSED) @@ -510,7 +492,6 @@ fhandler_console::read (void *pv, size_t& buflen) con.nModifiers &= ~4; } } -#undef ich #undef wch break; |