SDL2 Screen freeze minimised -> maximised

I have a simple SDL2 application with a re-sizeable window, if I minimise then maximise the window (ie click application icon on the taskbar) the rendering freezes. If I "window" the window the rendering starts again fine, and if I go from windowed to maximised it renders fine as well. I've included a simple code example below which makes the screen flash through varying shades of grey. Try minimising, then maximising, then windowing.... How do I stop the rendering freezing when going from minimised to maximised?

I'm currently running SDL2.0 v 2.0.3 on Windows 10 machine (experienced the same problem running on previous Windows 7 machine).

I posted similar query on SDL Development group but got no response, sorry for re-posting but I'm a bit desperate... Thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  //FLASHING SCREEN CODE 
//Demonstrates screen freeze when you minimise then maximise the screen.... 

#include "SDL.h" 

using namespace std; 

int main( int argc, char* args[] ) 
{ 
    //Initialise SDL2, declare Window + Renderer 
    SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ); //Initialize SDL for video and audio 
    SDL_Window* pWindow = NULL; 
    SDL_Renderer* pRenderer = NULL; 
    pWindow = SDL_CreateWindow("Minimise Maximise Test", 50, 50, 1200, 600, SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED); 
    pRenderer = SDL_CreateRenderer(pWindow, -1, SDL_RENDERER_TARGETTEXTURE); 

    //The Screen colour which is going to flash through different shades of grey 
    SDL_Color screenColour = {0, 0, 0}; 

    //SDL event for detecting X-out (quit) 
    SDL_Event event; 
    bool quit = false; 

    //Loop 
    while( quit == false )   //While SDL has not been X'ed out 
    { 
        ////Handle quit 
        if (SDL_PollEvent(&event) != 0) 
        { 
            if(event.type == SDL_QUIT) quit = true; //Press X-out to quit (but not visible on fullscreen) 
        } 

        //Make screen flash by changing its colour through shades of grey 
        screenColour.r++; 
        screenColour.g++; 
        screenColour.b++; 

        //Render the screen 
        SDL_SetRenderDrawColor(pRenderer, screenColour.r, screenColour.g, screenColour.b, 255); 
        SDL_RenderFillRect(pRenderer, NULL); 
        SDL_RenderPresent(pRenderer); //like SDL_flip 
    } 

    //Shutdown 
    SDL_DestroyRenderer(pRenderer); 
    SDL_DestroyWindow(pWindow); 
    SDL_Quit(); 
    return 0; 
}
Upgrading to SDL 2.0.4 seem to help for people with similar problems. http://forums.libsdl.org/viewtopic.php?t=11093
Thanks so much Peter, upgraded to 2.0.4 and this fixed it.
Topic archived. No new replies allowed.