Cocoa: Shutdown when window is closed
authorAndreas Färber <andreas.faerber@web.de>
Mon, 14 Dec 2009 21:13:27 +0000 (22:13 +0100)
committermalc <av1474@comtv.ru>
Thu, 7 Jan 2010 07:57:34 +0000 (10:57 +0300)
The application is not very useful once the guest window is closed.
QEMU is not a document-based application; terminating it automatically
saves the user another action and resembles SDL behavior.

v2:
- Use delegate method, suggested by Juha Riihimäki.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: malc <av1474@comtv.ru>
cocoa.m

diff --git a/cocoa.m b/cocoa.m
index 70c249b..57dcff8 100644 (file)
--- a/cocoa.m
+++ b/cocoa.m
@@ -783,6 +783,11 @@ static int cocoa_keycode_to_qemu(int keycode)
     exit(0);
 }
 
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
+{
+    return YES;
+}
+
 - (void)startEmulationWithArgc:(int)argc argv:(char**)argv
 {
     COCOA_DEBUG("QemuCocoaAppController: startEmulationWithArgc\n");