diff options
Diffstat (limited to 'winsup/cygwin/miscfuncs.h')
-rw-r--r-- | winsup/cygwin/miscfuncs.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/winsup/cygwin/miscfuncs.h b/winsup/cygwin/miscfuncs.h index cc2293500..eb898e645 100644 --- a/winsup/cygwin/miscfuncs.h +++ b/winsup/cygwin/miscfuncs.h @@ -9,9 +9,34 @@ details. */ #ifndef _MISCFUNCS_H #define _MISCFUNCS_H +#include <dinput.h> + #define likely(X) __builtin_expect (!!(X), 1) #define unlikely(X) __builtin_expect (!!(X), 0) +/* Check for Alt+Numpad keys in a console input record. These are used to + enter codepoints not available in the current keyboard layout For details + see http://www.fileformat.info/tip/microsoft/enter_unicode.htm */ +static inline bool +is_alt_numpad_key (PINPUT_RECORD pirec) +{ + return pirec->Event.KeyEvent.uChar.UnicodeChar == 0 + && pirec->Event.KeyEvent.dwControlKeyState == LEFT_ALT_PRESSED + && pirec->Event.KeyEvent.wVirtualScanCode >= DIK_NUMPAD7 + && pirec->Event.KeyEvent.wVirtualScanCode <= DIK_NUMPAD0 + && pirec->Event.KeyEvent.wVirtualScanCode != DIK_SUBTRACT; +} + +/* Event for left Alt, with a non-zero character, comes from Alt+Numpad + key sequence. e.g. <left-alt> 233 => é This is typically handled + as the key up event after releasing the Alt key. */ +static inline bool +is_alt_numpad_event (PINPUT_RECORD pirec) +{ + return pirec->Event.KeyEvent.uChar.UnicodeChar != 0 + && pirec->Event.KeyEvent.wVirtualKeyCode == VK_MENU + && pirec->Event.KeyEvent.wVirtualScanCode == 0x38; +} int __reg1 winprio_to_nice (DWORD); DWORD __reg1 nice_to_winprio (int &); |