Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug #743
Browse files Browse the repository at this point in the history
The arrow keys and keypad arrow keys have almost the same scancodes!
  • Loading branch information
slouken committed Jan 27, 2010
1 parent beefdea commit 23c0263
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/video/win32/SDL_vkeys.h
Expand Up @@ -73,4 +73,5 @@
#define VK_APOSTROPHE 0xDE
#define VK_BACKTICK 0xDF
#define VK_OEM_102 0xE2

/* vi: set ts=4 sw=4 expandtab: */
15 changes: 10 additions & 5 deletions src/video/win32/SDL_win32events.c
Expand Up @@ -84,11 +84,16 @@ RemapVKEY(WPARAM wParam, LPARAM lParam)
}
}

/* 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;
}
}
}

Expand Down

0 comments on commit 23c0263

Please sign in to comment.