mirror of https://github.com/BOINC/boinc.git
Fixes for V6 graphics.
svn path=/trunk/boinc/; revision=14768
This commit is contained in:
parent
54519a4ee1
commit
3a19ffb623
|
@ -899,6 +899,17 @@ static void timer_handler() {
|
|||
time_until_fraction_done_update = (int)aid.fraction_done_update_period;
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
static int xpos = 100, ypos = 100, width = 600, height = 400;
|
||||
static int clicked_button;
|
||||
static int win=0;
|
||||
static int checkparentcounter=0;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <sys/param.h> // for MAXPATHLEN
|
||||
|
@ -192,6 +193,18 @@ static void boinc_glut_init(int *argc, char** argv) {
|
|||
|
||||
static void timer_handler(int) {
|
||||
maybe_render();
|
||||
// When running under a V5 client, the worker app launches the graphics app
|
||||
// so this code kills the graphics when the worker application exits.
|
||||
// Under a V6 client, the Manager or Screensaver launched the graphics app
|
||||
// so this code kills the graphics when the Manager or Screensaver exits.
|
||||
if (--checkparentcounter < 0) {
|
||||
// Check approximately twice per second if parent process still running
|
||||
checkparentcounter = 500 / TIMER_INTERVAL_MSEC;
|
||||
if (getppid() == 1) {
|
||||
// Quit graphics application if parent process no longer running
|
||||
close_window();
|
||||
}
|
||||
}
|
||||
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1513,3 +1513,20 @@ David Feb 20 2008
|
|||
Makefile.am
|
||||
backend_lib.C,h
|
||||
create_work.C
|
||||
|
||||
Charlie Feb 20 2008
|
||||
- V6 GFX API: exit if parent application is no longer running. When running
|
||||
under a V5 client, the worker app launches the graphics app so this code
|
||||
kills the graphics when the worker application exits.
|
||||
Under a V6 client, the Manager or Screensaver launched the graphics app
|
||||
so this code kills the graphics when the Manager or Screensaver exits.
|
||||
- V6 GFX API: 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.)
|
||||
- Mac V6 GFX: Under sandbox, use switcher to kill graphics app when worker
|
||||
app has exited.
|
||||
|
||||
api/
|
||||
boinc_api.C
|
||||
graphics2_unix.C
|
||||
clientgui/
|
||||
MainDocument.cpp
|
||||
|
|
|
@ -1086,7 +1086,7 @@ RUNNING_GFX_APP* CMainDocument::GetRunningGraphicsApp(RESULT* result, int slot)
|
|||
}
|
||||
|
||||
// Graphics app is still running but the slot now has a different task
|
||||
kill_program((*gfx_app_iter).pid);
|
||||
KillGraphicsApp((*gfx_app_iter).pid);
|
||||
}
|
||||
|
||||
// Either the graphics app had already exited or we just killed it
|
||||
|
@ -1128,7 +1128,7 @@ void CMainDocument::KillInactiveGraphicsApps()
|
|||
}
|
||||
|
||||
if (!bStillRunning) {
|
||||
kill_program((*gfx_app_iter).pid);
|
||||
KillGraphicsApp((*gfx_app_iter).pid);
|
||||
gfx_app_iter = m_running_gfx_apps.erase(gfx_app_iter);
|
||||
} else {
|
||||
gfx_app_iter++;
|
||||
|
@ -1145,7 +1145,7 @@ void CMainDocument::KillAllRunningGraphicsApps()
|
|||
n = m_running_gfx_apps.size();
|
||||
for (i=0; i<n; i++) {
|
||||
gfx_app_iter = m_running_gfx_apps.begin();
|
||||
kill_program((*gfx_app_iter).pid);
|
||||
KillGraphicsApp((*gfx_app_iter).pid);
|
||||
(*gfx_app_iter).name.clear();
|
||||
(*gfx_app_iter).project_url.clear();
|
||||
m_running_gfx_apps.erase(gfx_app_iter);
|
||||
|
@ -1153,6 +1153,41 @@ void CMainDocument::KillAllRunningGraphicsApps()
|
|||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
void CMainDocument::KillGraphicsApp(HANDLE pid) {
|
||||
kill_program(pid);
|
||||
}
|
||||
#else
|
||||
void CMainDocument::KillGraphicsApp(int pid) {
|
||||
char* argv[6];
|
||||
char currentDir[MAXPATHLEN];
|
||||
char thePIDbuf[10];
|
||||
int id, iRetVal;
|
||||
|
||||
|
||||
if (g_use_sandbox) {
|
||||
snprintf(thePIDbuf, sizeof(thePIDbuf), "%d", pid);
|
||||
argv[0] = "switcher";
|
||||
argv[1] = "/bin/kill";
|
||||
argv[2] = "kill";
|
||||
argv[3] = "-KILL";
|
||||
argv[4] = thePIDbuf;
|
||||
argv[5] = 0;
|
||||
|
||||
iRetVal = run_program(
|
||||
getcwd(currentDir, sizeof(currentDir)),
|
||||
"./switcher/switcher",
|
||||
5,
|
||||
argv,
|
||||
0,
|
||||
id
|
||||
);
|
||||
} else {
|
||||
kill_program(pid);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int CMainDocument::WorkShowGraphics(RESULT* result)
|
||||
{
|
||||
int iRetVal = 0;
|
||||
|
|
|
@ -202,6 +202,11 @@ private:
|
|||
RUNNING_GFX_APP* GetRunningGraphicsApp(RESULT* result, int slot);
|
||||
void KillAllRunningGraphicsApps();
|
||||
void KillInactiveGraphicsApps();
|
||||
#ifdef _WIN32
|
||||
void KillGraphicsApp(HANDLE pid);
|
||||
#else
|
||||
void KillGraphicsApp(int tpid);
|
||||
#endif
|
||||
|
||||
public:
|
||||
RESULTS results;
|
||||
|
|
Loading…
Reference in New Issue