Exiting

My SDL program always exits whenever I happen to alt-tab out of it. Is there any
way to prevent this from happening - i.e. allow the program to keep running
regardless of what other windows I might be looking at?

Hello !

My SDL program always exits whenever I happen to alt-tab out of it. Is
there any way to prevent this from happening - i.e. allow the program to
keep running regardless of what other windows I might be looking at?

This sounds like an error in your code. Do the examples
that come with SDL show the same problem ?

What OS do you use ?

CU

Torsten Giebl <wizard syntheticsw.com> writes:

Hello !

My SDL program always exits whenever I happen to alt-tab out of it. Is
there any way to prevent this from happening - i.e. allow the program to
keep running regardless of what other windows I might be looking at?

This sounds like an error in your code. Do the examples
that come with SDL show the same problem ?

What OS do you use ?

CU

Where can I find these examples? Seeing if it happens with them as well sounds
like a good idea.

I use Windows XP.

Estu K. Aftadai wrote:

Where can I find these examples? Seeing if it happens with them as well sounds
like a good idea.

I use Windows XP.

In the “test” directory.

This is not normal behaviour - I have written plenty of stuff using SDL
and it doesn’t exit if you alt-tab away.

Is this in fullscreen or windowed mode?

Pete.

Peter Mulholland <darkmatter freeuk.com> writes:

Is this in fullscreen or windowed mode?

Pete.

This is in fullscreen - it leaves a segmentation fault message in stderr.txt as
well. My guess is it’s trying to write to screen memory while it’s unavailable.

This is in fullscreen - it leaves a segmentation fault message in stderr.txt as
well. My guess is it’s trying to write to screen memory while it’s unavailable.

You can detect when your program loses input focus, and not draw while
it doesn’t. This info is sent in SDL_ACTIVEEVENT.

Ilya Olevsky <info valengames.com> writes:

You can detect when your program loses input focus, and not draw while
it doesn’t. This info is sent in SDL_ACTIVEEVENT.

Excellent, I read up on that and now it works, after doing a check using
SDL_GetAppState(). Thanks very much!

Estu K. Aftadai wrote:

This is in fullscreen - it leaves a segmentation fault message in stderr.txt as
well. My guess is it’s trying to write to screen memory while it’s unavailable.

It still shouldn’t crash unless you are not handling surface lock errors
when you try to draw to surfaces that are in video RAM. I’ve never had a
problem alt-tabbing away from any fullscreen SDL app, and I usually dont
handle the SDL_ACTIVEEVENT event.

Pete.