Mercurial > sdl-ios-xcode
changeset 3700:076c12750bc4
Fixed bug #743
The arrow keys and keypad arrow keys have almost the same scancodes!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 27 Jan 2010 05:14:22 +0000 |
parents | 4160ba33b597 |
children | fb905d5674cc |
files | src/video/win32/SDL_vkeys.h src/video/win32/SDL_win32events.c |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/win32/SDL_vkeys.h Tue Jan 26 06:01:33 2010 +0000 +++ b/src/video/win32/SDL_vkeys.h Wed Jan 27 05:14:22 2010 +0000 @@ -73,4 +73,5 @@ #define VK_APOSTROPHE 0xDE #define VK_BACKTICK 0xDF #define VK_OEM_102 0xE2 + /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/win32/SDL_win32events.c Tue Jan 26 06:01:33 2010 +0000 +++ b/src/video/win32/SDL_win32events.c Wed Jan 27 05:14:22 2010 +0000 @@ -84,11 +84,16 @@ } } - /* Keypad keys are a little trickier, we always scan for them. */ - for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) { - if (scancode == keypad_scancodes[i]) { - wParam = VK_NUMPAD0 + i; - break; + /* Keypad keys are a little trickier, we always scan for them. + Keypad arrow keys have the same scancode as normal arrow keys, + except they don't have the extended bit (0x1000000) set. + */ + if (!(lParam & 0x1000000)) { + for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) { + if (scancode == keypad_scancodes[i]) { + wParam = VK_NUMPAD0 + i; + break; + } } }