WinRT: moved the WinRT SDL_VideoDevice out of SDL_WinRTApp
authorDavid Ludwig <dludwig@pobox.com>
Tue, 27 Aug 2013 12:13:45 -0400
changeset 8498333ae9a0f411
parent 8497 103bb054aa7d
child 8499 00e397f1b7a8
WinRT: moved the WinRT SDL_VideoDevice out of SDL_WinRTApp
This was done to help pave the way for XAML support.
src/core/winrt/SDL_winrtapp.cpp
src/core/winrt/SDL_winrtapp.h
src/video/winrt/SDL_winrtvideo.cpp
     1.1 --- a/src/core/winrt/SDL_winrtapp.cpp	Tue Aug 27 11:51:17 2013 -0400
     1.2 +++ b/src/core/winrt/SDL_winrtapp.cpp	Tue Aug 27 12:13:45 2013 -0400
     1.3 @@ -40,6 +40,7 @@
     1.4  #include "SDL_winrtapp.h"
     1.5  
     1.6  extern SDL_Window * WINRT_GlobalSDLWindow;
     1.7 +extern SDL_VideoDevice * WINRT_GlobalSDLVideoDevice;
     1.8  
     1.9  
    1.10  // Compile-time debugging options:
    1.11 @@ -145,8 +146,7 @@
    1.12  
    1.13  SDL_WinRTApp::SDL_WinRTApp() :
    1.14      m_windowClosed(false),
    1.15 -    m_windowVisible(true),
    1.16 -    m_sdlVideoDevice(NULL)
    1.17 +    m_windowVisible(true)
    1.18  {
    1.19  }
    1.20  
    1.21 @@ -306,9 +306,9 @@
    1.22          // size, and the Direct3D 11.1 renderer wouldn't resize its swap
    1.23          // chain.
    1.24          SDL_DisplayMode resizedDisplayMode = CalcCurrentDisplayMode();
    1.25 -        m_sdlVideoDevice->displays[0].current_mode = resizedDisplayMode;
    1.26 -        m_sdlVideoDevice->displays[0].desktop_mode = resizedDisplayMode;
    1.27 -        m_sdlVideoDevice->displays[0].display_modes[0] = resizedDisplayMode;
    1.28 +        WINRT_GlobalSDLVideoDevice->displays[0].current_mode = resizedDisplayMode;
    1.29 +        WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode = resizedDisplayMode;
    1.30 +        WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0] = resizedDisplayMode;
    1.31  
    1.32          // Send the window-resize event to the rest of SDL, and to apps:
    1.33          const int windowWidth = (int) ceil(args->Size.Width);
    1.34 @@ -487,8 +487,3 @@
    1.35  
    1.36      return mode;
    1.37  }
    1.38 -
    1.39 -void SDL_WinRTApp::SetSDLVideoDevice(const SDL_VideoDevice * videoDevice)
    1.40 -{
    1.41 -    m_sdlVideoDevice = videoDevice;
    1.42 -}
     2.1 --- a/src/core/winrt/SDL_winrtapp.h	Tue Aug 27 11:51:17 2013 -0400
     2.2 +++ b/src/core/winrt/SDL_winrtapp.h	Tue Aug 27 12:13:45 2013 -0400
     2.3 @@ -16,7 +16,6 @@
     2.4      // SDL-specific methods
     2.5      SDL_DisplayMode CalcCurrentDisplayMode();
     2.6      void PumpEvents();
     2.7 -    void SetSDLVideoDevice(const SDL_VideoDevice * videoDevice);
     2.8      Windows::Foundation::Point TransformCursor(Windows::Foundation::Point rawPosition);
     2.9  
    2.10  protected:
    2.11 @@ -40,5 +39,4 @@
    2.12  private:
    2.13      bool m_windowClosed;
    2.14      bool m_windowVisible;
    2.15 -    const SDL_VideoDevice* m_sdlVideoDevice;
    2.16  };
     3.1 --- a/src/video/winrt/SDL_winrtvideo.cpp	Tue Aug 27 11:51:17 2013 -0400
     3.2 +++ b/src/video/winrt/SDL_winrtvideo.cpp	Tue Aug 27 12:13:45 2013 -0400
     3.3 @@ -79,6 +79,11 @@
     3.4  SDL_Window * WINRT_GlobalSDLWindow = NULL;
     3.5  
     3.6  
     3.7 +/* The global, WinRT, video device.
     3.8 +*/
     3.9 +SDL_VideoDevice * WINRT_GlobalSDLVideoDevice = NULL;
    3.10 +
    3.11 +
    3.12  /* WinRT driver bootstrap functions */
    3.13  
    3.14  static int
    3.15 @@ -90,7 +95,9 @@
    3.16  static void
    3.17  WINRT_DeleteDevice(SDL_VideoDevice * device)
    3.18  {
    3.19 -    SDL_WinRTGlobalApp->SetSDLVideoDevice(NULL);
    3.20 +    if (device == WINRT_GlobalSDLVideoDevice) {
    3.21 +        WINRT_GlobalSDLVideoDevice = NULL;
    3.22 +    }
    3.23      SDL_free(device);
    3.24  }
    3.25  
    3.26 @@ -118,7 +125,7 @@
    3.27      device->PumpEvents = WINRT_PumpEvents;
    3.28      device->GetWindowWMInfo = WINRT_GetWindowWMInfo;
    3.29      device->free = WINRT_DeleteDevice;
    3.30 -    SDL_WinRTGlobalApp->SetSDLVideoDevice(device);
    3.31 +    WINRT_GlobalSDLVideoDevice = NULL;
    3.32  
    3.33      return device;
    3.34  }