src/video/winrt/SDL_winrtvideo.cpp
author David Ludwig <dludwig@pobox.com>
Sat, 01 Mar 2014 16:08:16 -0500
changeset 8578 6517b6aca713
parent 8574 bf4991b6a4ec
child 8579 ee7126c459d0
permissions -rw-r--r--
WinRT: fixed a crash in SDL_Quit

SDL was expected that each SDL_DisplayMode had a driverdata field that was SDL_malloc'ed, and was calling SDL_free on them. This change moves WinRT's driverdata content into a SDL_malloc'ed field.
dludwig@8327
     1
/*
dludwig@8327
     2
  Simple DirectMedia Layer
dludwig@8327
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
dludwig@8327
     4
dludwig@8327
     5
  This software is provided 'as-is', without any express or implied
dludwig@8327
     6
  warranty.  In no event will the authors be held liable for any damages
dludwig@8327
     7
  arising from the use of this software.
dludwig@8327
     8
dludwig@8327
     9
  Permission is granted to anyone to use this software for any purpose,
dludwig@8327
    10
  including commercial applications, and to alter it and redistribute it
dludwig@8327
    11
  freely, subject to the following restrictions:
dludwig@8327
    12
dludwig@8327
    13
  1. The origin of this software must not be misrepresented; you must not
dludwig@8327
    14
     claim that you wrote the original software. If you use this software
dludwig@8327
    15
     in a product, an acknowledgment in the product documentation would be
dludwig@8327
    16
     appreciated but is not required.
dludwig@8327
    17
  2. Altered source versions must be plainly marked as such, and must not be
dludwig@8327
    18
     misrepresented as being the original software.
dludwig@8327
    19
  3. This notice may not be removed or altered from any source distribution.
dludwig@8327
    20
*/
dludwig@8327
    21
#include "SDL_config.h"
dludwig@8327
    22
dludwig@8327
    23
#if SDL_VIDEO_DRIVER_WINRT
dludwig@8327
    24
dludwig@8327
    25
/* WinRT SDL video driver implementation
dludwig@8327
    26
dludwig@8327
    27
   Initial work on this was done by David Ludwig (dludwig@pobox.com), and
dludwig@8327
    28
   was based off of SDL's "dummy" video driver.
dludwig@8327
    29
 */
dludwig@8327
    30
dludwig@8494
    31
/* Windows includes */
dludwig@8494
    32
#include <agile.h>
dludwig@8494
    33
using namespace Windows::UI::Core;
dludwig@8494
    34
dludwig@8494
    35
dludwig@8494
    36
/* SDL includes */
dludwig@8329
    37
extern "C" {
dludwig@8327
    38
#include "SDL_video.h"
dludwig@8327
    39
#include "SDL_mouse.h"
dludwig@8327
    40
#include "../SDL_sysvideo.h"
dludwig@8327
    41
#include "../SDL_pixels_c.h"
dludwig@8327
    42
#include "../../events/SDL_events_c.h"
dludwig@8400
    43
#include "../../render/SDL_sysrender.h"
dludwig@8411
    44
#include "SDL_syswm.h"
dludwig@8541
    45
#include "SDL_winrtopengles.h"
dludwig@8329
    46
}
dludwig@8327
    47
dludwig@8522
    48
#include "../../core/winrt/SDL_winrtapp_direct3d.h"
dludwig@8522
    49
#include "../../core/winrt/SDL_winrtapp_xaml.h"
dludwig@8512
    50
#include "SDL_winrtvideo_cpp.h"
dludwig@8327
    51
#include "SDL_winrtevents_c.h"
dludwig@8516
    52
#include "SDL_winrtmouse_c.h"
dludwig@8505
    53
#include "SDL_main.h"
dludwig@8505
    54
#include "SDL_system.h"
dludwig@8327
    55
dludwig@8327
    56
dludwig@8327
    57
/* Initialization/Query functions */
dludwig@8327
    58
static int WINRT_VideoInit(_THIS);
dludwig@8374
    59
static int WINRT_InitModes(_THIS);
dludwig@8327
    60
static int WINRT_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
dludwig@8327
    61
static void WINRT_VideoQuit(_THIS);
dludwig@8327
    62
dludwig@8494
    63
dludwig@8333
    64
/* Window functions */
dludwig@8522
    65
static int WINRT_CreateWindow(_THIS, SDL_Window * window);
dludwig@8333
    66
static void WINRT_DestroyWindow(_THIS, SDL_Window * window);
dludwig@8411
    67
static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
dludwig@8333
    68
dludwig@8494
    69
dludwig@8515
    70
/* SDL-internal globals: */
dludwig@8497
    71
SDL_Window * WINRT_GlobalSDLWindow = NULL;
dludwig@8498
    72
SDL_VideoDevice * WINRT_GlobalSDLVideoDevice = NULL;
dludwig@8498
    73
dludwig@8498
    74
dludwig@8327
    75
/* WinRT driver bootstrap functions */
dludwig@8327
    76
dludwig@8327
    77
static int
dludwig@8327
    78
WINRT_Available(void)
dludwig@8327
    79
{
dludwig@8328
    80
    return (1);
dludwig@8327
    81
}
dludwig@8327
    82
dludwig@8327
    83
static void
dludwig@8327
    84
WINRT_DeleteDevice(SDL_VideoDevice * device)
dludwig@8327
    85
{
dludwig@8498
    86
    if (device == WINRT_GlobalSDLVideoDevice) {
dludwig@8498
    87
        WINRT_GlobalSDLVideoDevice = NULL;
dludwig@8498
    88
    }
dludwig@8327
    89
    SDL_free(device);
dludwig@8327
    90
}
dludwig@8327
    91
dludwig@8327
    92
static SDL_VideoDevice *
dludwig@8327
    93
WINRT_CreateDevice(int devindex)
dludwig@8327
    94
{
dludwig@8327
    95
    SDL_VideoDevice *device;
dludwig@8327
    96
dludwig@8327
    97
    /* Initialize all variables that we clean on shutdown */
dludwig@8327
    98
    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
dludwig@8327
    99
    if (!device) {
dludwig@8327
   100
        SDL_OutOfMemory();
dludwig@8327
   101
        if (device) {
dludwig@8327
   102
            SDL_free(device);
dludwig@8327
   103
        }
dludwig@8327
   104
        return (0);
dludwig@8327
   105
    }
dludwig@8327
   106
dludwig@8327
   107
    /* Set the function pointers */
dludwig@8327
   108
    device->VideoInit = WINRT_VideoInit;
dludwig@8327
   109
    device->VideoQuit = WINRT_VideoQuit;
dludwig@8333
   110
    device->CreateWindow = WINRT_CreateWindow;
dludwig@8333
   111
    device->DestroyWindow = WINRT_DestroyWindow;
dludwig@8327
   112
    device->SetDisplayMode = WINRT_SetDisplayMode;
dludwig@8327
   113
    device->PumpEvents = WINRT_PumpEvents;
dludwig@8411
   114
    device->GetWindowWMInfo = WINRT_GetWindowWMInfo;
dludwig@8541
   115
#ifdef SDL_VIDEO_OPENGL_EGL
dludwig@8541
   116
    device->GL_LoadLibrary = WINRT_GLES_LoadLibrary;
dludwig@8541
   117
    device->GL_GetProcAddress = WINRT_GLES_GetProcAddress;
dludwig@8541
   118
    device->GL_UnloadLibrary = WINRT_GLES_UnloadLibrary;
dludwig@8541
   119
    device->GL_CreateContext = WINRT_GLES_CreateContext;
dludwig@8541
   120
    device->GL_MakeCurrent = WINRT_GLES_MakeCurrent;
dludwig@8541
   121
    device->GL_SetSwapInterval = WINRT_GLES_SetSwapInterval;
dludwig@8541
   122
    device->GL_GetSwapInterval = WINRT_GLES_GetSwapInterval;
dludwig@8541
   123
    device->GL_SwapWindow = WINRT_GLES_SwapWindow;
dludwig@8541
   124
    device->GL_DeleteContext = WINRT_GLES_DeleteContext;
dludwig@8541
   125
#endif
dludwig@8433
   126
    device->free = WINRT_DeleteDevice;
dludwig@8501
   127
    WINRT_GlobalSDLVideoDevice = device;
dludwig@8327
   128
dludwig@8327
   129
    return device;
dludwig@8327
   130
}
dludwig@8327
   131
dludwig@8494
   132
#define WINRTVID_DRIVER_NAME "winrt"
dludwig@8327
   133
VideoBootStrap WINRT_bootstrap = {
dludwig@8500
   134
    WINRTVID_DRIVER_NAME, "SDL WinRT video driver",
dludwig@8327
   135
    WINRT_Available, WINRT_CreateDevice
dludwig@8327
   136
};
dludwig@8327
   137
dludwig@8327
   138
int
dludwig@8327
   139
WINRT_VideoInit(_THIS)
dludwig@8327
   140
{
dludwig@8374
   141
    if (WINRT_InitModes(_this) < 0) {
dludwig@8374
   142
        return -1;
dludwig@8374
   143
    }
dludwig@8374
   144
    WINRT_InitMouse(_this);
dludwig@8515
   145
    WINRT_InitTouch(_this);
dludwig@8522
   146
dludwig@8374
   147
    return 0;
dludwig@8374
   148
}
dludwig@8374
   149
dludwig@8578
   150
int
dludwig@8578
   151
WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)
dludwig@8522
   152
{
dludwig@8578
   153
    SDL_DisplayModeData * driverdata;
dludwig@8578
   154
dludwig@8522
   155
    using namespace Windows::Graphics::Display;
dludwig@8522
   156
dludwig@8578
   157
    // Initialize the mode to all zeros:
dludwig@8578
   158
    SDL_zerop(mode);
dludwig@8522
   159
dludwig@8522
   160
    // Go no further if a native window cannot be accessed.  This can happen,
dludwig@8522
   161
    // for example, if this function is called from certain threads, such as
dludwig@8522
   162
    // the SDL/XAML thread.
dludwig@8522
   163
    if (!CoreWindow::GetForCurrentThread()) {
dludwig@8578
   164
        return SDL_SetError("SDL/WinRT display modes cannot be calculated outside of the main thread, such as in SDL's XAML thread");
dludwig@8522
   165
    }
dludwig@8522
   166
dludwig@8578
   167
    // Create a driverdata field:
dludwig@8578
   168
    driverdata = (SDL_DisplayModeData *) SDL_malloc(sizeof(*driverdata));
dludwig@8578
   169
    if (!driverdata) {
dludwig@8578
   170
        return SDL_OutOfMemory();
dludwig@8578
   171
    }
dludwig@8578
   172
    SDL_zerop(driverdata);
dludwig@8578
   173
dludwig@8522
   174
    // Fill in most fields:
dludwig@8578
   175
    mode->format = SDL_PIXELFORMAT_RGB888;
dludwig@8578
   176
    mode->refresh_rate = 0;  // TODO, WinRT: see if refresh rate data is available, or relevant (for WinRT apps)
dludwig@8578
   177
    mode->driverdata = driverdata;
dludwig@8578
   178
    driverdata->currentOrientation = DisplayProperties::CurrentOrientation;
dludwig@8522
   179
dludwig@8522
   180
    // Calculate the display size given the window size, taking into account
dludwig@8522
   181
    // the current display's DPI:
dludwig@8522
   182
    const float currentDPI = Windows::Graphics::Display::DisplayProperties::LogicalDpi; 
dludwig@8522
   183
    const float dipsPerInch = 96.0f;
dludwig@8578
   184
    mode->w = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Width * currentDPI) / dipsPerInch);
dludwig@8578
   185
    mode->h = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Height * currentDPI) / dipsPerInch);
dludwig@8522
   186
dludwig@8522
   187
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
dludwig@8522
   188
    // On Windows Phone, the native window's size is always in portrait,
dludwig@8522
   189
    // regardless of the device's orientation.  This is in contrast to
dludwig@8522
   190
    // Windows 8/RT, which will resize the native window as the device's
dludwig@8522
   191
    // orientation changes.  In order to compensate for this behavior,
dludwig@8522
   192
    // on Windows Phone, the mode's width and height will be swapped when
dludwig@8522
   193
    // the device is in a landscape (non-portrait) mode.
dludwig@8522
   194
    switch (DisplayProperties::CurrentOrientation) {
dludwig@8522
   195
        case DisplayOrientations::Landscape:
dludwig@8522
   196
        case DisplayOrientations::LandscapeFlipped:
dludwig@8522
   197
        {
dludwig@8578
   198
            const int tmp = mode->h;
dludwig@8578
   199
            mode->h = mode->w;
dludwig@8578
   200
            mode->w = tmp;
dludwig@8522
   201
            break;
dludwig@8522
   202
        }
dludwig@8522
   203
dludwig@8522
   204
        default:
dludwig@8522
   205
            break;
dludwig@8522
   206
    }
dludwig@8522
   207
#endif
dludwig@8522
   208
dludwig@8578
   209
    return 0;
dludwig@8578
   210
}
dludwig@8578
   211
dludwig@8578
   212
int
dludwig@8578
   213
WINRT_DuplicateDisplayMode(SDL_DisplayMode * dest, const SDL_DisplayMode * src)
dludwig@8578
   214
{
dludwig@8578
   215
    SDL_DisplayModeData * driverdata;
dludwig@8578
   216
    driverdata = (SDL_DisplayModeData *) SDL_malloc(sizeof(*driverdata));
dludwig@8578
   217
    if (!driverdata) {
dludwig@8578
   218
        return SDL_OutOfMemory();
dludwig@8578
   219
    }
dludwig@8578
   220
    SDL_memcpy(driverdata, src->driverdata, sizeof(SDL_DisplayModeData));
dludwig@8578
   221
    SDL_memcpy(dest, src, sizeof(SDL_DisplayMode));
dludwig@8578
   222
    dest->driverdata = driverdata;
dludwig@8578
   223
    return 0;
dludwig@8522
   224
}
dludwig@8503
   225
dludwig@8505
   226
int
dludwig@8374
   227
WINRT_InitModes(_THIS)
dludwig@8374
   228
{
dludwig@8505
   229
    // Retrieve the display mode:
dludwig@8578
   230
    SDL_DisplayMode mode, desktop_mode;
dludwig@8578
   231
    if (WINRT_CalcDisplayModeUsingNativeWindow(&mode) != 0) {
dludwig@8578
   232
        return -1;	// If WINRT_CalcDisplayModeUsingNativeWindow fails, it'll already have set the SDL error
dludwig@8578
   233
    }
dludwig@8578
   234
    
dludwig@8522
   235
    if (mode.w == 0 || mode.h == 0) {
dludwig@8578
   236
        SDL_free(mode.driverdata);
dludwig@8522
   237
        return SDL_SetError("Unable to calculate the WinRT window/display's size");
dludwig@8522
   238
    }
dludwig@8522
   239
dludwig@8578
   240
    if (WINRT_DuplicateDisplayMode(&desktop_mode, &mode) != 0) {
dludwig@8578
   241
        return -1;
dludwig@8578
   242
    }
dludwig@8578
   243
    if (SDL_AddBasicVideoDisplay(&desktop_mode) < 0) {
dludwig@8522
   244
        return -1;
dludwig@8374
   245
    }
dludwig@8374
   246
dludwig@8374
   247
    SDL_AddDisplayMode(&_this->displays[0], &mode);
dludwig@8327
   248
    return 0;
dludwig@8327
   249
}
dludwig@8327
   250
dludwig@8327
   251
static int
dludwig@8327
   252
WINRT_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
dludwig@8327
   253
{
dludwig@8327
   254
    return 0;
dludwig@8327
   255
}
dludwig@8327
   256
dludwig@8327
   257
void
dludwig@8327
   258
WINRT_VideoQuit(_THIS)
dludwig@8327
   259
{
dludwig@8374
   260
    WINRT_QuitMouse(_this);
dludwig@8327
   261
}
dludwig@8327
   262
dludwig@8522
   263
int
dludwig@8522
   264
WINRT_CreateWindow(_THIS, SDL_Window * window)
dludwig@8522
   265
{
dludwig@8522
   266
    // Make sure that only one window gets created, at least until multimonitor
dludwig@8522
   267
    // support is added.
dludwig@8522
   268
    if (WINRT_GlobalSDLWindow != NULL) {
dludwig@8522
   269
        SDL_SetError("WinRT only supports one window");
dludwig@8522
   270
        return -1;
dludwig@8522
   271
    }
dludwig@8522
   272
dludwig@8522
   273
    SDL_WindowData *data = new SDL_WindowData;
dludwig@8522
   274
    if (!data) {
dludwig@8522
   275
        SDL_OutOfMemory();
dludwig@8522
   276
        return -1;
dludwig@8522
   277
    }
dludwig@8522
   278
    window->driverdata = data;
dludwig@8522
   279
    data->sdlWindow = window;
dludwig@8522
   280
dludwig@8522
   281
    /* To note, when XAML support is enabled, access to the CoreWindow will not
dludwig@8522
   282
       be possible, at least not via the SDL/XAML thread.  Attempts to access it
dludwig@8522
   283
       from there will throw exceptions.  As such, the SDL_WindowData's
dludwig@8522
   284
       'coreWindow' field will only be set (to a non-null value) if XAML isn't
dludwig@8522
   285
       enabled.
dludwig@8522
   286
    */
dludwig@8522
   287
    if (!WINRT_XAMLWasEnabled) {
dludwig@8522
   288
        data->coreWindow = CoreWindow::GetForCurrentThread();
dludwig@8522
   289
    }
dludwig@8522
   290
dludwig@8541
   291
#if SDL_VIDEO_OPENGL_EGL
dludwig@8541
   292
    /* Setup the EGL surface, but only if OpenGL ES 2 was requested. */
dludwig@8541
   293
    if (!(window->flags & SDL_WINDOW_OPENGL)) {
dludwig@8541
   294
        /* OpenGL ES 2 wasn't requested.  Don't set up an EGL surface. */
dludwig@8541
   295
        data->egl_surface = EGL_NO_SURFACE;
dludwig@8541
   296
    } else {
dludwig@8541
   297
        /* OpenGL ES 2 was reuqested.  Set up an EGL surface. */
dludwig@8572
   298
dludwig@8572
   299
        /* HACK: ANGLE/WinRT currently uses non-pointer, C++ objects to represent
dludwig@8572
   300
           native windows.  The object only contains a single pointer to a COM
dludwig@8572
   301
           interface pointer, which on x86 appears to be castable to the object
dludwig@8572
   302
           without apparant problems.  On other platforms, notable ARM and x64,
dludwig@8572
   303
           doing so will cause a crash.  To avoid this crash, we'll bypass
dludwig@8572
   304
           SDL's normal call to eglCreateWindowSurface, which is invoked from C
dludwig@8572
   305
           code, and call it here, where an appropriate C++ object may be
dludwig@8572
   306
           passed in.
dludwig@8572
   307
         */
dludwig@8572
   308
        typedef EGLSurface (*eglCreateWindowSurfaceFunction)(EGLDisplay dpy, EGLConfig config,
dludwig@8572
   309
            Microsoft::WRL::ComPtr<IUnknown> win,
dludwig@8572
   310
            const EGLint *attrib_list);
dludwig@8572
   311
        eglCreateWindowSurfaceFunction WINRT_eglCreateWindowSurface =
dludwig@8572
   312
            (eglCreateWindowSurfaceFunction) _this->egl_data->eglCreateWindowSurface;
dludwig@8572
   313
dludwig@8572
   314
        Microsoft::WRL::ComPtr<IUnknown> nativeWindow = reinterpret_cast<IUnknown *>(data->coreWindow.Get());
dludwig@8572
   315
        data->egl_surface = WINRT_eglCreateWindowSurface(
dludwig@8572
   316
            _this->egl_data->egl_display,
dludwig@8572
   317
            _this->egl_data->egl_config,
dludwig@8572
   318
            nativeWindow, NULL);
dludwig@8541
   319
        if (data->egl_surface == NULL) {
dludwig@8574
   320
            // TODO, WinRT: see if eglCreateWindowSurface, or its callee(s), sets an error message.  If so, attach it to the SDL error.
dludwig@8574
   321
            return SDL_SetError("eglCreateWindowSurface failed");
dludwig@8541
   322
        }
dludwig@8541
   323
    }
dludwig@8541
   324
#endif
dludwig@8541
   325
dludwig@8522
   326
    /* Make sure the window is considered to be positioned at {0,0},
dludwig@8522
   327
       and is considered fullscreen, shown, and the like.
dludwig@8522
   328
    */
dludwig@8522
   329
    window->x = 0;
dludwig@8522
   330
    window->y = 0;
dludwig@8522
   331
    window->flags =
dludwig@8522
   332
        SDL_WINDOW_FULLSCREEN |
dludwig@8522
   333
        SDL_WINDOW_SHOWN |
dludwig@8522
   334
        SDL_WINDOW_BORDERLESS |
dludwig@8522
   335
        SDL_WINDOW_MAXIMIZED |
dludwig@8522
   336
        SDL_WINDOW_INPUT_GRABBED;
dludwig@8522
   337
dludwig@8541
   338
#if SDL_VIDEO_OPENGL_EGL
dludwig@8541
   339
    if (data->egl_surface) {
dludwig@8541
   340
        window->flags |= SDL_WINDOW_OPENGL;
dludwig@8541
   341
    }
dludwig@8541
   342
#endif
dludwig@8541
   343
dludwig@8522
   344
    /* WinRT does not, as of this writing, appear to support app-adjustable
dludwig@8522
   345
       window sizes.  Set the window size to whatever the native WinRT
dludwig@8522
   346
       CoreWindow is set at.
dludwig@8522
   347
dludwig@8522
   348
       TODO, WinRT: if and when non-fullscreen XAML control support is added to SDL, consider making those resizable via SDL_Window's interfaces.
dludwig@8522
   349
    */
dludwig@8522
   350
    window->w = _this->displays[0].current_mode.w;
dludwig@8522
   351
    window->h = _this->displays[0].current_mode.h;
dludwig@8551
   352
dludwig@8551
   353
    /* For now, treat WinRT apps as if they always have focus.
dludwig@8551
   354
       TODO, WinRT: try tracking keyboard and mouse focus state with respect to snapped apps
dludwig@8551
   355
     */
dludwig@8551
   356
    SDL_SetMouseFocus(window);
dludwig@8551
   357
    SDL_SetKeyboardFocus(window);
dludwig@8522
   358
 
dludwig@8522
   359
    /* Make sure the WinRT app's IFramworkView can post events on
dludwig@8522
   360
       behalf of SDL:
dludwig@8522
   361
    */
dludwig@8522
   362
    WINRT_GlobalSDLWindow = window;
dludwig@8522
   363
dludwig@8522
   364
    /* All done! */
dludwig@8522
   365
    return 0;
dludwig@8522
   366
}
dludwig@8522
   367
dludwig@8333
   368
void
dludwig@8333
   369
WINRT_DestroyWindow(_THIS, SDL_Window * window)
dludwig@8333
   370
{
dludwig@8411
   371
    SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
dludwig@8411
   372
dludwig@8497
   373
    if (WINRT_GlobalSDLWindow == window) {
dludwig@8497
   374
        WINRT_GlobalSDLWindow = NULL;
dludwig@8424
   375
    }
dludwig@8424
   376
dludwig@8411
   377
    if (data) {
dludwig@8411
   378
        // Delete the internal window data:
dludwig@8411
   379
        delete data;
dludwig@8411
   380
        data = NULL;
dludwig@8411
   381
    }
dludwig@8333
   382
}
dludwig@8333
   383
dludwig@8522
   384
SDL_bool
dludwig@8522
   385
WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
dludwig@8522
   386
{
dludwig@8522
   387
    SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
dludwig@8522
   388
dludwig@8522
   389
    if (info->version.major <= SDL_MAJOR_VERSION) {
dludwig@8522
   390
        info->subsystem = SDL_SYSWM_WINRT;
dludwig@8527
   391
        info->info.winrt.window = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
dludwig@8522
   392
        return SDL_TRUE;
dludwig@8522
   393
    } else {
dludwig@8522
   394
        SDL_SetError("Application not compiled with SDL %d.%d\n",
dludwig@8522
   395
                     SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
dludwig@8522
   396
        return SDL_FALSE;
dludwig@8522
   397
    }
dludwig@8522
   398
    return SDL_FALSE;
dludwig@8411
   399
}
dludwig@8333
   400
dludwig@8327
   401
#endif /* SDL_VIDEO_DRIVER_WINRT */
dludwig@8327
   402
dludwig@8327
   403
/* vi: set ts=4 sw=4 expandtab: */