src/video/winrt/SDL_winrtkeyboard.cpp
changeset 9190 ff12797f287b
parent 9189 5dc3c7c2864c
child 9191 7a728256c5f5
equal deleted inserted replaced
9189:5dc3c7c2864c 9190:ff12797f287b
   267      * If Microsoft ever allows MapVirtualKey or MapVirtualKeyEx to be used
   267      * If Microsoft ever allows MapVirtualKey or MapVirtualKeyEx to be used
   268      * in WinRT apps, or something similar to these (it doesn't appear to be,
   268      * in WinRT apps, or something similar to these (it doesn't appear to be,
   269      * at least not for Windows [Phone] 8/8.1, as of Oct 24, 2014), then this
   269      * at least not for Windows [Phone] 8/8.1, as of Oct 24, 2014), then this
   270      * hack might become deprecated, or obsolete.
   270      * hack might become deprecated, or obsolete.
   271      */
   271      */
   272     if (nativeScancode < (sizeof(windows_scancode_table) / sizeof(SDL_Scancode))) {
   272     if (nativeScancode < SDL_arraysize(windows_scancode_table)) {
   273         switch (keycode) {
   273         switch (keycode) {
   274             case 16:    // VirtualKey.Shift
   274             case 16:    // VirtualKey.Shift
   275                 switch (windows_scancode_table[nativeScancode]) {
   275                 switch (windows_scancode_table[nativeScancode]) {
   276                     case SDL_SCANCODE_LSHIFT:
   276                     case SDL_SCANCODE_LSHIFT:
   277                     case SDL_SCANCODE_RSHIFT:
   277                     case SDL_SCANCODE_RSHIFT:
   309 WINRT_ProcessKeyDownEvent(Windows::UI::Core::KeyEventArgs ^args)
   309 WINRT_ProcessKeyDownEvent(Windows::UI::Core::KeyEventArgs ^args)
   310 {
   310 {
   311     SDL_Scancode sdlScancode = TranslateKeycode((int)args->VirtualKey, args->KeyStatus.ScanCode);
   311     SDL_Scancode sdlScancode = TranslateKeycode((int)args->VirtualKey, args->KeyStatus.ScanCode);
   312 #if 0
   312 #if 0
   313     SDL_Keycode keycode = SDL_GetKeyFromScancode(sdlScancode);
   313     SDL_Keycode keycode = SDL_GetKeyFromScancode(sdlScancode);
   314     SDL_Log("key down, handled=%s, ext?=%s, released?=%s, menu key down?=%s, repeat count=%d, native scan code=0x%x, was down?=%s, vkey=%d, sdl scan code=%d (%s), sdl key code=%d (%s)\n",
   314     SDL_Log("key down, handled=%s, ext?=%s, released?=%s, menu key down?=%s, "
       
   315             "repeat count=%d, native scan code=0x%x, was down?=%s, vkey=%d, "
       
   316             "sdl scan code=%d (%s), sdl key code=%d (%s)\n",
   315         (args->Handled ? "1" : "0"),
   317         (args->Handled ? "1" : "0"),
   316         (args->KeyStatus.IsExtendedKey ? "1" : "0"),
   318         (args->KeyStatus.IsExtendedKey ? "1" : "0"),
   317         (args->KeyStatus.IsKeyReleased ? "1" : "0"),
   319         (args->KeyStatus.IsKeyReleased ? "1" : "0"),
   318         (args->KeyStatus.IsMenuKeyDown ? "1" : "0"),
   320         (args->KeyStatus.IsMenuKeyDown ? "1" : "0"),
   319         args->KeyStatus.RepeatCount,
   321         args->KeyStatus.RepeatCount,
   334 WINRT_ProcessKeyUpEvent(Windows::UI::Core::KeyEventArgs ^args)
   336 WINRT_ProcessKeyUpEvent(Windows::UI::Core::KeyEventArgs ^args)
   335 {
   337 {
   336     SDL_Scancode sdlScancode = TranslateKeycode((int)args->VirtualKey, args->KeyStatus.ScanCode);
   338     SDL_Scancode sdlScancode = TranslateKeycode((int)args->VirtualKey, args->KeyStatus.ScanCode);
   337 #if 0
   339 #if 0
   338     SDL_Keycode keycode = SDL_GetKeyFromScancode(sdlScancode);
   340     SDL_Keycode keycode = SDL_GetKeyFromScancode(sdlScancode);
   339     SDL_Log("key up, handled=%s, ext?=%s, released?=%s, menu key down?=%s, repeat count=%d, native scan code=0x%x, was down?=%s, vkey=%d, sdl scan code=%d (%s), sdl key code=%d (%s)\n",
   341     SDL_Log("key up, handled=%s, ext?=%s, released?=%s, menu key down?=%s, "
       
   342             "repeat count=%d, native scan code=0x%x, was down?=%s, vkey=%d, "
       
   343             "sdl scan code=%d (%s), sdl key code=%d (%s)\n",
   340         (args->Handled ? "1" : "0"),
   344         (args->Handled ? "1" : "0"),
   341         (args->KeyStatus.IsExtendedKey ? "1" : "0"),
   345         (args->KeyStatus.IsExtendedKey ? "1" : "0"),
   342         (args->KeyStatus.IsKeyReleased ? "1" : "0"),
   346         (args->KeyStatus.IsKeyReleased ? "1" : "0"),
   343         (args->KeyStatus.IsMenuKeyDown ? "1" : "0"),
   347         (args->KeyStatus.IsMenuKeyDown ? "1" : "0"),
   344         args->KeyStatus.RepeatCount,
   348         args->KeyStatus.RepeatCount,