We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 415

Summary: SDL has no way to control screensaver.
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P1    
Version: 1.2.11   
Hardware: All   
OS: All   
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/2007-March/060360.html
Attachments: Patch to disable screensaver on Mac OS X and X11.
Updated patch with cleanups.
windib screensaver allowance patch

Description Ryan C. Gordon 2007-03-14 19:36:49 UTC
On X11 and others, SDL explicitly disables the screensaver while the videomode is set, even in a window. For most games, this is desirable, but for things like TuxPaint, it would be nice to have a way to instruct SDL to leave the platform's screensaver alone.

For 1.2, I think an environment variable will suffice:

   SDL_ALLOWSCREENSAVER=1


For 1.3, a formal API might be better.

--ryan.
Comment 1 Ryan C. Gordon 2007-03-14 20:12:39 UTC
Created attachment 198 [details]
Patch to disable screensaver on Mac OS X and X11.


This patch uses SDL_ALLOWSCREENSAVER on Mac OS X and X11 targets, for the 1.2 branch.

--ryan.
Comment 2 Ryan C. Gordon 2007-04-06 13:28:18 UTC
Created attachment 204 [details]
Updated patch with cleanups.


Updated patch that only checks the environment variable on X11 at VideoInit time...so behaviour is correct even if environment table changes during execution.

--ryan.
Comment 3 Ryan C. Gordon 2007-04-06 13:31:18 UTC
Fixed in svn revision #3015.

--ryan.

Comment 4 Ryan C. Gordon 2007-06-14 22:57:56 UTC
Reopening bug and setting to P1; would like to get Windows in here for 1.2.12.

--ryan.

Comment 5 Ryan C. Gordon 2007-06-14 23:00:30 UTC
Created attachment 212 [details]
windib screensaver allowance patch


Here's a patch to the windib target to allow the screensaver in the same way as Mac OS X and X11...I don't think we can safely do this for the DX5 target, since it mentions losing the screen surface upon the screensaver starting...I'm okay with that, though.

This patch is untested, I don't have a Windows box handy.

--ryan.
Comment 6 Ryan C. Gordon 2007-06-14 23:01:31 UTC
Tossing bug to Sam...can you make sure that Attachment #212 [details] actually compiles on Windows?

Thanks,
--ryan.

Comment 7 Ryan C. Gordon 2007-06-26 13:04:47 UTC
Tested on windib, and it works, so I committed it. Fixed in svn revision #3105.

This doesn't apply to 1.3, which should formalize this in an API and not an environment variable.

--ryan.