]> sourceware.org Git - newlib-cygwin.git/commitdiff
cygwin: generate Alt-Numpad characters independent of NumLock state
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 1 Aug 2017 12:10:50 +0000 (14:10 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 1 Aug 2017 12:10:50 +0000 (14:10 +0200)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/miscfuncs.h

index eb898e6453968f6d534902f88bbe0a5effbf03c4..3960b5429369ae8c408b5bd4c21d1c719270d2d1 100644 (file)
@@ -20,8 +20,14 @@ details. */
 static inline bool
 is_alt_numpad_key (PINPUT_RECORD pirec)
 {
+  /* Remove lock key state from ControlKeyState.  Do not remove enhanced key
+     state since it helps to distinguish between cursor (EK) and numpad keys
+     (non-EK). */
+  DWORD ctrl_state = pirec->Event.KeyEvent.dwControlKeyState
+                    & ~(CAPSLOCK_ON | NUMLOCK_ON | SCROLLLOCK_ON);
+
   return pirec->Event.KeyEvent.uChar.UnicodeChar == 0
-        && pirec->Event.KeyEvent.dwControlKeyState == LEFT_ALT_PRESSED
+        && ctrl_state == LEFT_ALT_PRESSED
         && pirec->Event.KeyEvent.wVirtualScanCode >= DIK_NUMPAD7
         && pirec->Event.KeyEvent.wVirtualScanCode <= DIK_NUMPAD0
         && pirec->Event.KeyEvent.wVirtualScanCode != DIK_SUBTRACT;
This page took 0.029577 seconds and 5 git commands to generate.