2003-06-11 23:36:48 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
2003-05-15 17:10:26 +00:00
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
2003-06-11 23:36:48 +00:00
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2003-05-15 17:10:26 +00:00
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
2004-07-13 13:54:09 +00:00
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
2003-05-15 17:10:26 +00:00
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
2004-07-13 13:54:09 +00:00
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
2003-05-15 17:10:26 +00:00
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
|
2003-05-08 18:11:05 +00:00
|
|
|
// BOINC core client screensaver logic.
|
|
|
|
// The basic idea:
|
|
|
|
// when the core client goes into screensaver mode,
|
|
|
|
// it immediately creates a "curtain" fullscreen window
|
|
|
|
// (this ensures that no user input gets lost)
|
|
|
|
// It tells all apps to hide their graphics.
|
|
|
|
// It asks a graphic-capable app to do fullscreen graphics.
|
|
|
|
// If there is none, or if the app doesn't ack in 5 seconds,
|
|
|
|
// the core client draws the BOINC logo graphics in the curtain window.
|
|
|
|
// (There's no attempt to request graphics from another app.)
|
|
|
|
// When it's time to blank screen, it tells the graphics app,
|
|
|
|
// if any, to hide itself, and draws black in the curtain window.
|
|
|
|
// Leave screensaver mode if either:
|
|
|
|
// - the core client gets user input in the curtain window, or
|
|
|
|
// - the core client gets an END_SS message from the graphics app.
|
|
|
|
// In either case, it close the curtain window and restores all apps
|
|
|
|
// to their pre-screensaver state
|
|
|
|
|
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
|
|
|
|
|
|
|
class SS_LOGIC {
|
2004-10-25 20:16:30 +00:00
|
|
|
double blank_time; // 0 or time to blank screen
|
|
|
|
double ack_deadline; // when to give up on graphics app
|
2003-05-08 18:11:05 +00:00
|
|
|
public:
|
|
|
|
SS_LOGIC();
|
|
|
|
|
2003-05-09 21:54:23 +00:00
|
|
|
char ss_msg[256]; // message to display on BOINC screensaver
|
|
|
|
|
2004-10-25 20:16:30 +00:00
|
|
|
void start_ss(double blank_time);
|
2003-05-08 18:11:05 +00:00
|
|
|
void stop_ss();
|
|
|
|
void poll();
|
2004-07-19 20:37:45 +00:00
|
|
|
void reset();
|
2003-05-08 18:11:05 +00:00
|
|
|
bool do_ss; // true if we're acting like a screensaver
|
|
|
|
bool do_boinc_logo_ss; // true if we're bouncing the logo
|
|
|
|
bool do_blank; // true if we're drawing black
|
|
|
|
|
|
|
|
// invariants
|
|
|
|
//
|
|
|
|
// do_boinc_logo_ss and do_blank are not both true
|
|
|
|
// 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
|