mirror of https://github.com/BOINC/boinc.git
API: remove logic that makes new app graphics work with version 5 clients.
This commit is contained in:
parent
faae3aac3a
commit
67c20e9fce
|
@ -108,7 +108,7 @@
|
|||
|
||||
using std::vector;
|
||||
|
||||
//#define DEBUG_BOINC_API
|
||||
#define DEBUG_BOINC_API
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "mac_backtrace.h"
|
||||
|
@ -206,7 +206,6 @@ struct UPLOAD_FILE_STATUS {
|
|||
static bool have_new_upload_file;
|
||||
static std::vector<UPLOAD_FILE_STATUS> upload_file_status;
|
||||
|
||||
static void graphics_cleanup();
|
||||
static int resume_activities();
|
||||
static void boinc_exit(int);
|
||||
static void block_sigalrm();
|
||||
|
@ -712,8 +711,6 @@ void boinc_exit(int status) {
|
|||
int retval;
|
||||
char buf[256];
|
||||
|
||||
graphics_cleanup();
|
||||
|
||||
if (options.main_program && file_lock.locked) {
|
||||
retval = file_lock.unlock(LOCKFILE);
|
||||
if (retval) {
|
||||
|
@ -1084,122 +1081,6 @@ static void handle_process_control_msg() {
|
|||
}
|
||||
}
|
||||
|
||||
// The following is used by V6 apps so that graphics
|
||||
// will work with pre-V6 clients.
|
||||
// If we get a graphics message, run/kill the (separate) graphics app
|
||||
//
|
||||
//
|
||||
struct GRAPHICS_APP {
|
||||
bool fullscreen;
|
||||
#ifdef _WIN32
|
||||
HANDLE pid;
|
||||
#else
|
||||
int pid;
|
||||
#endif
|
||||
GRAPHICS_APP(bool f) {fullscreen=f;}
|
||||
void run(char* path) {
|
||||
int argc;
|
||||
char* argv[4];
|
||||
char abspath[MAXPATHLEN];
|
||||
#ifdef _WIN32
|
||||
GetFullPathName(path, MAXPATHLEN, abspath, NULL);
|
||||
#else
|
||||
strlcpy(abspath, path, sizeof(abspath));
|
||||
#endif
|
||||
argv[0] = const_cast<char*>(GRAPHICS_APP_FILENAME);
|
||||
if (fullscreen) {
|
||||
argv[1] = const_cast<char*>("--fullscreen");
|
||||
argv[2] = 0;
|
||||
argc = 2;
|
||||
} else {
|
||||
argv[1] = 0;
|
||||
argc = 1;
|
||||
}
|
||||
int retval = run_program(0, abspath, argc, argv, 0, pid);
|
||||
if (retval) {
|
||||
pid = 0;
|
||||
}
|
||||
}
|
||||
bool is_running() {
|
||||
if (pid && process_exists(pid)) return true;
|
||||
pid = 0;
|
||||
return false;
|
||||
}
|
||||
void kill() {
|
||||
if (pid) {
|
||||
kill_program(pid);
|
||||
pid = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static GRAPHICS_APP ga_win(false), ga_full(true);
|
||||
static bool have_graphics_app;
|
||||
|
||||
// The following is for backwards compatibility with version 5 clients.
|
||||
//
|
||||
static inline void handle_graphics_messages() {
|
||||
static char graphics_app_path[MAXPATHLEN];
|
||||
char buf[MSG_CHANNEL_SIZE];
|
||||
GRAPHICS_MSG m;
|
||||
static bool first=true;
|
||||
if (first) {
|
||||
first = false;
|
||||
boinc_resolve_filename(
|
||||
GRAPHICS_APP_FILENAME, graphics_app_path,
|
||||
sizeof(graphics_app_path)
|
||||
);
|
||||
// if the above returns "graphics_app", there was no link file,
|
||||
// so there's no graphics app
|
||||
//
|
||||
if (!strcmp(graphics_app_path, GRAPHICS_APP_FILENAME)) {
|
||||
have_graphics_app = false;
|
||||
} else {
|
||||
have_graphics_app = true;
|
||||
app_client_shm->shm->graphics_reply.send_msg(
|
||||
xml_graphics_modes[MODE_HIDE_GRAPHICS]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!have_graphics_app) return;
|
||||
|
||||
if (app_client_shm->shm->graphics_request.get_msg(buf)) {
|
||||
app_client_shm->decode_graphics_msg(buf, m);
|
||||
switch (m.mode) {
|
||||
case MODE_HIDE_GRAPHICS:
|
||||
if (ga_full.is_running()) {
|
||||
ga_full.kill();
|
||||
} else if (ga_win.is_running()) {
|
||||
ga_win.kill();
|
||||
}
|
||||
break;
|
||||
case MODE_WINDOW:
|
||||
if (!ga_win.is_running()) ga_win.run(graphics_app_path);
|
||||
break;
|
||||
case MODE_FULLSCREEN:
|
||||
if (!ga_full.is_running()) ga_full.run(graphics_app_path);
|
||||
break;
|
||||
case MODE_BLANKSCREEN:
|
||||
// we can't actually blank the screen; just kill the app
|
||||
//
|
||||
if (ga_full.is_running()) {
|
||||
ga_full.kill();
|
||||
}
|
||||
break;
|
||||
}
|
||||
app_client_shm->shm->graphics_reply.send_msg(
|
||||
xml_graphics_modes[m.mode]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void graphics_cleanup() {
|
||||
if (!have_graphics_app) return;
|
||||
if (ga_full.is_running()) ga_full.kill();
|
||||
if (ga_win.is_running()) ga_win.kill();
|
||||
}
|
||||
|
||||
// timer handler; runs in the timer thread
|
||||
//
|
||||
static void timer_handler() {
|
||||
|
@ -1238,7 +1119,6 @@ static void timer_handler() {
|
|||
if (options.handle_process_control) {
|
||||
handle_process_control_msg();
|
||||
}
|
||||
handle_graphics_messages();
|
||||
}
|
||||
|
||||
if (interrupt_count % TIMERS_PER_SEC) return;
|
||||
|
@ -1278,17 +1158,6 @@ static void timer_handler() {
|
|||
update_app_progress(last_wu_cpu_time, last_checkpoint_cpu_time);
|
||||
}
|
||||
|
||||
// If running under V5 client, notify the client if the graphics app exits
|
||||
// (e.g., if user clicked in the graphics window's close box.)
|
||||
//
|
||||
if (ga_win.pid) {
|
||||
if (!ga_win.is_running()) {
|
||||
app_client_shm->shm->graphics_reply.send_msg(
|
||||
xml_graphics_modes[MODE_HIDE_GRAPHICS]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.handle_trickle_ups) {
|
||||
send_trickle_up_msg();
|
||||
}
|
||||
|
|
|
@ -41,20 +41,6 @@
|
|||
|
||||
using std::string;
|
||||
|
||||
const char* xml_graphics_modes[NGRAPHICS_MSGS] = {
|
||||
"<mode_unsupported/>",
|
||||
"<mode_hide_graphics/>",
|
||||
"<mode_window/>",
|
||||
"<mode_fullscreen/>",
|
||||
"<mode_blankscreen/>",
|
||||
"<reread_prefs/>",
|
||||
"<mode_quit/>"
|
||||
};
|
||||
|
||||
GRAPHICS_MSG::GRAPHICS_MSG() {
|
||||
memset(this, 0, sizeof(GRAPHICS_MSG));
|
||||
}
|
||||
|
||||
APP_INIT_DATA::APP_INIT_DATA() : project_preferences(NULL) {
|
||||
}
|
||||
|
||||
|
@ -430,22 +416,6 @@ void MSG_CHANNEL::send_msg_overwrite(const char* msg) {
|
|||
buf[0] = 1;
|
||||
}
|
||||
|
||||
int APP_CLIENT_SHM::decode_graphics_msg(char* msg, GRAPHICS_MSG& m) {
|
||||
int i;
|
||||
|
||||
parse_str(msg, "<window_station>", m.window_station, sizeof(m.window_station));
|
||||
parse_str(msg, "<desktop>", m.desktop, sizeof(m.desktop));
|
||||
parse_str(msg, "<display>", m.display, sizeof(m.display));
|
||||
|
||||
m.mode = 0;
|
||||
for (i=0; i<NGRAPHICS_MSGS; i++) {
|
||||
if (match_tag(msg, xml_graphics_modes[i])) {
|
||||
m.mode = i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void APP_CLIENT_SHM::reset_msgs() {
|
||||
memset(shm, 0, sizeof(SHARED_MEM));
|
||||
}
|
||||
|
|
|
@ -74,13 +74,11 @@ struct SHARED_MEM {
|
|||
// app->core
|
||||
MSG_CHANNEL graphics_request;
|
||||
// core->app
|
||||
// request a graphics mode:
|
||||
// <mode_hide_graphics/>
|
||||
// ...
|
||||
// <mode_blankscreen/>
|
||||
// not currently used
|
||||
MSG_CHANNEL graphics_reply;
|
||||
// app->core
|
||||
// same as above
|
||||
// <web_graphics_url>
|
||||
// <remote_desktop_addr>
|
||||
MSG_CHANNEL heartbeat;
|
||||
// core->app
|
||||
// <heartbeat/> sent every second, even while app is suspended
|
||||
|
@ -120,20 +118,10 @@ struct MSG_QUEUE {
|
|||
#define SHM_PREFIX "shm_"
|
||||
#define QUIT_PREFIX "quit_"
|
||||
|
||||
struct GRAPHICS_MSG {
|
||||
int mode;
|
||||
char window_station[256];
|
||||
char desktop[256];
|
||||
char display[256];
|
||||
|
||||
GRAPHICS_MSG();
|
||||
};
|
||||
|
||||
class APP_CLIENT_SHM {
|
||||
public:
|
||||
SHARED_MEM *shm;
|
||||
|
||||
int decode_graphics_msg(char*, GRAPHICS_MSG&);
|
||||
void reset_msgs(); // resets all messages and clears their flags
|
||||
|
||||
APP_CLIENT_SHM();
|
||||
|
@ -252,7 +240,6 @@ int parse_graphics_file(FILE* f, GRAPHICS_INFO* gi);
|
|||
// other filenames
|
||||
#define PROJECT_DIR "projects"
|
||||
|
||||
extern const char* xml_graphics_modes[NGRAPHICS_MSGS];
|
||||
extern int boinc_link(const char* phys_name, const char* logical_name);
|
||||
extern int boinc_resolve_filename_s(const char*, std::string&);
|
||||
extern void url_to_project_dir(char* url, char* dir);
|
||||
|
|
Loading…
Reference in New Issue