WinRT: explicitly allowed only one window at a time, pending multimonitor support (in SDL/WinRT)

This commit is contained in:
David Ludwig 2012-10-28 23:20:18 -04:00
parent 62d66e244e
commit 63cedf50fe
3 changed files with 17 additions and 3 deletions

View File

@ -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;

View File

@ -23,6 +23,7 @@ internal:
// SDL-specific methods
SDL_DisplayMode GetMainDisplayMode();
void PumpEvents();
bool HasSDLWindowData() const;
void SetSDLWindowData(const SDL_WindowData* windowData);
protected:

View File

@ -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);
}
}