Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

WinRT: explicitly allowed only one window at a time, pending multimon…

…itor support (in SDL/WinRT)
  • Loading branch information
DavidLudwig committed Oct 29, 2012
1 parent fa5f072 commit 13c72d0e1fbbf28e7518fb8f7a79e0a292296adf
@@ -198,6 +198,11 @@ SDL_DisplayMode SDL_WinRTApp::GetMainDisplayMode()
return mode;
}

bool SDL_WinRTApp::HasSDLWindowData() const
{
return (m_sdlWindowData != NULL);
}

void SDL_WinRTApp::SetSDLWindowData(const SDL_WindowData* windowData)
{
m_sdlWindowData = windowData;
@@ -23,6 +23,7 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo
// SDL-specific methods
SDL_DisplayMode GetMainDisplayMode();
void PumpEvents();
bool HasSDLWindowData() const;
void SetSDLWindowData(const SDL_WindowData* windowData);

protected:
@@ -137,8 +137,13 @@ WINRT_VideoQuit(_THIS)
int
WINRT_CreateWindow(_THIS, SDL_Window * window)
{
// TODO, WinRT: modify WINRT_Createwindow to ensure that, for now, only one window gets created
// (until multimonitor support is added to the WinRT port).
// Make sure that only one window gets created, at least until multimonitor
// support is added.
if (SDL_WinRTGlobalApp->HasSDLWindowData())
{
SDL_SetError("WinRT only supports one window");
return -1;
}

SDL_WindowData *data;
data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
@@ -163,7 +168,10 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
void
WINRT_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WinRTGlobalApp->SetSDLWindowData(NULL);
if (SDL_WinRTGlobalApp->HasSDLWindowData())
{
SDL_WinRTGlobalApp->SetSDLWindowData(NULL);
}
}


0 comments on commit 13c72d0

Please sign in to comment.