From 42c36cf531913b0b13afab1d0f386c44ae2cc761 Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 14 Feb 2008 14:51:16 +0000 Subject: [PATCH] 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 --- vid_wgl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- 2.39.2