src/video/winrt/SDL_winrtkeyboard.cpp
author David Ludwig
Tue, 27 Aug 2013 11:39:44 -0400
changeset 8494 5d165785918d
parent 8489 7fd62b320c31
child 8582 c3e9a2b93517
permissions -rw-r--r--
WinRT: misc code cleanups
dludwig@8489
     1
/*
dludwig@8489
     2
  Simple DirectMedia Layer
dludwig@8489
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
dludwig@8489
     4
dludwig@8489
     5
  This software is provided 'as-is', without any express or implied
dludwig@8489
     6
  warranty.  In no event will the authors be held liable for any damages
dludwig@8489
     7
  arising from the use of this software.
dludwig@8489
     8
dludwig@8489
     9
  Permission is granted to anyone to use this software for any purpose,
dludwig@8489
    10
  including commercial applications, and to alter it and redistribute it
dludwig@8489
    11
  freely, subject to the following restrictions:
dludwig@8489
    12
dludwig@8489
    13
  1. The origin of this software must not be misrepresented; you must not
dludwig@8489
    14
     claim that you wrote the original software. If you use this software
dludwig@8489
    15
     in a product, an acknowledgment in the product documentation would be
dludwig@8489
    16
     appreciated but is not required.
dludwig@8489
    17
  2. Altered source versions must be plainly marked as such, and must not be
dludwig@8489
    18
     misrepresented as being the original software.
dludwig@8489
    19
  3. This notice may not be removed or altered from any source distribution.
dludwig@8489
    20
*/
dludwig@8489
    21
#include "SDL_config.h"
dludwig@8489
    22
dludwig@8489
    23
#if SDL_VIDEO_DRIVER_WINRT
dludwig@8489
    24
dludwig@8494
    25
/* Standard C++11 includes */
dludwig@8489
    26
#include <unordered_map>
dludwig@8489
    27
dludwig@8489
    28
dludwig@8494
    29
/* Windows-specific includes */
dludwig@8489
    30
#include <Windows.h>
dludwig@8494
    31
#include <agile.h>
dludwig@8489
    32
dludwig@8489
    33
dludwig@8494
    34
/* SDL-specific includes */
dludwig@8489
    35
#include <SDL.h>
dludwig@8489
    36
#include "SDL_winrtevents_c.h"
dludwig@8489
    37
dludwig@8489
    38
extern "C" {
dludwig@8489
    39
#include "../../events/scancodes_windows.h"
dludwig@8489
    40
#include "../../events/SDL_keyboard_c.h"
dludwig@8489
    41
}
dludwig@8489
    42
dludwig@8489
    43
dludwig@8489
    44
