From: havoc Date: Thu, 14 Feb 2008 14:51:16 +0000 (+0000) Subject: disable screensaver on windows while game window is active X-Git-Tag: xonotic-v0.1.0preview~2427 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=42c36cf531913b0b13afab1d0f386c44ae2cc761;p=xonotic%2Fdarkplaces.git disable screensaver on windows while game window is active git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8089 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/vid_wgl.c b/vid_wgl.c index cdb2107b..d8097591 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -519,6 +519,12 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // keep Alt-Space from happening break; + case WM_SYSCOMMAND: + // prevent screensaver from occuring while the active window + if (fActive && ((wParam & 0xFFF0) == SC_SCREENSAVE || (wParam & 0xFFF0) == SC_MONITORPOWER)) + lRet = 0;; // note: password-locked screensavers on Vista still work + break; + // this is complicated because Win32 seems to pack multiple mouse events into // one update sometimes, so we always check all states and look for events case WM_LBUTTONDOWN: @@ -852,7 +858,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp, int refreshrat } } // otherwise, take anything - + memcpy(&gdevmode, &thismode, sizeof(gdevmode)); if(thismode.dmDisplayFrequency <= (DWORD)refreshrate) foundgoodmode = true;