[SDL] SDL tampers with display power settings on the sly

Sam Lantinga slouken at devolution.com
Tue Feb 26 04:11:00 PST 2008

> So the solution would be something like this: Each time the application 
> updates the display with a new animation frame, it marks that update 
> with a special flag, indicating that this is the kind of thing that the 
> user may be watching even though he has not interacted with the system
> for a while. The X server then resets the screensaver countdown.

That's a great idea. :)
Is there a way to pretend to the X server that there has been user input?

The feature was added because there are two cases where X will trigger the
screen saver even though you're still interacting with the application:
1. Using non-keyboard/mouse input (e.g. gamepads)
2. Using fullscreen input (DGA)
In both of these cases the input is bypassing X11's normal input path and
the screensaver kicks on.  This can be quite annoying in the middle of say
Quake Wars. :)

So clearly you're annnoyed at the default behavior of SDL, and while I can
certainly see your point, there are lots of applications where that behavior
is desired.  SDL 1.2 won't be changed at this point because of the large
number of applications that assume the existing behavior.  SDL 1.3 will
have an API function for you to query and control this behavior.

In your case, you can simply set the environment variable either globally
as a user, or in specific applications using putenv(), and it'll solve
the problem for you.

I'll add a FAQ entry for this:

As for the original bug report saying that SDL doesn't restore the power
settings when it quits, did you find out why this is?  That is definitely
a bug and should be investigated.

See ya!
	-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

More information about the SDL mailing list