static SDL_Scancode WinRT_Official_Keycodes[] = {
dludwig@8489
    45
    SDL_SCANCODE_UNKNOWN, // VirtualKey.None -- 0
dludwig@8489
    46
    SDL_SCANCODE_UNKNOWN, // VirtualKey.LeftButton -- 1
dludwig@8489
    47
    SDL_SCANCODE_UNKNOWN, // VirtualKey.RightButton -- 2
dludwig@8489
    48
    SDL_SCANCODE_CANCEL, // VirtualKey.Cancel -- 3
dludwig@8489
    49
    SDL_SCANCODE_UNKNOWN, // VirtualKey.MiddleButton -- 4
dludwig@8489
    50
    SDL_SCANCODE_UNKNOWN, // VirtualKey.XButton1 -- 5
dludwig@8489
    51
    SDL_SCANCODE_UNKNOWN, // VirtualKey.XButton2 -- 6
dludwig@8489
    52
    SDL_SCANCODE_UNKNOWN, // -- 7
dludwig@8489
    53
    SDL_SCANCODE_BACKSPACE, // VirtualKey.Back -- 8
dludwig@8489
    54
    SDL_SCANCODE_TAB, // VirtualKey.Tab -- 9
dludwig@8489
    55
    SDL_SCANCODE_UNKNOWN, // -- 10
dludwig@8489
    56
    SDL_SCANCODE_UNKNOWN, // -- 11
dludwig@8489
    57
    SDL_SCANCODE_CLEAR, // VirtualKey.Clear -- 12
dludwig@8489
    58
    SDL_SCANCODE_RETURN, // VirtualKey.Enter -- 13
dludwig@8489
    59
    SDL_SCANCODE_UNKNOWN, // -- 14
dludwig@8489
    60
    SDL_SCANCODE_UNKNOWN, // -- 15
dludwig@8489
    61
    SDL_SCANCODE_LSHIFT, // VirtualKey.Shift -- 16
dludwig@8489
    62
    SDL_SCANCODE_LCTRL, // VirtualKey.Control -- 17
dludwig@8489
    63
    SDL_SCANCODE_MENU, // VirtualKey.Menu -- 18
dludwig@8489
    64
    SDL_SCANCODE_PAUSE, // VirtualKey.Pause -- 19
dludwig@8489
    65
    SDL_SCANCODE_CAPSLOCK, // VirtualKey.CapitalLock -- 20
dludwig@8489
    66
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Kana or VirtualKey.Hangul -- 21
dludwig@8489
    67
    SDL_SCANCODE_UNKNOWN, // -- 22
dludwig@8489
    68
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Junja -- 23
dludwig@8489
    69
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Final -- 24
dludwig@8489
    70
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Hanja or VirtualKey.Kanji -- 25
dludwig@8489
    71
    SDL_SCANCODE_UNKNOWN, // -- 26
dludwig@8489
    72
    SDL_SCANCODE_ESCAPE, // VirtualKey.Escape -- 27
dludwig@8489
    73
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Convert -- 28
dludwig@8489
    74
    SDL_SCANCODE_UNKNOWN, // VirtualKey.NonConvert -- 29
dludwig@8489
    75
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Accept -- 30
dludwig@8489
    76
    SDL_SCANCODE_UNKNOWN, // VirtualKey.ModeChange -- 31  (maybe SDL_SCANCODE_MODE ?)
dludwig@8489
    77
    SDL_SCANCODE_SPACE, // VirtualKey.Space -- 32
dludwig@8489
    78
    SDL_SCANCODE_PAGEUP, // VirtualKey.PageUp -- 33
dludwig@8489
    79
    SDL_SCANCODE_PAGEDOWN, // VirtualKey.PageDown -- 34
dludwig@8489
    80
    SDL_SCANCODE_END, // VirtualKey.End -- 35
dludwig@8489
    81
    SDL_SCANCODE_HOME, // VirtualKey.Home -- 36
dludwig@8489
    82
    SDL_SCANCODE_LEFT, // VirtualKey.Left -- 37
dludwig@8489
    83
    SDL_SCANCODE_UP, // VirtualKey.Up -- 38
dludwig@8489
    84
    SDL_SCANCODE_RIGHT, // VirtualKey.Right -- 39
dludwig@8489
    85
    SDL_SCANCODE_DOWN, // VirtualKey.Down -- 40
dludwig@8489
    86
    SDL_SCANCODE_SELECT, // VirtualKey.Select -- 41
dludwig@8489
    87
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Print -- 42  (maybe SDL_SCANCODE_PRINTSCREEN ?)
dludwig@8489
    88
    SDL_SCANCODE_EXECUTE, // VirtualKey.Execute -- 43
dludwig@8489
    89
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Snapshot -- 44
dludwig@8489
    90
    SDL_SCANCODE_INSERT, // VirtualKey.Insert -- 45
dludwig@8489
    91
    SDL_SCANCODE_DELETE, // VirtualKey.Delete -- 46
dludwig@8489
    92
    SDL_SCANCODE_HELP, // VirtualKey.Help -- 47
dludwig@8489
    93
    SDL_SCANCODE_0, // VirtualKey.Number0 -- 48
dludwig@8489
    94
    SDL_SCANCODE_1, // VirtualKey.Number1 -- 49
dludwig@8489
    95
    SDL_SCANCODE_2, // VirtualKey.Number2 -- 50
dludwig@8489
    96
    SDL_SCANCODE_3, // VirtualKey.Number3 -- 51
dludwig@8489
    97
    SDL_SCANCODE_4, // VirtualKey.Number4 -- 52
dludwig@8489
    98
    SDL_SCANCODE_5, // VirtualKey.Number5 -- 53
dludwig@8489
    99
    SDL_SCANCODE_6, // VirtualKey.Number6 -- 54
dludwig@8489
   100
    SDL_SCANCODE_7, // VirtualKey.Number7 -- 55
dludwig@8489
   101
    SDL_SCANCODE_8, // VirtualKey.Number8 -- 56
dludwig@8489
   102
    SDL_SCANCODE_9, // VirtualKey.Number9 -- 57
dludwig@8489
   103
    SDL_SCANCODE_UNKNOWN, // -- 58
dludwig@8489
   104
    SDL_SCANCODE_UNKNOWN, // -- 59
dludwig@8489
   105
    SDL_SCANCODE_UNKNOWN, // -- 60
dludwig@8489
   106
    SDL_SCANCODE_UNKNOWN, // -- 61
dludwig@8489
   107
    SDL_SCANCODE_UNKNOWN, // -- 62
dludwig@8489
   108
    SDL_SCANCODE_UNKNOWN, // -- 63
dludwig@8489
   109
    SDL_SCANCODE_UNKNOWN, // -- 64
dludwig@8489
   110
    SDL_SCANCODE_A, // VirtualKey.A -- 65
dludwig@8489
   111
    SDL_SCANCODE_B, // VirtualKey.B -- 66
dludwig@8489
   112
    SDL_SCANCODE_C, // VirtualKey.C -- 67
dludwig@8489
   113
    SDL_SCANCODE_D, // VirtualKey.D -- 68
dludwig@8489
   114
    SDL_SCANCODE_E, // VirtualKey.E -- 69
dludwig@8489
   115
    SDL_SCANCODE_F, // VirtualKey.F -- 70
dludwig@8489
   116
    SDL_SCANCODE_G, // VirtualKey.G -- 71
dludwig@8489
   117
    SDL_SCANCODE_H, // VirtualKey.H -- 72
dludwig@8489
   118
    SDL_SCANCODE_I, // VirtualKey.I -- 73
dludwig@8489
   119
    SDL_SCANCODE_J, // VirtualKey.J -- 74
dludwig@8489
   120
    SDL_SCANCODE_K, // VirtualKey.K -- 75
dludwig@8489
   121
    SDL_SCANCODE_L, // VirtualKey.L -- 76
dludwig@8489
   122
    SDL_SCANCODE_M, // VirtualKey.M -- 77
dludwig@8489
   123
    SDL_SCANCODE_N, // VirtualKey.N -- 78
dludwig@8489
   124
    SDL_SCANCODE_O, // VirtualKey.O -- 79
dludwig@8489
   125
    SDL_SCANCODE_P, // VirtualKey.P -- 80
dludwig@8489
   126
    SDL_SCANCODE_Q, // VirtualKey.Q -- 81
dludwig@8489
   127
    SDL_SCANCODE_R, // VirtualKey.R -- 82
dludwig@8489
   128
    SDL_SCANCODE_S, // VirtualKey.S -- 83
dludwig@8489
   129
    SDL_SCANCODE_T, // VirtualKey.T -- 84
dludwig@8489
   130
    SDL_SCANCODE_U, // VirtualKey.U -- 85
dludwig@8489
   131
    SDL_SCANCODE_V, // VirtualKey.V -- 86
dludwig@8489
   132
    SDL_SCANCODE_W, // VirtualKey.W -- 87
dludwig@8489
   133
    SDL_SCANCODE_X, // VirtualKey.X -- 88
dludwig@8489
   134
    SDL_SCANCODE_Y, // VirtualKey.Y -- 89
dludwig@8489
   135
    SDL_SCANCODE_Z, // VirtualKey.Z -- 90
dludwig@8489
   136
    SDL_SCANCODE_UNKNOWN, // VirtualKey.LeftWindows -- 91  (maybe SDL_SCANCODE_APPLICATION or SDL_SCANCODE_LGUI ?)
dludwig@8489
   137
    SDL_SCANCODE_UNKNOWN, // VirtualKey.RightWindows -- 92  (maybe SDL_SCANCODE_APPLICATION or SDL_SCANCODE_RGUI ?)
dludwig@8489
   138
    SDL_SCANCODE_APPLICATION, // VirtualKey.Application -- 93
dludwig@8489
   139
    SDL_SCANCODE_UNKNOWN, // -- 94
dludwig@8489
   140
    SDL_SCANCODE_SLEEP, // VirtualKey.Sleep -- 95
dludwig@8489
   141
    SDL_SCANCODE_KP_0, // VirtualKey.NumberPad0 -- 96
dludwig@8489
   142
    SDL_SCANCODE_KP_1, // VirtualKey.NumberPad1 -- 97
dludwig@8489
   143
    SDL_SCANCODE_KP_2, // VirtualKey.NumberPad2 -- 98
dludwig@8489
   144
    SDL_SCANCODE_KP_3, // VirtualKey.NumberPad3 -- 99
dludwig@8489
   145
    SDL_SCANCODE_KP_4, // VirtualKey.NumberPad4 -- 100
dludwig@8489
   146
    SDL_SCANCODE_KP_5, // VirtualKey.NumberPad5 -- 101
dludwig@8489
   147
    SDL_SCANCODE_KP_6, // VirtualKey.NumberPad6 -- 102
dludwig@8489
   148
    SDL_SCANCODE_KP_7, // VirtualKey.NumberPad7 -- 103
dludwig@8489
   149
    SDL_SCANCODE_KP_8, // VirtualKey.NumberPad8 -- 104
dludwig@8489
   150
    SDL_SCANCODE_KP_9, // VirtualKey.NumberPad9 -- 105
dludwig@8489
   151
    SDL_SCANCODE_KP_MULTIPLY, // VirtualKey.Multiply -- 106
dludwig@8489
   152
    SDL_SCANCODE_KP_PLUS, // VirtualKey.Add -- 107
dludwig@8489
   153
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Separator -- 108
dludwig@8489
   154
    SDL_SCANCODE_KP_MINUS, // VirtualKey.Subtract -- 109
dludwig@8489
   155
    SDL_SCANCODE_UNKNOWN, // VirtualKey.Decimal -- 110  (maybe SDL_SCANCODE_DECIMALSEPARATOR, SDL_SCANCODE_KP_DECIMAL, or SDL_SCANCODE_KP_PERIOD ?)
dludwig@8489
   156
    SDL_SCANCODE_KP_DIVIDE, // VirtualKey.Divide -- 111
dludwig@8489
   157
    SDL_SCANCODE_F1, // VirtualKey.F1 -- 112
dludwig@8489
   158
    SDL_SCANCODE_F2, // VirtualKey.F2 -- 113
dludwig@8489
   159
    SDL_SCANCODE_F3, // VirtualKey.F3 -- 114
dludwig@8489
   160
    SDL_SCANCODE_F4, // VirtualKey.F4 -- 115
dludwig@8489
   161
    SDL_SCANCODE_F5, // VirtualKey.F5 -- 116
dludwig@8489
   162
    SDL_SCANCODE_F6, // VirtualKey.F6 -- 117
dludwig@8489
   163
    SDL_SCANCODE_F7, // VirtualKey.F7 -- 118
dludwig@8489
   164
    SDL_SCANCODE_F8, // VirtualKey.F8 -- 119
dludwig@8489
   165
    SDL_SCANCODE_F9, // VirtualKey.F9 -- 120
dludwig@8489
   166
    SDL_SCANCODE_F10, // VirtualKey.F10 -- 121
dludwig@8489
   167
    SDL_SCANCODE_F11, // VirtualKey.F11 -- 122
dludwig@8489
   168
    SDL_SCANCODE_F12, // VirtualKey.F12 -- 123
dludwig@8489
   169
    SDL_SCANCODE_F13, // VirtualKey.F13 -- 124
dludwig@8489
   170
    SDL_SCANCODE_F14, // VirtualKey.F14 -- 125
dludwig@8489
   171
    SDL_SCANCODE_F15, // VirtualKey.F15 -- 126
dludwig@8489
   172
    SDL_SCANCODE_F16, // VirtualKey.F16 -- 127
dludwig@8489
   173
    SDL_SCANCODE_F17, // VirtualKey.F17 -- 128
dludwig@8489
   174
    SDL_SCANCODE_F18, // VirtualKey.F18 -- 129
dludwig@8489
   175
    SDL_SCANCODE_F19, // VirtualKey.F19 -- 130
dludwig@8489
   176
    SDL_SCANCODE_F20, // VirtualKey.F20 -- 131
dludwig@8489
   177
    SDL_SCANCODE_F21, // VirtualKey.F21 -- 132
dludwig@8489
   178
    SDL_SCANCODE_F22, // VirtualKey.F22 -- 133
dludwig@8489
   179
    SDL_SCANCODE_F23, // VirtualKey.F23 -- 134
dludwig@8489
   180
    SDL_SCANCODE_F24, // VirtualKey.F24 -- 135
dludwig@8489
   181
    SDL_SCANCODE_UNKNOWN, // -- 136
dludwig@8489
   182
    SDL_SCANCODE_UNKNOWN, // -- 137
dludwig@8489
   183
    SDL_SCANCODE_UNKNOWN, // -- 138
dludwig@8489
   184
    SDL_SCANCODE_UNKNOWN, // -- 139
dludwig@8489
   185
    SDL_SCANCODE_UNKNOWN, // -- 140
dludwig@8489
   186
    SDL_SCANCODE_UNKNOWN, // -- 141
dludwig@8489
   187
    SDL_SCANCODE_UNKNOWN, // -- 142
dludwig@8489
   188
    SDL_SCANCODE_UNKNOWN, // -- 143
dludwig@8489
   189
    SDL_SCANCODE_NUMLOCKCLEAR, // VirtualKey.NumberKeyLock -- 144
dludwig@8489
   190
    SDL_SCANCODE_SCROLLLOCK, // VirtualKey.Scroll -- 145
dludwig@8489
   191
    SDL_SCANCODE_UNKNOWN, // -- 146
dludwig@8489
   192
    SDL_SCANCODE_UNKNOWN, // -- 147
dludwig@8489
   193
    SDL_SCANCODE_UNKNOWN, // -- 148
dludwig@8489
   194
    SDL_SCANCODE_UNKNOWN, // -- 149
dludwig@8489
   195
    SDL_SCANCODE_UNKNOWN, // -- 150
dludwig@8489
   196
    SDL_SCANCODE_UNKNOWN, // -- 151
dludwig@8489
   197
    SDL_SCANCODE_UNKNOWN, // -- 152
dludwig@8489
   198
    SDL_SCANCODE_UNKNOWN, // -- 153
dludwig@8489
   199
    SDL_SCANCODE_UNKNOWN, // -- 154
dludwig@8489
   200
    SDL_SCANCODE_UNKNOWN, // -- 155
dludwig@8489
   201
    SDL_SCANCODE_UNKNOWN, // -- 156
dludwig@8489
   202
    SDL_SCANCODE_UNKNOWN, // -- 157
dludwig@8489
   203
    SDL_SCANCODE_UNKNOWN, // -- 158
dludwig@8489
   204
    SDL_SCANCODE_UNKNOWN, // -- 159
dludwig@8489
   205
    SDL_SCANCODE_LSHIFT, // VirtualKey.LeftShift -- 160
dludwig@8489
   206
    SDL_SCANCODE_RSHIFT, // VirtualKey.RightShift -- 161
dludwig@8489
   207
    SDL_SCANCODE_LCTRL, // VirtualKey.LeftControl -- 162
dludwig@8489
   208
    SDL_SCANCODE_RCTRL, // VirtualKey.RightControl -- 163
dludwig@8489
   209
    SDL_SCANCODE_MENU, // VirtualKey.LeftMenu -- 164
dludwig@8489
   210
    SDL_SCANCODE_MENU, // VirtualKey.RightMenu -- 165
dludwig@8489
   211
};
dludwig@8489
   212
