1
// Berkeley Open Infrastructure for Network Computing
2
// http://boinc.berkeley.edu
3
// Copyright (C) 2005 University of California
5
// This is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation;
8
// either version 2.1 of the License, or (at your option) any later version.
10
// This software is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
// See the GNU Lesser General Public License for more details.
15
// To view the GNU Lesser General Public License visit
16
// http://www.gnu.org/copyleft/lesser.html
17
// or write to the Free Software Foundation, Inc.,
18
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
#ifndef _SCREENSAVER_MAC_H
25
#define _SCREENSAVER_MAC_H
27
#include <Carbon/Carbon.h>
35
int initBOINCSaver(Boolean ispreview);
36
int getSSMessage(char **theMessage, int* coveredFreq);
37
void drawPreview(CGContextRef myContext);
38
void closeBOINCSaver(void);
39
void print_to_log_file(const char *format, ...);
40
void strip_cr(char *buf);
47
//-----------------------------------------------------------------------------
48
// Name: class CScreensaver
49
// Desc: Screensaver class
50
//-----------------------------------------------------------------------------
61
// Infrastructure layer
64
OSStatus initBOINCApp(void);
66
char* PersistentFGets(char *buf, size_t buflen, FILE *f);
67
pid_t FindProcessPID(char* name, pid_t thePID);
68
OSErr GetpathToBOINCManagerApp(char* path, int maxLen);
69
bool SetError( bool bErrorMode, unsigned int hrError );
70
void UpdateProgressText(unsigned int hrError);
71
void setSSMessageText(const char *msg);
72
void updateSSMessageText(char *msg);
73
void strip_cr(char *buf);
74
char m_gfx_Switcher_Path[MAXPATHLEN];
75
bool m_bErrorMode; // Whether to display an error
76
unsigned int m_hrError; // Error code to display
78
bool m_wasAlreadyRunning;
79
pid_t m_CoreClientPID;
82
int m_iStatusUpdateCounter;
83
int m_iGraphicsStartingMsgCounter;
84
int m_iLastResultShown;
85
int m_tLastResultChangeCounter;
86
bool m_StatusMessageUpdated;
89
// Data management layer
92
bool CreateDataManagementThread();
93
bool DestroyDataManagementThread();
95
void* DataManagementProc();
96
static void* DataManagementProcStub( void* param );
97
int terminate_screensaver(int& graphics_application, RESULT *worker_app);
98
int launch_screensaver(RESULT* rp, int& graphics_application);
99
void HandleRPCError(void);
100
OSErr KillScreenSaver(void);
101
pthread_t m_hDataManagementThread;
102
pid_t m_hGraphicsApplication;
104
// Determine if two RESULT pointers refer to the same task
105
bool is_same_task(RESULT* taska, RESULT* taskb);
107
// Count the number of active graphics-capable apps
108
int count_active_graphic_apps(RESULTS& results, RESULT* exclude = NULL);
110
// Choose a ramdom graphics application from the vector that
113
RESULT* get_random_graphics_app(RESULTS& results, RESULT* exclude = NULL);
118
RESULT m_running_result;
119
bool m_updating_results;
121
bool m_bResetCoreState;
122
bool m_QuitDataManagementProc;
123
bool m_bV5_GFX_app_is_running;
127
// Presentation layer
131
char m_MessageText[2048];
132
char* m_CurrentBannerMessage;
135
int getSSMessage(char **theMessage, int* coveredFreq);
136
void drawPreview(CGContextRef myContext);
137
void ShutdownSaver();