WinRT: fallback to scancode key detection, if VirtualKey/VK detection fails
authorDavid Ludwig
Sat, 25 Oct 2014 08:50:41 -0400
changeset 91917a728256c5f5
parent 9190 ff12797f287b
child 9192 50b888469010
WinRT: fallback to scancode key detection, if VirtualKey/VK detection fails
src/video/winrt/SDL_winrtkeyboard.cpp
     1.1 --- a/src/video/winrt/SDL_winrtkeyboard.cpp	Sat Oct 25 08:43:51 2014 -0400
     1.2 +++ b/src/video/winrt/SDL_winrtkeyboard.cpp	Sat Oct 25 08:50:41 2014 -0400
     1.3 @@ -292,6 +292,7 @@
     1.4      /* Try to get a documented, WinRT, 'VirtualKey' next (as documented at
     1.5         http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.virtualkey.aspx ).
     1.6         If that fails, fall back to a Win32 virtual key.
     1.7 +       If that fails, attempt to fall back to a scancode-derived key.
     1.8      */
     1.9      if (keycode < SDL_arraysize(WinRT_Official_Keycodes)) {
    1.10          scancode = WinRT_Official_Keycodes[keycode];
    1.11 @@ -300,6 +301,11 @@
    1.12          scancode = WINRT_TranslateUnofficialKeycode(keycode);
    1.13      }
    1.14      if (scancode == SDL_SCANCODE_UNKNOWN) {
    1.15 +        if (nativeScancode < SDL_arraysize(windows_scancode_table)) {
    1.16 +            scancode = windows_scancode_table[nativeScancode];
    1.17 +        }
    1.18 +    }
    1.19 +    if (scancode == SDL_SCANCODE_UNKNOWN) {
    1.20          SDL_Log("WinRT TranslateKeycode, unknown keycode=%d\n", (int)keycode);
    1.21      }
    1.22      return scancode;