dludwig@8489
   213
static std::unordered_map<int, SDL_Scancode> WinRT_Unofficial_Keycodes;
dludwig@8489
   214
dludwig@8489
   215
static SDL_Scancode
dludwig@8489
   216
TranslateKeycode(int keycode)
dludwig@8489
   217
{
dludwig@8489
   218
    if (WinRT_Unofficial_Keycodes.empty()) {
dludwig@8489
   219
        /* Set up a table of undocumented (by Microsoft), WinRT-specific,
dludwig@8489
   220
           key codes: */
dludwig@8489
   221
        // TODO, WinRT: move content declarations of WinRT_Unofficial_Keycodes into a C++11 initializer list, when possible
dludwig@8489
   222
        WinRT_Unofficial_Keycodes[220] = SDL_SCANCODE_GRAVE;
dludwig@8489
   223
        WinRT_Unofficial_Keycodes[222] = SDL_SCANCODE_BACKSLASH;
dludwig@8489
   224
    }
dludwig@8489
   225
dludwig@8489
   226
    /* Try to get a documented, WinRT, 'VirtualKey' first (as documented at
dludwig@8489
   227
       http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.virtualkey.aspx ).
dludwig@8489
   228
       If that fails, fall back to a Win32 virtual key.
dludwig@8489
   229
    */
dludwig@8489
   230
    // TODO, WinRT: try filling out the WinRT keycode table as much as possible, using the Win32 table for interpretation hints
dludwig@8489
   231
    //SDL_Log("WinRT TranslateKeycode, keycode=%d\n", (int)keycode);
dludwig@8489
   232
    SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
dludwig@8489
   233
    if (keycode < SDL_arraysize(WinRT_Official_Keycodes)) {
dludwig@8489
   234
        scancode = WinRT_Official_Keycodes[keycode];
dludwig@8489
   235
    }
dludwig@8489
   236
    if (scancode == SDL_SCANCODE_UNKNOWN) {
dludwig@8489
   237
        if (WinRT_Unofficial_Keycodes.find(keycode) != WinRT_Unofficial_Keycodes.end()) {
dludwig@8489
   238
            scancode = WinRT_Unofficial_Keycodes[keycode];
dludwig@8489
   239
        }
dludwig@8489
   240
    }
dludwig@8489
   241
    if (scancode == SDL_SCANCODE_UNKNOWN) {
dludwig@8489
   242
        if (keycode < SDL_arraysize(windows_scancode_table)) {
dludwig@8489
   243
            scancode = windows_scancode_table[keycode];
dludwig@8489
   244
        }
dludwig@8489
   245
    }
dludwig@8489
   246
    if (scancode == SDL_SCANCODE_UNKNOWN) {
dludwig@8489
   247
        SDL_Log("WinRT TranslateKeycode, unknown keycode=%d\n", (int)keycode);
dludwig@8489
   248
    }
dludwig@8489
   249
    return scancode;
dludwig@8489
   250
}
dludwig@8489
   251
