diff --git a/api/graphics2.h b/api/graphics2.h index 39dea79080..3fa21286fd 100644 --- a/api/graphics2.h +++ b/api/graphics2.h @@ -23,6 +23,7 @@ extern void boinc_graphics_loop(int, char**); extern void* boinc_graphics_make_shmem(char*, int); extern void* boinc_graphics_get_shmem(char*); extern void boinc_set_windows_icon(const char* icon16,const char* icon48); +extern void boinc_close_window_and_quit(); #ifdef __cplusplus } diff --git a/api/graphics2_win.C b/api/graphics2_win.C index 34920913e1..c3eea452a0 100644 --- a/api/graphics2_win.C +++ b/api/graphics2_win.C @@ -39,8 +39,8 @@ static bool window_ready=false; static UINT_PTR gfx_timer_id = 0; static bool fullscreen; -void close_window() { - fprintf(stderr, "Close event detected, shutting down.\n"); +void boinc_close_window_and_quit() { + //fprintf(stderr, "Close event detected, shutting down.\n"); window_ready=false; wglMakeCurrent(NULL,NULL); // release GL rendering context @@ -55,6 +55,7 @@ void close_window() { if (hWnd) { DestroyWindow(hWnd); } + SendMessage(hWnd, WM_QUIT, 0, 0); } void SetupPixelFormat(HDC hDC) { @@ -204,7 +205,7 @@ LRESULT CALLBACK WndProc( case WM_KEYDOWN: if(!window_ready) return 0; if (fullscreen) { - close_window(); + boinc_close_window_and_quit(); } else { boinc_app_key_press((int)wParam, (int)lParam); } @@ -212,7 +213,7 @@ LRESULT CALLBACK WndProc( case WM_KEYUP: if(!window_ready) return 0; if (fullscreen) { - close_window(); + boinc_close_window_and_quit(); } else { boinc_app_key_release((int)wParam, (int)lParam); } @@ -226,7 +227,7 @@ LRESULT CALLBACK WndProc( if(!window_ready) return 0; if (fullscreen) { - close_window(); + boinc_close_window_and_quit(); } else { int which; bool down; @@ -242,7 +243,7 @@ LRESULT CALLBACK WndProc( GetCursorPos(&cPos); if (fullscreen) { if(cPos.x != mousePos.x || cPos.y != mousePos.y) { - close_window(); + boinc_close_window_and_quit(); } } else { boinc_app_mouse_move( @@ -254,10 +255,10 @@ LRESULT CALLBACK WndProc( } return 0; case WM_CLOSE: - close_window(); + boinc_close_window_and_quit(); return 0; case WM_SHUTDOWNGFX: - close_window(); + boinc_close_window_and_quit(); return 0; case WM_DESTROY: PostQuitMessage(0); diff --git a/checkin_notes b/checkin_notes index afbb0dd977..e78163ee03 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2845,3 +2845,10 @@ David Mar 31 2008 sched/ *.C server_types.h + +David Mar 31 2008 + - graphics API: add a boinc_close_window_and_quit() function + + api + graphics2.h + graphics2_win.C