[SDL] Preventing start of screensaver - handling of platform dependent messages

M.A. Oude Kotte marc at solcon.nl
Thu Dec 18 07:16:00 PST 2003


Hi SDL-guru's!

I've written an application using SDL and OpenGL. My main target is 
Windows, but my program runs just fine in Linux as well.

When my program runs fullscreen I would like to be able to prevent the 
screensaver from starting. As far as I know the only possible way to do 
this is described by the following comment which I copy/pasted from a 
Windows header file:

/****************************************************************************
			ScreenSaver support
The current application will receive a syscommand of SC_SCREENSAVE just 
before the screen saver is invoked.  If the app wishes to prevent a 
screen save, return non-zero value, otherwise call DefWindowProc().
****************************************************************************/

Now I know that SDL has a pretty flexible way of handling platform 
dependent messages. I am able to receive an event whenever a 
WM_SYSCOMMAND message is sent to my window through the use of the 
SDL_SYSWMEVENT event and the SDL_SysWMmsg struct.

But what I am *not* able to do (and what I would like to be able to do) 
is specify the return value! I assume that the (Windows) SDL code does 
the following whenever it receives an unhandled message:
- fill SDL_SysWMmsg struct
- send SDL_SYSWMEVENT event containing that struct
- return 0

But as you know by now, I want to return everything *BUT* 0 ... does 
anyone have a solution for this? I've searched the SDL headers for a 
different way of blocking the screensaver, but without any results.

Thanks in advance!

Marc





More information about the SDL mailing list