From f49188043b9ca4d28aeea82fa462282f58a36414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 13 Dec 2009 02:11:44 +0100 Subject: [PATCH] Cocoa: Don't unconditionally show the window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When QEMU was launched in no-graphic, Curses or VNC mode, don't run it as a Cocoa application. Based on patch by Alexander Graf. v1: - Avoid type mismatch warning for argv - Drop noCocoa variable - Coding Style changes Signed-off-by: Andreas Färber Cc: Alexander Graf Cc: Mike Kronenberg Signed-off-by: malc --- cocoa.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cocoa.m b/cocoa.m index d5f941bd53..70c249b113 100644 --- a/cocoa.m +++ b/cocoa.m @@ -855,6 +855,16 @@ int main (int argc, const char * argv[]) { gArgc = argc; gArgv = (char **)argv; CPSProcessSerNum PSN; + int i; + + /* In case we don't need to display a window, let's not do that */ + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-vnc") || + !strcmp(argv[i], "-nographic") || + !strcmp(argv[i], "-curses")) { + return qemu_main(gArgc, gArgv); + } + } NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [NSApplication sharedApplication];