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

Commit

Permalink
Added support for keypad enter
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 10, 2008
1 parent 209c32a commit 59c705c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/events/scancodes_win32.h
Expand Up @@ -37,7 +37,7 @@ static SDL_scancode win32_scancode_table[] = {
/* 7, 0x07 */ SDL_SCANCODE_UNKNOWN,
/* 8, 0x08 */ SDL_SCANCODE_BACKSPACE,
/* 9, 0x09 */ SDL_SCANCODE_TAB,
/* 10, 0x0a */ SDL_SCANCODE_UNKNOWN,
/* 10, 0x0a */ SDL_SCANCODE_KP_ENTER, /* Not a VKEY, SDL specific */
/* 11, 0x0b */ SDL_SCANCODE_UNKNOWN,
/* 12, 0x0c */ SDL_SCANCODE_CLEAR,
/* 13, 0x0d */ SDL_SCANCODE_RETURN,
Expand Down
10 changes: 10 additions & 0 deletions src/video/win32/SDL_win32events.c
Expand Up @@ -36,6 +36,8 @@
#define REPEATED_KEYMASK (1<<30)
#define EXTENDED_KEYMASK (1<<24)

#define VK_ENTER 10 /* Keypad Enter ... no VKEY defined? */

/* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x020B
Expand Down Expand Up @@ -362,6 +364,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
else
wParam = VK_LMENU;
break;
case VK_RETURN:
if (lParam & EXTENDED_KEYMASK)
wParam = VK_ENTER;
break;
}
if (wParam < 256) {
SDL_SendKeyboardKey(index, SDL_PRESSED,
Expand Down Expand Up @@ -406,6 +412,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
else
wParam = VK_LMENU;
break;
case VK_RETURN:
if (lParam & EXTENDED_KEYMASK)
wParam = VK_ENTER;
break;
}
/* Windows only reports keyup for print screen */
if (wParam == VK_SNAPSHOT
Expand Down

0 comments on commit 59c705c

Please sign in to comment.