]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
disable screensaver on windows while game window is active
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Feb 2008 14:51:16 +0000 (14:51 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Feb 2008 14:51:16 +0000 (14:51 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8089 d7cf8633-e32d-0410-b094-e92efae38249

vid_wgl.c

index cdb2107bd843ec4a567d43716261ba0f5365ea23..d8097591a1e83b41d5b2ff8ab1f3ea6aa014ca2c 100644 (file)
--- 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;