Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
WinRT: explicitly allowed only one window at a time, pending multimon…
Browse files Browse the repository at this point in the history
…itor support (in SDL/WinRT)
  • Loading branch information
DavidLudwig committed Oct 29, 2012
1 parent fa5f072 commit 13c72d0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/video/windowsrt/SDL_WinRTApp.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/video/windowsrt/SDL_WinRTApp.h
Expand Up @@ -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:
Expand Down
14 changes: 11 additions & 3 deletions src/video/windowsrt/SDL_winrtvideo.cpp
Expand Up @@ -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));
Expand All @@ -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);
}
}


Expand Down

0 comments on commit 13c72d0

Please sign in to comment.