diff options
author | Sven Gothel <[email protected]> | 2013-05-16 21:33:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-05-16 21:33:25 +0200 |
commit | 86a5460c5052cdab7b9f6294c46a0b4e30dfa260 (patch) | |
tree | 5c029a5d847fe6f7856098e5c734dd621cd31c9d /src/newt/native/WindowsWindow.c | |
parent | 890dabf77593732bd9833350b441a37c60f74d45 (diff) |
Fix Bug 723: Remove VK_KP_<Cursor> numpad key-codes, use general VK_<Cursor> key-codes; Respect numpad printable keys; Use keySym for numpad if possible.
- KeyEvent keyCode/keySym values re-ordered!
- Remove VK_KP_<Cursor> numpad key-codes, use general VK_<Cursor> key-codes.
Numpad cursor keys are not supported on some platforms (Windows),
or not configured on most X11 configurations.
- Respect numpad printable keys,
i.e. don't treat them as non-printable.
- Use keySym for numpad if possible.
Numpad keys require modifiers, hence X11 and Windows shall return keySym.
Diffstat (limited to 'src/newt/native/WindowsWindow.c')
-rw-r--r-- | src/newt/native/WindowsWindow.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 7ede3a20d..ac0ebf07e 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -219,6 +219,7 @@ static KeyMapEntry keyMapTable[] = { {J_VK_INSERT, VK_INSERT, 0}, {J_VK_DELETE, VK_DELETE, 0}, {J_VK_HOME, VK_HOME, 0}, + // {J_VK_BEGIN, VK_BEGIN, 0}, // not mapped {J_VK_END, VK_END, 0}, {J_VK_PAGE_UP, VK_PRIOR, 0}, {J_VK_PAGE_DOWN, VK_NEXT, 0}, @@ -332,6 +333,8 @@ static KeyMapEntry keyMapTable[] = { #define MAPVK_VK_TO_VSC_EX 4 #endif +#define IS_WITHIN(k,a,b) ((a)<=(k)&&(k)<=(b)) + static HKL kbdLayoutUS = 0; static const LPCSTR US_LAYOUT_NAME = "00000409"; @@ -398,23 +401,6 @@ static void ParseWmVKeyAndScanCode(USHORT winVKey, BYTE winScanCode, BYTE flags, kbdState[VK_SPACE] &= ~0x80; } - // Assume extended scan code 0xE0 if extended flags is set (no 0xE1 from WM_KEYUP/WM_KEYDOWN) - USHORT winScanCodeExt = winScanCode; - if( 0 != ( 0x01 & flags ) ) { - winScanCodeExt |= 0xE000; - } - - // - // winVKey, winScanCodeExt -> javaVKeyUS w/ US KeyboardLayout - // - for (i = 0; keyMapTable[i].windowsKey != 0; i++) { - if ( keyMapTable[i].windowsScanCodeUS == winScanCodeExt ) { - javaVKeyUS = keyMapTable[i].javaKey; - winVKeyUS = keyMapTable[i].windowsKey; - break; - } - } - // // winVKey -> javaVKeyXX // @@ -424,6 +410,28 @@ static void ParseWmVKeyAndScanCode(USHORT winVKey, BYTE winScanCode, BYTE flags, break; } } + if( IS_WITHIN( winVKey, VK_NUMPAD0, VK_DIVIDE ) ) { + // Use modded keySym for keypad for US and NN + winVKeyUS = winVKey; + javaVKeyUS = javaVKeyXX; + } else { + // Assume extended scan code 0xE0 if extended flags is set (no 0xE1 from WM_KEYUP/WM_KEYDOWN) + USHORT winScanCodeExt = winScanCode; + if( 0 != ( 0x01 & flags ) ) { + winScanCodeExt |= 0xE000; + } + + // + // winVKey, winScanCodeExt -> javaVKeyUS w/ US KeyboardLayout + // + for (i = 0; keyMapTable[i].windowsKey != 0; i++) { + if ( keyMapTable[i].windowsScanCodeUS == winScanCodeExt ) { + winVKeyUS = keyMapTable[i].windowsKey; + javaVKeyUS = keyMapTable[i].javaKey; + break; + } + } + } *outJavaVKeyUS = javaVKeyUS; *outJavaVKeyXX = javaVKeyXX; |