From 5014caee2a000ffd682f04bcbec76265b2163335 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 4 May 2009 20:07:48 +0000 Subject: Fix window close button to bring up F10 quit message. Subversion-branch: /branches/raven-branch Subversion-revision: 1506 --- src/d_event.h | 3 ++- src/doom/m_menu.c | 10 +++++++++- src/heretic/mn_menu.c | 8 ++++++++ src/hexen/mn_menu.c | 8 ++++++++ src/i_video.c | 7 ++----- 5 files changed, 29 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/d_event.h b/src/d_event.h index da3ee926..e47f82df 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -42,7 +42,8 @@ typedef enum ev_keydown, ev_keyup, ev_mouse, - ev_joystick + ev_joystick, + ev_quit } evtype_t; // Event structure. diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c index a5e81775..4ca30926 100644 --- a/src/doom/m_menu.c +++ b/src/doom/m_menu.c @@ -1423,7 +1423,15 @@ boolean M_Responder (event_t* ev) static int lasty = 0; static int mousex = 0; static int lastx = 0; - + + // "close" button pressed on window? + if (ev->type == ev_quit) + { + S_StartSound(NULL,sfx_swtchn); + M_QuitDOOM(0); + return true; + } + // key is the key pressed, ch is the actual character typed ch = 0; diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 0bc9d994..1dc1f289 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -1042,6 +1042,14 @@ boolean MN_Responder(event_t * event) extern void G_CheckDemoStatus(void); char *textBuffer; + // "close" button pressed on window? + if (event->type == ev_quit) + { + SCQuitGame(0); + S_StartSound(NULL, sfx_chat); + return true; + } + if (event->data1 == KEY_RSHIFT) { shiftdown = (event->type == ev_keydown); diff --git a/src/hexen/mn_menu.c b/src/hexen/mn_menu.c index dd508e28..3ac9c609 100644 --- a/src/hexen/mn_menu.c +++ b/src/hexen/mn_menu.c @@ -1132,6 +1132,14 @@ boolean MN_Responder(event_t * event) extern void G_CheckDemoStatus(void); char *textBuffer; + // "close" button pressed on window? + if (event->type == ev_quit) + { + SCQuitGame(0); + S_StartSound(NULL, SFX_CHAT); + return true; + } + if (event->data1 == KEY_RSHIFT) { shiftdown = (event->type == ev_keydown); diff --git a/src/i_video.c b/src/i_video.c index 8360ab9e..ac25e9ad 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -679,13 +679,10 @@ void I_GetEvent(void) } break; -/* TODO case SDL_QUIT: - // bring up the "quit doom?" prompt - S_StartSound(NULL,sfx_swtchn); - M_QuitDOOM(0); + event.type = ev_quit; + D_PostEvent(&event); break; - */ case SDL_ACTIVEEVENT: // need to update our focus state -- cgit v1.2.3