dludwig@8489
   252
void
dludwig@8489
   253
WINRT_ProcessKeyDownEvent(Windows::UI::Core::KeyEventArgs ^args)
dludwig@8489
   254
{
dludwig@8489
   255
    SDL_Scancode sdlScancode = TranslateKeycode((int)args->VirtualKey);
dludwig@8489
   256
#if 0
dludwig@8489
   257
    SDL_Keycode keycode = SDL_GetKeyFromScancode(sdlScancode);
dludwig@8489
   258
    SDL_Log("key down, handled=%s, ext?=%s, released?=%s, menu key down?=%s, repeat count=%d, native scan code=%d, was down?=%s, vkey=%d, sdl scan code=%d (%s), sdl key code=%d (%s)\n",
dludwig@8489
   259
        (args->Handled ? "1" : "0"),
dludwig@8489
   260
        (args->KeyStatus.IsExtendedKey ? "1" : "0"),
dludwig@8489
   261
        (args->KeyStatus.IsKeyReleased ? "1" : "0"),
dludwig@8489
   262
        (args->KeyStatus.IsMenuKeyDown ? "1" : "0"),
dludwig@8489
   263
        args->KeyStatus.RepeatCount,
dludwig@8489
   264
        args->KeyStatus.ScanCode,
dludwig@8489
   265
        (args->KeyStatus.WasKeyDown ? "1" : "0"),
dludwig@8489
   266
        args->VirtualKey,
dludwig@8489
   267
        sdlScancode,
dludwig@8489
   268
        SDL_GetScancodeName(sdlScancode),
dludwig@8489
   269
        keycode,
dludwig@8489
   270
        SDL_GetKeyName(keycode));
dludwig@8489
   271
    //args->Handled = true;
dludwig@8489
   272
    //VirtualKey vkey = args->VirtualKey;
dludwig@8489
   273
#endif
dludwig@8489
   274
    SDL_SendKeyboardKey(SDL_PRESSED, sdlScancode);
dludwig@8489
   275
}
dludwig@8489
   276
