Commit 6848868c authored by Ryan C. Gordon's avatar Ryan C. Gordon

windib target can now control screensaver with SDL_VIDEO_ALLOW_SCREENSAVER.

  Fixes Bugzilla #415.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402381
parent 9797c48f
...@@ -225,9 +225,14 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ...@@ -225,9 +225,14 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
#if defined(SC_SCREENSAVE) && defined(SC_MONITORPOWER) #if defined(SC_SCREENSAVE) && defined(SC_MONITORPOWER)
case WM_SYSCOMMAND: { case WM_SYSCOMMAND: {
if ((wParam&0xFFF0)==SC_SCREENSAVE || const DWORD val = (DWORD) (wParam & 0xFFF0);
(wParam&0xFFF0)==SC_MONITORPOWER) if ((val == SC_SCREENSAVE) || (val == SC_MONITORPOWER)) {
if (!this->hidden->allow_screensaver) {
/* Note that this doesn't stop anything on Vista
if the screensaver has a password. */
return(0); return(0);
}
}
} }
/* Fall through to default processing */ /* Fall through to default processing */
#endif /* SC_SCREENSAVE && SC_MONITORPOWER */ #endif /* SC_SCREENSAVE && SC_MONITORPOWER */
......
...@@ -282,6 +282,7 @@ static HPALETTE DIB_CreatePalette(int bpp) ...@@ -282,6 +282,7 @@ static HPALETTE DIB_CreatePalette(int bpp)
int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat) int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat)
{ {
const char *env = NULL;
#ifndef NO_CHANGEDISPLAYSETTINGS #ifndef NO_CHANGEDISPLAYSETTINGS
int i; int i;
DEVMODE settings; DEVMODE settings;
...@@ -380,6 +381,10 @@ int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -380,6 +381,10 @@ int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat)
this->hidden->origRotation = -1; this->hidden->origRotation = -1;
#endif #endif
/* Allow environment override of screensaver disable. */
env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER");
this->hidden->allow_screensaver = ( (env && SDL_atoi(env)) ? 1 : 0 );
/* We're done! */ /* We're done! */
return(0); return(0);
} }
......
...@@ -41,6 +41,8 @@ struct SDL_PrivateVideoData { ...@@ -41,6 +41,8 @@ struct SDL_PrivateVideoData {
HBITMAP screen_bmp; HBITMAP screen_bmp;
HPALETTE screen_pal; HPALETTE screen_pal;
int allow_screensaver;
#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
int SDL_nummodes[NUM_MODELISTS]; int SDL_nummodes[NUM_MODELISTS];
SDL_Rect **SDL_modelist[NUM_MODELISTS]; SDL_Rect **SDL_modelist[NUM_MODELISTS];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment