WinRT: made use of Win32 key codes if and when a documented WinRT key code can't be found
This commit is contained in:
parent
37f50a4f25
commit
fe5d1f4c32
1 changed files with 11 additions and 0 deletions
|
@ -8,6 +8,7 @@ extern "C" {
|
|||
#include "../../events/SDL_mouse_c.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
#include "../../events/SDL_windowevents_c.h"
|
||||
#include "../../events/scancodes_windows.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_log.h"
|
||||
}
|
||||
|
@ -462,10 +463,20 @@ static SDL_Scancode WinRT_Keycodes[] = {
|
|||
static SDL_Scancode
|
||||
TranslateKeycode(int keycode)
|
||||
{
|
||||
/* Try to get a documented, WinRT, 'VirtualKey' first (as documented at
|
||||
http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.virtualkey.aspx ).
|
||||
If that fails, try to get a Win32 virtual key.
|
||||
*/
|
||||
// TODO, WinRT: try filling out the WinRT keycode table as much as possible, using the Win32 table for interpretation hints
|
||||
SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
|
||||
if (keycode < SDL_arraysize(WinRT_Keycodes)) {
|
||||
scancode = WinRT_Keycodes[keycode];
|
||||
}
|
||||
if (scancode == SDL_SCANCODE_UNKNOWN) {
|
||||
if (keycode < SDL_arraysize(windows_scancode_table)) {
|
||||
scancode = windows_scancode_table[keycode];
|
||||
}
|
||||
}
|
||||
if (scancode == SDL_SCANCODE_UNKNOWN) {
|
||||
SDL_Log("WinRT TranslateKeycode, unknown keycode=%d\n", (int)keycode);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue