1.1 --- a/src/core/winrt/SDL_winrtapp_direct3d.cpp Sat Mar 22 20:48:18 2014 -0400
1.2 +++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp Sat Mar 22 21:08:05 2014 -0400
1.3 @@ -173,6 +173,8 @@
1.4 static void
1.5 WINRT_ProcessWindowSizeChange()
1.6 {
1.7 + SDL_VideoDevice *_this = SDL_GetVideoDevice();
1.8 +
1.9 // Make the new window size be the one true fullscreen mode.
1.10 // This change was initially done, in part, to allow the Direct3D 11.1
1.11 // renderer to receive window-resize events as a device rotates.
1.12 @@ -192,31 +194,31 @@
1.13 // Make note of the old display mode, and it's old driverdata.
1.14 SDL_DisplayMode oldDisplayMode;
1.15 SDL_zero(oldDisplayMode);
1.16 - if (WINRT_GlobalSDLVideoDevice) {
1.17 - oldDisplayMode = WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode;
1.18 + if (_this) {
1.19 + oldDisplayMode = _this->displays[0].desktop_mode;
1.20 }
1.21
1.22 // Setup the new display mode in the appropriate spots.
1.23 - if (WINRT_GlobalSDLVideoDevice) {
1.24 + if (_this) {
1.25 // Make a full copy of the display mode for display_modes[0],
1.26 // one with with a separately malloced 'driverdata' field.
1.27 // SDL_VideoQuit(), if called, will attempt to free the driverdata
1.28 // fields in 'desktop_mode' and each entry in the 'display_modes'
1.29 // array.
1.30 - if (WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata) {
1.31 + if (_this->displays[0].display_modes[0].driverdata) {
1.32 // Free the previous mode's memory
1.33 - SDL_free(WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata);
1.34 - WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata = NULL;
1.35 + SDL_free(_this->displays[0].display_modes[0].driverdata);
1.36 + _this->displays[0].display_modes[0].driverdata = NULL;
1.37 }
1.38 - if (WINRT_DuplicateDisplayMode(&(WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0]), &newDisplayMode) != 0) {
1.39 + if (WINRT_DuplicateDisplayMode(&(_this->displays[0].display_modes[0]), &newDisplayMode) != 0) {
1.40 // Uh oh, something went wrong. A malloc call probably failed.
1.41 SDL_free(newDisplayMode.driverdata);
1.42 return;
1.43 }
1.44
1.45 // Install 'newDisplayMode' into 'current_mode' and 'desktop_mode'.
1.46 - WINRT_GlobalSDLVideoDevice->displays[0].current_mode = newDisplayMode;
1.47 - WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode = newDisplayMode;
1.48 + _this->displays[0].current_mode = newDisplayMode;
1.49 + _this->displays[0].desktop_mode = newDisplayMode;
1.50 }
1.51
1.52 if (WINRT_GlobalSDLWindow) {
2.1 --- a/src/video/winrt/SDL_winrtvideo.cpp Sat Mar 22 20:48:18 2014 -0400
2.2 +++ b/src/video/winrt/SDL_winrtvideo.cpp Sat Mar 22 21:08:05 2014 -0400
2.3 @@ -70,7 +70,6 @@
2.4
2.5 /* SDL-internal globals: */
2.6 SDL_Window * WINRT_GlobalSDLWindow = NULL;
2.7 -SDL_VideoDevice * WINRT_GlobalSDLVideoDevice = NULL;
2.8
2.9
2.10 /* WinRT driver bootstrap functions */
2.11 @@ -84,10 +83,6 @@
2.12 static void
2.13 WINRT_DeleteDevice(SDL_VideoDevice * device)
2.14 {
2.15 - if (device == WINRT_GlobalSDLVideoDevice) {
2.16 - WINRT_GlobalSDLVideoDevice = NULL;
2.17 - }
2.18 -
2.19 if (device->driverdata) {
2.20 SDL_VideoData * video_data = (SDL_VideoData *)device->driverdata;
2.21 if (video_data->winrtEglWindow) {
2.22 @@ -143,7 +138,6 @@
2.23 device->GL_DeleteContext = WINRT_GLES_DeleteContext;
2.24 #endif
2.25 device->free = WINRT_DeleteDevice;
2.26 - WINRT_GlobalSDLVideoDevice = device;
2.27
2.28 return device;
2.29 }
3.1 --- a/src/video/winrt/SDL_winrtvideo_cpp.h Sat Mar 22 20:48:18 2014 -0400
3.2 +++ b/src/video/winrt/SDL_winrtvideo_cpp.h Sat Mar 22 21:08:05 2014 -0400
3.3 @@ -48,9 +48,6 @@
3.4 */
3.5 extern SDL_Window * WINRT_GlobalSDLWindow;
3.6
3.7 -/* The global, WinRT, video device. */
3.8 -extern SDL_VideoDevice * WINRT_GlobalSDLVideoDevice;
3.9 -
3.10 /* Creates a display mode for Plain Direct3D (non-XAML) apps, using the lone, native window's settings.
3.11
3.12 Pass in an allocated SDL_DisplayMode field to store the data in.