dludwig@8489
   277
void
dludwig@8489
   278
WINRT_ProcessKeyUpEvent(Windows::UI::Core::KeyEventArgs ^args)
dludwig@8489
   279
{
dludwig@8489
   280
    SDL_Scancode sdlScancode = TranslateKeycode((int)args->VirtualKey);
dludwig@8489
   281
#if 0
dludwig@8489
   282
    SDL_Keycode keycode = SDL_GetKeyFromScancode(sdlScancode);
dludwig@8489
   283
    SDL_Log("key up, handled=%s, ext?=%s, released?=%s, menu key down?=%s, repeat count=%d, native scan code=%d, was down?=%s, vkey=%d, sdl scan code=%d (%s), sdl key code=%d (%s)\n",
dludwig@8489
   284
        (args->Handled ? "1" : "0"),
dludwig@8489
   285
        (args->KeyStatus.IsExtendedKey ? "1" : "0"),
dludwig@8489
   286
        (args->KeyStatus.IsKeyReleased ? "1" : "0"),
dludwig@8489
   287
        (args->KeyStatus.IsMenuKeyDown ? "1" : "0"),
dludwig@8489
   288
        args->KeyStatus.RepeatCount,
dludwig@8489
   289
        args->KeyStatus.ScanCode,
dludwig@8489
   290
        (args->KeyStatus.WasKeyDown ? "1" : "0"),
dludwig@8489
   291
        args->VirtualKey,
dludwig@8489
   292
        sdlScancode,
dludwig@8489
   293
        SDL_GetScancodeName(sdlScancode),
dludwig@8489
   294
        keycode,
dludwig@8489
   295
        SDL_GetKeyName(keycode));
dludwig@8489
   296
    //args->Handled = true;
dludwig@8489
   297
#endif
dludwig@8489
   298
    SDL_SendKeyboardKey(SDL_RELEASED, sdlScancode);
dludwig@8489
   299
}
dludwig@8489
   300
dludwig@8489
   301
#endif // SDL_VIDEO_DRIVER_WINRT