svn path=/trunk/boinc/; revision=15694

This commit is contained in:
David Anderson 2008-07-28 02:13:35 +00:00
parent 796fdd51d9
commit be8638f095
2 changed files with 13 additions and 7 deletions

View File

@ -54,15 +54,20 @@ static bool need_show = false;
bool fullscreen;
void boinc_close_window_and_quit() {
void boinc_close_window_and_quit(const char* p) {
fprintf(stderr, "Quitting: %s\n", p);
exit(0);
}
void boinc_close_window_and_quit_aux() {
boinc_close_window_and_quit("GLUT close");
}
// This callback is invoked when a user presses a key.
//
void keyboardD(unsigned char key, int /*x*/, int /*y*/) {
if (fullscreen) {
boinc_close_window_and_quit();
boinc_close_window_and_quit("key down");
} else {
boinc_app_key_press((int) key, 0);
}
@ -70,7 +75,7 @@ void keyboardD(unsigned char key, int /*x*/, int /*y*/) {
void keyboardU(unsigned char key, int /*x*/, int /*y*/) {
if (fullscreen) {
boinc_close_window_and_quit();
boinc_close_window_and_quit("key up");
} else {
boinc_app_key_release((int) key, 0);
}
@ -79,7 +84,7 @@ void keyboardU(unsigned char key, int /*x*/, int /*y*/) {
void mouse_click(int button, int state, int x, int y){
clicked_button = button;
if (fullscreen) {
boinc_close_window_and_quit();
boinc_close_window_and_quit("mouse click");
} else {
if (state) {
boinc_app_mouse_button(x, y, button, false);
@ -91,7 +96,7 @@ void mouse_click(int button, int state, int x, int y){
void mouse_click_move(int x, int y){
if (fullscreen) {
boinc_close_window_and_quit();
boinc_close_window_and_quit("mouse move");
} else if (clicked_button == 2){
boinc_app_mouse_move(x, y, false, false, true);
} else if (clicked_button == 1){
@ -164,7 +169,7 @@ static void make_window() {
app_graphics_init();
#ifdef __APPLE__
glutWMCloseFunc(boinc_close_window_and_quit); // Enable the window's close box
glutWMCloseFunc(boinc_close_window_and_quit_aux); // Enable the window's close box
BringAppToFront();
// Show window only after a successful call to throttled_app_render();
// this avoids momentary display of old image when screensaver restarts
@ -204,7 +209,7 @@ static void timer_handler(int) {
checkparentcounter = 500 / TIMER_INTERVAL_MSEC;
if (getppid() == 1) {
// Quit graphics application if parent process no longer running
boinc_close_window_and_quit();
boinc_close_window_and_quit("parent dead");
}
}
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);

View File

@ -5990,4 +5990,5 @@ David 27 July 2008
api/
graphics2.h
graphics2_unix.C
graphics2_win.C