Index: src/video/sdl_v.cpp =================================================================== --- src/video/sdl_v.cpp (revision 18031) +++ src/video/sdl_v.cpp (working copy) @@ -41,6 +41,34 @@ /** Should we keep continue drawing? */ static volatile bool _draw_continue; +static class ResizeRequest { +private: + bool resizing; + int width, height; +public: + void RequestResize(int width, int height) + { + this->width = width; + this->height = height; + this->resizing = true; + } + + void UpdateSize() + { + if (this->resizing) { + ChangeResInGame(this->width, this->height); + } + } + + void FinishResize() + { + if (this->resizing) { + _video_driver->ChangeResolution(this->width, this->height); + } + this->resizing = false; + } +} _resize_request; + #define MAX_DIRTY_RECTS 100 static SDL_Rect _dirty_rects[MAX_DIRTY_RECTS]; static int _num_dirty_rects; @@ -437,6 +465,7 @@ break; case SDL_ACTIVEEVENT: + _resize_request.FinishResize(); if (!(ev.active.state & SDL_APPMOUSEFOCUS)) break; if (ev.active.gain) { // mouse entered the window, enable cursor @@ -463,7 +492,7 @@ case SDL_VIDEORESIZE: { int w = max(ev.resize.w, 64); int h = max(ev.resize.h, 64); - ChangeResInGame(w, h); + _resize_request.RequestResize(w, h); break; } } @@ -539,6 +568,8 @@ while (PollEvent() == -1) {} if (_exit_game) break; + _resize_request.UpdateSize(); + mod = SDL_CALL SDL_GetModState(); keys = SDL_CALL SDL_GetKeyState(&numkeys); #if defined(_DEBUG)