1
0
Fork 0

(svn r18547) -Fix [FS#3388]: missing thread synchronisation when changing the resolution for SDL via the in game menu

release/1.0
rubidium 2009-12-19 19:29:01 +00:00
parent a6146f5f51
commit c811f3bd21
1 changed files with 6 additions and 3 deletions

View File

@ -469,7 +469,7 @@ static int PollEvent()
case SDL_VIDEORESIZE: { case SDL_VIDEORESIZE: {
int w = max(ev.resize.w, 64); int w = max(ev.resize.w, 64);
int h = max(ev.resize.h, 64); int h = max(ev.resize.h, 64);
ChangeResInGame(w, h); CreateMainSurface(w, h);
break; break;
} }
} }
@ -627,14 +627,17 @@ void VideoDriver_SDL::MainLoop()
bool VideoDriver_SDL::ChangeResolution(int w, int h) bool VideoDriver_SDL::ChangeResolution(int w, int h)
{ {
return CreateMainSurface(w, h); if (_draw_threaded) _draw_mutex->BeginCritical();
bool ret = CreateMainSurface(w, h);
if (_draw_threaded) _draw_mutex->EndCritical();
return ret;
} }
bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen) bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
{ {
_fullscreen = fullscreen; _fullscreen = fullscreen;
GetVideoModes(); // get the list of available video modes GetVideoModes(); // get the list of available video modes
if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution.width, _cur_resolution.height)) { if (_num_resolutions == 0 || !CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
/* switching resolution failed, put back full_screen to original status */ /* switching resolution failed, put back full_screen to original status */
_fullscreen ^= true; _fullscreen ^= true;
return false; return false;