2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2003-05-15 17:10:26 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2003-05-15 17:10:26 +00:00
|
|
|
|
2003-05-09 00:00:39 +00:00
|
|
|
#ifndef _SS_LOGIC_
|
|
|
|
#define _SS_LOGIC_
|
|
|
|
|
2004-03-04 11:41:43 +00:00
|
|
|
#ifndef _WIN32
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <ctime>
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2003-05-08 18:11:05 +00:00
|
|
|
|
2005-04-04 21:14:49 +00:00
|
|
|
// the core client can be requested to provide screensaver graphics (SSG).
|
|
|
|
// The following are states of this function:
|
|
|
|
|
2005-04-04 00:35:56 +00:00
|
|
|
#define SS_STATUS_ENABLED 1
|
2005-04-04 21:14:49 +00:00
|
|
|
// requested to provide SSG
|
2005-04-04 00:35:56 +00:00
|
|
|
#define SS_STATUS_BLANKED 3
|
2005-04-04 21:14:49 +00:00
|
|
|
// not providing SSG, SS should blank screen
|
2005-04-04 00:35:56 +00:00
|
|
|
#define SS_STATUS_BOINCSUSPENDED 4
|
2005-04-04 21:14:49 +00:00
|
|
|
// not providing SS because suspended
|
2005-04-04 00:35:56 +00:00
|
|
|
#define SS_STATUS_NOAPPSEXECUTING 6
|
2005-04-04 21:14:49 +00:00
|
|
|
// no apps executing
|
2005-04-04 00:35:56 +00:00
|
|
|
#define SS_STATUS_NOGRAPHICSAPPSEXECUTING 7
|
2005-04-04 21:14:49 +00:00
|
|
|
// apps executing, but none graphical
|
2005-04-04 00:35:56 +00:00
|
|
|
#define SS_STATUS_QUIT 8
|
2005-04-04 21:14:49 +00:00
|
|
|
// not requested to provide SSG
|
|
|
|
#define SS_STATUS_NOPROJECTSDETECTED 9
|
2004-11-16 08:04:57 +00:00
|
|
|
|
2003-05-08 18:11:05 +00:00
|
|
|
class SS_LOGIC {
|
|
|
|
public:
|
|
|
|
|
2004-11-16 08:04:57 +00:00
|
|
|
SS_LOGIC();
|
2003-05-09 21:54:23 +00:00
|
|
|
|
2004-11-17 19:19:26 +00:00
|
|
|
void start_ss(GRAPHICS_MSG&, double blank_time);
|
2003-05-08 18:11:05 +00:00
|
|
|
void stop_ss();
|
2005-04-05 00:32:24 +00:00
|
|
|
void poll(double);
|
2004-07-19 20:37:45 +00:00
|
|
|
void reset();
|
2004-11-16 08:04:57 +00:00
|
|
|
int get_ss_status() { return ss_status; };
|
2005-04-05 00:32:24 +00:00
|
|
|
void ask_app(ACTIVE_TASK*, GRAPHICS_MSG&);
|
2004-11-16 08:04:57 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
double blank_time; // 0 or time to blank screen
|
|
|
|
double ack_deadline; // when to give up on graphics app
|
|
|
|
int ss_status; // the status of the screensaver from the core
|
|
|
|
// client perspective.
|
2003-05-08 18:11:05 +00:00
|
|
|
bool do_ss; // true if we're acting like a screensaver
|
2005-04-05 00:32:24 +00:00
|
|
|
GRAPHICS_MSG saved_graphics_msg;
|
2003-05-08 18:11:05 +00:00
|
|
|
|
|
|
|
// invariants
|
|
|
|
//
|
|
|
|
// at most one app has request_mode = FULLSCREEN
|
|
|
|
// pre-ss mode of all apps is not FULLSCREEN
|
|
|
|
};
|
2003-05-09 00:00:39 +00:00
|
|
|
|
|
|
|
#endif
|