Fixed SDL video init for linux, force window to be reshown after calling SDL_DestroyWindow as the destroy calls hide.

This commit is contained in:
mjbudd77 2021-06-11 14:55:49 -04:00
parent cdf2f1e150
commit 2861067933
1 changed files with 7 additions and 8 deletions

View File

@ -239,18 +239,10 @@ int ConsoleViewSDL_t::init(void)
windowHandle = this->winId(); windowHandle = this->winId();
//printf("Window Handle: %llu \n", windowHandle );
//sleep(1);
#ifdef WIN32
if (sdlWindow == NULL) if (sdlWindow == NULL)
{ {
sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle); sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle);
} }
#else
sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle);
#endif
if (sdlWindow == NULL) if (sdlWindow == NULL)
{ {
@ -258,6 +250,8 @@ int ConsoleViewSDL_t::init(void)
return -1; return -1;
} }
SDL_ShowWindow( sdlWindow );
uint32_t baseFlags = vsyncEnabled ? SDL_RENDERER_PRESENTVSYNC : 0; uint32_t baseFlags = vsyncEnabled ? SDL_RENDERER_PRESENTVSYNC : 0;
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, baseFlags | SDL_RENDERER_ACCELERATED); sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, baseFlags | SDL_RENDERER_ACCELERATED);
@ -304,6 +298,11 @@ void ConsoleViewSDL_t::cleanup(void)
SDL_DestroyRenderer(sdlRenderer); SDL_DestroyRenderer(sdlRenderer);
sdlRenderer = NULL; sdlRenderer = NULL;
} }
if ( sdlWindow )
{
SDL_DestroyWindow( sdlWindow );
sdlWindow = NULL;
}
} }
void ConsoleViewSDL_t::reset(void) void ConsoleViewSDL_t::reset(void)