- graphics API: add a boinc_close_window_and_quit() function

svn path=/trunk/boinc/; revision=14987
This commit is contained in:
David Anderson 2008-03-31 17:03:00 +00:00
parent 6af9f66b4e
commit 06c1d1392f
3 changed files with 17 additions and 8 deletions

View File

@ -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
}

View File

@ -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);

View File

@ -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