shithub: choc

Download patch

ref: 5014caee2a000ffd682f04bcbec76265b2163335
parent: 2c7cf58786bbf80d519b02b2c112a0a2c55d898e
author: Simon Howard <[email protected]>
date: Mon May 4 16:07:48 EDT 2009

Fix window close button to bring up F10 quit message.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1506

--- a/src/d_event.h
+++ b/src/d_event.h
@@ -42,7 +42,8 @@
     ev_keydown,
     ev_keyup,
     ev_mouse,
-    ev_joystick
+    ev_joystick,
+    ev_quit
 } evtype_t;
 
 // Event structure.
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1423,7 +1423,15 @@
     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;
--- a/src/heretic/mn_menu.c
+++ b/src/heretic/mn_menu.c
@@ -1042,6 +1042,14 @@
     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);
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -1132,6 +1132,14 @@
     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);
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -679,13 +679,10 @@
 		}
                 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