Can't catch iconify/restore events

This is my environment:
Windows 98
SDL 1.2.5
GeForce4 MX440

This is taken from my own version of Sam Lantinga’s SDL hack of NeHe’s
OpenGL tutorial
(so I’m in a SDL_OPENGL rendering context):

 active=1;
 done=0;

 while (!done)
 {
     SDL_Event event;

     if (active)
         DrawGLScene();                      //rendering function

     while (SDL_PollEvent(&event))
         switch (event.type)
         {
             case SDL_QUIT:
                 done = 1;
                 break;
             case SDL_KEYDOWN:
                 if (event.key.keysym.sym == SDLK_ESCAPE)
                     done = 1;
                 break;
             case SDL_ACTIVEEVENT:
                 if (event.active.state == SDL_APPACTIVE) {
                     active = event.active.gain;
                     fprintf(stderr,"active=%d\n",active);
                 }
                 break;
         default:
               break;
     }

 }

When I iconify/restore the window, SDL_APPACTIVE is never triggered. Why?

CRV?ADER /KY wrote:

This is my environment:
Windows 98
SDL 1.2.5
GeForce4 MX440

This is taken from my own version of Sam Lantinga’s SDL hack of NeHe’s
OpenGL tutorial
(so I’m in a SDL_OPENGL rendering context):

active=1;
done=0;

while (!done)
{
    SDL_Event event;

    if (active)
        DrawGLScene();                      //rendering function

    while (SDL_PollEvent(&event))
        switch (event.type)
        {
            case SDL_QUIT:
                done = 1;
                break;
            case SDL_KEYDOWN:
                if (event.key.keysym.sym == SDLK_ESCAPE)
                    done = 1;
                break;
            case SDL_ACTIVEEVENT:
                if (event.active.state == SDL_APPACTIVE) {
                    active = event.active.gain;
                    fprintf(stderr,"active=%d\n",active);
                }
                break;
        default:
              break;
    }

}

When I iconify/restore the window, SDL_APPACTIVE is never triggered. Why?

I had a similar problem on XP and 2000, I’m pretty sure that I fixed it by using
the (poorly documented) SDL_ExposeEvent. http://sdldoc.csn.ul.ie/sdlexposeevent.php

Try catching it as well as SDL_ACTIVEEVENT.