V6 SCR: Merge code for Mac and Windows screensavers

svn path=/trunk/boinc/; revision=13783
This commit is contained in:
Charlie Fenton 2007-10-05 15:01:03 +00:00
parent b957b7532a
commit 28073fd644
1 changed files with 0 additions and 86 deletions

View File

@ -51,12 +51,7 @@ class CScreensaver
public: public:
CScreensaver(); CScreensaver();
#ifdef _WIN32
virtual HRESULT Create( HINSTANCE hInstance );
HRESULT DisplayErrorMsg( HRESULT hr );
#elif defined(__APPLE__)
int Create(); int Create();
#endif
int Run(); int Run();
@ -64,35 +59,6 @@ public:
// Infrastructure layer // Infrastructure layer
// //
protected: protected:
#ifdef _WIN32
SaverMode ParseCommandLine( TCHAR* pstrCommandLine );
VOID EnumMonitors( VOID );
int UtilGetRegKey(LPCTSTR name, DWORD &keyval);
int UtilSetRegKey(LPCTSTR name, DWORD value);
int UtilGetRegStartupStr(LPCTSTR name, LPTSTR str);
BOOL IsConfigStartupBOINC();
BOOL CreateInfrastructureMutexes();
BOOL GetError( BOOL& bErrorMode, HRESULT& hrError, TCHAR* pszError, size_t iErrorSize );
BOOL SetError( BOOL bErrorMode, HRESULT hrError );
VOID UpdateErrorBoxText();
virtual BOOL GetTextForError( HRESULT hr, TCHAR* pszError, DWORD dwNumChars );
// Variables for non-fatal error management
HANDLE m_hErrorManagementMutex;
BOOL m_bErrorMode; // Whether to display an error
HRESULT m_hrError; // Error code to display
TCHAR m_szError[400]; // Error message text
BOOL m_bBOINCConfigChecked;
BOOL m_bBOINCStartupConfigured;
DWORD m_dwBlankScreen;
DWORD m_dwBlankTime;
#elif defined(__APPLE__)
OSStatus initBOINCApp(void); OSStatus initBOINCApp(void);
int GetBrandID(void); int GetBrandID(void);
char* PersistentFGets(char *buf, size_t buflen, FILE *f); char* PersistentFGets(char *buf, size_t buflen, FILE *f);
@ -112,7 +78,6 @@ protected:
pid_t m_CoreClientPID; pid_t m_CoreClientPID;
int m_dwBlankScreen; int m_dwBlankScreen;
time_t m_dwBlankTime; time_t m_dwBlankTime;
#endif
// //
@ -122,14 +87,6 @@ protected:
bool CreateDataManagementThread(); bool CreateDataManagementThread();
bool DestoryDataManagementThread(); bool DestoryDataManagementThread();
#ifdef _WIN32
DWORD WINAPI DataManagementProc();
static DWORD WINAPI DataManagementProcStub( LPVOID lpParam );
int launch_screensaver(RESULT* rp, HANDLE& graphics_application);
int terminate_screensaver(HANDLE& graphics_application, RESULT *worker_app);
HANDLE m_hDataManagementThread;
HANDLE m_hGraphicsApplication;
#elif defined(__APPLE__)
void* DataManagementProc(); void* DataManagementProc();
static void* DataManagementProcStub( void* param ); static void* DataManagementProcStub( void* param );
int terminate_screensaver(int& graphics_application, RESULT *worker_app); int terminate_screensaver(int& graphics_application, RESULT *worker_app);
@ -138,7 +95,6 @@ protected:
OSErr KillScreenSaver(void); OSErr KillScreenSaver(void);
pthread_t m_hDataManagementThread; pthread_t m_hDataManagementThread;
pid_t m_hGraphicsApplication; pid_t m_hGraphicsApplication;
#endif
// Determine if two RESULT pointers refer to the same task // Determine if two RESULT pointers refer to the same task
bool is_same_task(RESULT* taska, RESULT* taskb); bool is_same_task(RESULT* taska, RESULT* taskb);
@ -166,26 +122,7 @@ protected:
// //
// Presentation layer // Presentation layer
// //
#ifdef _WIN32
protected: protected:
HRESULT CreateSaverWindow();
VOID UpdateErrorBox();
VOID InterruptSaver();
VOID ChangePassword();
VOID DoConfig();
HRESULT DoSaver();
VOID DoPaint( HWND hwnd, HDC hdc, LPPAINTSTRUCT lpps );
void DrawTransparentBitmap(HDC hdc, HBITMAP hBitmap, LONG xStart, LONG yStart, COLORREF cTransparentColor);
LRESULT SaverProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
INT_PTR ConfigureDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
static LRESULT CALLBACK SaverProcStub( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static INT_PTR CALLBACK ConfigureDialogProcStub( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
void ShutdownSaver();
#elif defined(__APPLE__)
char m_MsgBuf[2048]; char m_MsgBuf[2048];
char m_BannerText[2048]; char m_BannerText[2048];
int m_BannerWidth; int m_BannerWidth;
@ -195,31 +132,8 @@ public:
int drawGraphics(GrafPtr aPort); int drawGraphics(GrafPtr aPort);
void drawPreview(GrafPtr aPort); void drawPreview(GrafPtr aPort);
void ShutdownSaver(); void ShutdownSaver();
#endif
protected: protected:
#ifdef _WIN32
SaverMode m_SaverMode; // sm_config, sm_full, sm_preview, etc.
BOOL m_bAllScreensSame; // If TRUE, show same image on all screens
HWND m_hWnd; // Focus window and device window on primary
HWND m_hWndParent;
HINSTANCE m_hInstance;
BOOL m_bWaitForInputIdle; // Used to pause when preview starts
DWORD m_dwSaverMouseMoveCount;
BOOL m_bIs9x;
BOOL m_bCheckingSaverPassword;
BOOL m_bWindowed;
INTERNALMONITORINFO m_Monitors[MAX_DISPLAYS];
DWORD m_dwNumMonitors;
RECT m_rcRenderTotal; // Rect of entire area to be rendered
RECT m_rcRenderCurDevice; // Rect of render area of current device
BOOL m_bPaintingInitialized;
TCHAR m_strWindowTitle[200]; // Title for the app's window
DWORD m_dwLastInputTimeAtStartup;
#endif
}; };
#endif #endif