Detecting when user switches away and back

Hi,
I didn’t find a way to detect when user swithces away from prog from the
docs, but maibye Ive overseen it. I need it to know when I have to reset
video mode in windowed Opengl Window.
Thanks

Hi,
I didn’t find a way to detect when user swithces away from prog from the
docs, but maibye Ive overseen it. I need it to know when I have to reset
video mode in windowed Opengl Window.
Thanks

Read the descriptions of the expose events at
http://sdldoc.csn.ul.ie/eventstructures.php

	Bob PendletonOn Mon, 2004-04-26 at 06:36, Enrico Kravina wrote:

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±--------------------------------------+

Enrico Kravina wrote:

Hi,
I didn’t find a way to detect when user swithces away from prog from the
docs, but maibye Ive overseen it. I need it to know when I have to reset
video mode in windowed Opengl Window.
Thanks


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

The code I have is as follows:

   while (SDL_PollEvent(&event))
   {
      if(event.type == SDL_ACTIVEEVENT)
        {
            if(event.active.state==SDL_APPACTIVE || 

event.active.state==SDL_APPINPUTFOCUS)
{
if(event.active.gain==0)
{
//do this when the user has clicked outside
//of the window, or when the window loses
//focus. Works on Linux and Windows
}
}
}
}
}

You can probably make it nicer if you want, but this step by step look
at it might help you do other things with window events.

-TomT64