From 2b56ed18e7e1416fff0042ab8ce1f1bdbb1de7c6 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Wed, 12 Apr 2006 04:27:22 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=9845 --- client/win/boinc_ss.h | 1 + client/win/boinc_ss.rc | 6 +++++ client/win/win_screensaver.cpp | 40 +++++++++++++++++----------------- client/win/win_screensaver.h | 1 + 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/client/win/boinc_ss.h b/client/win/boinc_ss.h index 638ac7d1ce..2b221c35b1 100644 --- a/client/win/boinc_ss.h +++ b/client/win/boinc_ss.h @@ -18,6 +18,7 @@ #define IDS_ERR_BOINCNOGRAPHICSAPPSEXECUTING 2106 #define IDS_ERR_BOINCSCREENSAVERLOADING 2107 #define IDS_ERR_BOINCAPPFOUNDGRAPHICSLOADING 2108 +#define IDS_ERR_BOINCSHUTDOWNEVENT 2109 #define IDS_ERR_OUTOFMEMORY 2110 #define IDS_ERR_NOPREVIEW 2112 diff --git a/client/win/boinc_ss.rc b/client/win/boinc_ss.rc index c38a963c98..c19d950ee4 100755 --- a/client/win/boinc_ss.rc +++ b/client/win/boinc_ss.rc @@ -244,6 +244,8 @@ BEGIN "GridRepublic screensaver loading" IDS_ERR_BOINCAPPFOUNDGRAPHICSLOADING "Application found, graphics loading...\n\nPlease wait..." + IDS_ERR_BOINCSHUTDOWNEVENT + "Gridrepublic screensaver shutting down." END #elif defined(_CPDNBBC) @@ -266,6 +268,8 @@ BEGIN "Climate Change Experiment screensaver loading" IDS_ERR_BOINCAPPFOUNDGRAPHICSLOADING "Application found, graphics loading...\n\nPlease wait..." + IDS_ERR_BOINCSHUTDOWNEVENT + "Climate Change Experiment\nscreensaver shutting down." END #else @@ -288,6 +292,8 @@ BEGIN "BOINC screensaver loading" IDS_ERR_BOINCAPPFOUNDGRAPHICSLOADING "Application found, graphics loading...\n\nPlease wait..." + IDS_ERR_BOINCSHUTDOWNEVENT + "BOINC screensaver shutting down." END #endif diff --git a/client/win/win_screensaver.cpp b/client/win/win_screensaver.cpp index 20df0e4dbc..b97109c818 100755 --- a/client/win/win_screensaver.cpp +++ b/client/win/win_screensaver.cpp @@ -65,13 +65,15 @@ INT WINAPI WinMain( #ifdef _DEBUG // Initialize Diagnostics when compiled for debug - retval = boinc_init_diagnostics ( + retval = diagnostics_init ( BOINC_DIAG_DUMPCALLSTACKENABLED | BOINC_DIAG_HEAPCHECKENABLED | BOINC_DIAG_MEMORYLEAKCHECKENABLED | BOINC_DIAG_ARCHIVESTDERR | BOINC_DIAG_REDIRECTSTDERR | - BOINC_DIAG_TRACETOSTDERR + BOINC_DIAG_TRACETOSTDERR, + "stdoutscr", + "stderrscr" ); if (retval) { BOINCTRACE("WinMain - BOINC Screensaver Diagnostic Error '%d'\n", retval); @@ -892,6 +894,7 @@ BOOL CScreensaver::GetTextForError( SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING, IDS_ERR_BOINCNOGRAPHICSAPPSEXECUTING, SCRAPPERR_BOINCSCREENSAVERLOADING, IDS_ERR_BOINCSCREENSAVERLOADING, SCRAPPERR_BOINCAPPFOUNDGRAPHICSLOADING, IDS_ERR_BOINCAPPFOUNDGRAPHICSLOADING, + SCRAPPERR_BOINCSHUTDOWNEVENT, IDS_ERR_BOINCSHUTDOWNEVENT, SCRAPPERR_NOPREVIEW, IDS_ERR_NOPREVIEW }; const DWORD dwErrorMapSize = sizeof(dwErrorMap) / sizeof(DWORD[2]); @@ -1011,9 +1014,7 @@ DWORD WINAPI CScreensaver::DataManagementProc() { } } } else { - // Reset the error flags. SetError(FALSE, 0); - if (m_bCoreNotified) { switch (m_iStatus) { case SS_STATUS_ENABLED: @@ -1057,22 +1058,23 @@ DWORD WINAPI CScreensaver::DataManagementProc() { // window just takes on the background of the previous window which happens to be // the black screensaver window owned by this process. // - // Here we need to plug into the operating systems heartbeat mechinism for windows - // and verify that their hasn't been any keyboard or mouse activity. If there has + // Verify that their hasn't been any keyboard or mouse activity. If there has // we should hide the window from this process and exit out of the screensaver to // return control back to the user as quickly as possible. - if (gspfnMyIsHungAppWindow && gspfnMyGetLastInputInfo) { - if (gspfnMyIsHungAppWindow(hwndBOINCGraphicsWindow)) { - LASTINPUTINFO lii; - lii.cbSize = sizeof(LASTINPUTINFO); + BOINCTRACE(_T("CScreensaver::DataManagementProc - Graphics Window Detected and is the foreground window.\n")); + if (gspfnMyGetLastInputInfo) { + BOINCTRACE(_T("CScreensaver::DataManagementProc - Checking idle actvity.\n")); + LASTINPUTINFO lii; + lii.cbSize = sizeof(LASTINPUTINFO); - gspfnMyGetLastInputInfo(&lii); + gspfnMyGetLastInputInfo(&lii); - if (m_dwLastInputTimeAtStartup != lii.dwTime) { - ShowWindow(hwndBOINCGraphicsWindow, SW_MINIMIZE); - ShowWindow(hwndBOINCGraphicsWindow, SW_FORCEMINIMIZE); - ShutdownSaver(); - } + if (m_dwLastInputTimeAtStartup != lii.dwTime) { + BOINCTRACE(_T("CScreensaver::DataManagementProc - Activity Detected.\n")); + ShowWindow(hwndBOINCGraphicsWindow, SW_MINIMIZE); + ShowWindow(hwndBOINCGraphicsWindow, SW_FORCEMINIMIZE); + SetError(TRUE, SCRAPPERR_BOINCSHUTDOWNEVENT); + ShutdownSaver(); } } } @@ -1091,11 +1093,9 @@ DWORD WINAPI CScreensaver::DataManagementProc() { // This can happen because of a personal firewall notifications or some // funky IM client that thinks it has to notify the user even when in // screensaver mode. + BOINCTRACE(_T("CScreensaver::DataManagementProc - Unknown foreground window detected, shutdown the screensaver.\n")); + SetError(TRUE, SCRAPPERR_BOINCSHUTDOWNEVENT); ShutdownSaver(); - } else { - // Application has been selected, and graphics should be up before too - // long. - SetError(TRUE, SCRAPPERR_BOINCAPPFOUNDGRAPHICSLOADING); } } break; diff --git a/client/win/win_screensaver.h b/client/win/win_screensaver.h index 6173cd5ef4..3fdb963adc 100644 --- a/client/win/win_screensaver.h +++ b/client/win/win_screensaver.h @@ -23,6 +23,7 @@ #define SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING 0x82000007 #define SCRAPPERR_BOINCSCREENSAVERLOADING 0x82000008 #define SCRAPPERR_BOINCAPPFOUNDGRAPHICSLOADING 0x82000009 +#define SCRAPPERR_BOINCSHUTDOWNEVENT 0x8200000a #define SCRAPPERR_NOPREVIEW 0x8200000f