WinRT: hack-fixed a bug whereby SDL_UpdateWindowSurface would fail if the app was hidden, then re-shown

This commit is contained in:
David Ludwig
2013-01-22 22:36:32 -05:00
parent 4376678d59
commit 0634d6586e

View File

@@ -152,11 +152,21 @@ void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEven
{
m_windowVisible = args->Visible;
if (m_sdlWindowData) {
SDL_bool wasSDLWindowSurfaceValid = m_sdlWindowData->sdlWindow->surface_valid;
if (args->Visible) {
SDL_SendWindowEvent(m_sdlWindowData->sdlWindow, SDL_WINDOWEVENT_SHOWN, 0, 0);
} else {
SDL_SendWindowEvent(m_sdlWindowData->sdlWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0);
}
// HACK: Prevent SDL's window-hide handling code, which currently
// triggers a fake window resize (possibly erronously), from
// marking the SDL window's surface as invalid.
//
// A better solution to this probably involves figuring out if the
// fake window resize can be prevented.
m_sdlWindowData->sdlWindow->surface_valid = wasSDLWindowSurfaceValid;
}
}