Skip to content

Commit

Permalink
WinRT: fallback to scancode key detection, if VirtualKey/VK detection…
Browse files Browse the repository at this point in the history
… fails
  • Loading branch information
DavidLudwig committed Oct 25, 2014
1 parent 20b19aa commit ed2fff6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/video/winrt/SDL_winrtkeyboard.cpp
Expand Up @@ -292,13 +292,19 @@ TranslateKeycode(int keycode, unsigned int nativeScancode)
/* Try to get a documented, WinRT, 'VirtualKey' next (as documented at
http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.virtualkey.aspx ).
If that fails, fall back to a Win32 virtual key.
If that fails, attempt to fall back to a scancode-derived key.
*/
if (keycode < SDL_arraysize(WinRT_Official_Keycodes)) {
scancode = WinRT_Official_Keycodes[keycode];
}
if (scancode == SDL_SCANCODE_UNKNOWN) {
scancode = WINRT_TranslateUnofficialKeycode(keycode);
}
if (scancode == SDL_SCANCODE_UNKNOWN) {
if (nativeScancode < SDL_arraysize(windows_scancode_table)) {
scancode = windows_scancode_table[nativeScancode];
}
}
if (scancode == SDL_SCANCODE_UNKNOWN) {
SDL_Log("WinRT TranslateKeycode, unknown keycode=%d\n", (int)keycode);
}
Expand Down

0 comments on commit ed2fff6

Please sign in to comment.