*** empty log message ***

svn path=/trunk/boinc/; revision=9867
This commit is contained in:
Rom Walton 2006-04-13 03:53:16 +00:00
parent 0969203461
commit bffa2065cd
3 changed files with 21 additions and 11 deletions

View File

@ -993,7 +993,8 @@ DWORD WINAPI CScreensaver::DataManagementProc() {
BOOL bForegroundWindowIsScreensaver;
HRESULT hrError;
HWND hwndBOINCGraphicsWindow = NULL;
HWND hwndForegroundWindow = NULL;
HWND hwndForeWindow = NULL;
HWND hwndForeParent = NULL;
DWORD iMonitor = 0;
int iReturnValue = 0;
time_t tThreadCreateTime = 0;
@ -1055,14 +1056,14 @@ DWORD WINAPI CScreensaver::DataManagementProc() {
hwndBOINCGraphicsWindow = FindWindow(BOINC_WINDOW_CLASS_NAME, NULL);
if (hwndBOINCGraphicsWindow) {
// Graphics Application.
hwndForegroundWindow = GetForegroundWindow();
hwndForeWindow = GetForegroundWindow();
// If the graphics application is not the top most window try and force it
// to the top.
if (hwndForegroundWindow != hwndBOINCGraphicsWindow) {
if (hwndForeWindow != hwndBOINCGraphicsWindow) {
BOINCTRACE(_T("CScreensaver::DataManagementProc - Graphics Window Detected but NOT the foreground window, bringing window to foreground.\n"));
SetForegroundWindow(hwndBOINCGraphicsWindow);
hwndForegroundWindow = GetForegroundWindow();
if (hwndForegroundWindow != hwndBOINCGraphicsWindow) {
hwndForeWindow = GetForegroundWindow();
if (hwndForeWindow != hwndBOINCGraphicsWindow) {
BOINCTRACE(_T("CScreensaver::DataManagementProc - Graphics Window Detected but NOT the foreground window, bringing window to foreground. (Final Try)\n"));
// This may be needed on Windows 2000 or better machines
@ -1104,7 +1105,7 @@ DWORD WINAPI CScreensaver::DataManagementProc() {
ShowWindow(hwndBOINCGraphicsWindow, SW_MINIMIZE);
ShowWindow(hwndBOINCGraphicsWindow, SW_FORCEMINIMIZE);
SetError(TRUE, SCRAPPERR_BOINCSHUTDOWNEVENT);
ShutdownSaver();
SendMessage(m_Monitors[iMonitor].hWnd, WM_INTERRUPTSAVER, NULL, NULL);
}
}
}
@ -1112,10 +1113,13 @@ DWORD WINAPI CScreensaver::DataManagementProc() {
// Graphics application does not exist. So check that one of the windows
// assigned to each monitor is the foreground window.
bForegroundWindowIsScreensaver = FALSE;
hwndForegroundWindow = GetForegroundWindow();
hwndForeWindow = GetForegroundWindow();
hwndForeParent = GetParent(hwndForeWindow);
for(iMonitor = 0; iMonitor < m_dwNumMonitors; iMonitor++) {
pMonitorInfo = &m_Monitors[iMonitor];
if (pMonitorInfo->hWnd == hwndForegroundWindow) {
if ((pMonitorInfo->hWnd == hwndForeWindow) ||
(pMonitorInfo->hWnd == hwndForeParent))
{
bForegroundWindowIsScreensaver = TRUE;
}
}
@ -1125,7 +1129,7 @@ DWORD WINAPI CScreensaver::DataManagementProc() {
// screensaver mode.
BOINCTRACE(_T("CScreensaver::DataManagementProc - Unknown foreground window detected, shutdown the screensaver.\n"));
SetError(TRUE, SCRAPPERR_BOINCSHUTDOWNEVENT);
ShutdownSaver();
SendMessage(m_Monitors[iMonitor].hWnd, WM_INTERRUPTSAVER, NULL, NULL);
}
}
break;
@ -1150,7 +1154,7 @@ DWORD WINAPI CScreensaver::DataManagementProc() {
GetError(bErrorMode, hrError, NULL, 0);
if (SS_STATUS_QUIT == m_iStatus && m_bCoreNotified) {
BOINCTRACE(_T("CScreensaver::DataManagementProc - Shutdown BOINC Screensaver\n"));
ShutdownSaver();
SendMessage(m_Monitors[iMonitor].hWnd, WM_INTERRUPTSAVER, NULL, NULL);
} else {
if (!bErrorMode && !m_bCoreNotified) {
BOINCTRACE(_T("CScreensaver::DataManagementProc - Startup BOINC Screensaver\n"));
@ -1522,6 +1526,11 @@ LRESULT CScreensaver::SaverProc(
if (wParam == PBT_APMQUERYSUSPEND && gspfnMyVerifyPwdProc == NULL)
InterruptSaver();
break;
case WM_INTERRUPTSAVER:
if (hWnd == m_Monitors[0].hWnd) {
InterruptSaver();
}
break;
}
BOINCTRACE(_T("CScreensaver::SaverProc [%d] hWnd '%d' uMsg '%X' wParam '%d' lParam '%d'\n"), dwMonitor, hWnd, uMsg, wParam, lParam);

View File

@ -35,6 +35,7 @@
#define NO_MONITOR 0xffffffff
#define BSF_ALLOWSFW 0x00000080
#define WM_INTERRUPTSAVER WM_USER+1
#define BOINC_WINDOW_CLASS_NAME _T("BOINC_app")

View File

@ -38,7 +38,7 @@
// platforms we are going to disable the deprecation warnings if we are compiling
// on Visual Studio 2005
#if _MSC_VER >= 1400
#pragma warning(disable: 4996) // function deprecation
#define _CRT_SECURE_NO_DEPRECATE
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.