WinRT: explicitly allowed only one window at a time, pending multimonitor support (in SDL/WinRT)
authorDavid Ludwig <dludwig@pobox.com>
Sun, 28 Oct 2012 23:20:18 -0400
changeset 833409b0670fece4
parent 8333 49973bfb8d23
child 8335 4f41add2ff00
WinRT: explicitly allowed only one window at a time, pending multimonitor support (in SDL/WinRT)
src/video/windowsrt/SDL_WinRTApp.cpp
src/video/windowsrt/SDL_WinRTApp.h
src/video/windowsrt/SDL_winrtvideo.cpp
     1.1 --- a/src/video/windowsrt/SDL_WinRTApp.cpp	Sun Oct 28 23:01:31 2012 -0400
     1.2 +++ b/src/video/windowsrt/SDL_WinRTApp.cpp	Sun Oct 28 23:20:18 2012 -0400
     1.3 @@ -198,6 +198,11 @@
     1.4      return mode;
     1.5  }
     1.6  
     1.7 +bool SDL_WinRTApp::HasSDLWindowData() const
     1.8 +{
     1.9 +    return (m_sdlWindowData != NULL);
    1.10 +}
    1.11 +
    1.12  void SDL_WinRTApp::SetSDLWindowData(const SDL_WindowData* windowData)
    1.13  {
    1.14      m_sdlWindowData = windowData;
     2.1 --- a/src/video/windowsrt/SDL_WinRTApp.h	Sun Oct 28 23:01:31 2012 -0400
     2.2 +++ b/src/video/windowsrt/SDL_WinRTApp.h	Sun Oct 28 23:20:18 2012 -0400
     2.3 @@ -23,6 +23,7 @@
     2.4      // SDL-specific methods
     2.5      SDL_DisplayMode GetMainDisplayMode();
     2.6      void PumpEvents();
     2.7 +    bool HasSDLWindowData() const;
     2.8      void SetSDLWindowData(const SDL_WindowData* windowData);
     2.9  
    2.10  protected:
     3.1 --- a/src/video/windowsrt/SDL_winrtvideo.cpp	Sun Oct 28 23:01:31 2012 -0400
     3.2 +++ b/src/video/windowsrt/SDL_winrtvideo.cpp	Sun Oct 28 23:20:18 2012 -0400
     3.3 @@ -137,8 +137,13 @@
     3.4  int
     3.5  WINRT_CreateWindow(_THIS, SDL_Window * window)
     3.6  {
     3.7 -    // TODO, WinRT: modify WINRT_Createwindow to ensure that, for now, only one window gets created
     3.8 -    // (until multimonitor support is added to the WinRT port).
     3.9 +    // Make sure that only one window gets created, at least until multimonitor
    3.10 +    // support is added.
    3.11 +    if (SDL_WinRTGlobalApp->HasSDLWindowData())
    3.12 +    {
    3.13 +        SDL_SetError("WinRT only supports one window");
    3.14 +        return -1;
    3.15 +    }
    3.16  
    3.17      SDL_WindowData *data;
    3.18      data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
    3.19 @@ -163,7 +168,10 @@
    3.20  void
    3.21  WINRT_DestroyWindow(_THIS, SDL_Window * window)
    3.22  {
    3.23 -    SDL_WinRTGlobalApp->SetSDLWindowData(NULL);
    3.24 +    if (SDL_WinRTGlobalApp->HasSDLWindowData())
    3.25 +    {
    3.26 +        SDL_WinRTGlobalApp->SetSDLWindowData(NULL);
    3.27 +    }
    3.28  }
    3.29  
    3.30