This patch makes the -full-screen option work under Mac OS X. 

Signed-off-by: John Arbuckle <programmingk...@gmail.com>

---
 ui/cocoa.m |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 685081e..3a70cfc 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -67,6 +67,7 @@ char **gArgv;
 /* bitmap_info is used in drawRect:. Starts with little endian format. */
 static int bitmap_info = kCGBitmapByteOrder32Little | 
kCGImageAlphaNoneSkipFirst;
 SInt32 current_mac_os_version;
+bool set_to_full_screen;

 // keymap conversion
 int keymap[] =
@@ -252,6 +253,20 @@ static void determineMacOSVersion()
     }
 }
 
+// Looks for the -full-screen option being sent to QEMU
+static void scanForFullScreenOption(int argc, char * argv[])
+{
+       set_to_full_screen = false;
+
+       // search for the -full-screen option
+       for(int i = 0; i < argc; i++) {
+           if(strcmp(argv[i], "-full-screen") == 0) {
+               set_to_full_screen = true;
+            break;
+           }
+       }
+}
+
 /*
  ------------------------------------------------------
     QemuCocoaView
@@ -911,6 +926,12 @@ QemuCocoaView *cocoaView;
               
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) 
contextInfo:NULL];
 #endif
     } else {
+        /* for activating full screen at launch */
+        if (set_to_full_screen == true) {
+            [NSApp activateIgnoringOtherApps: YES];
+            [self toggleFullScreen: nil];
+        }
+
         // or launch QEMU, with the global args
         [self startEmulationWithArgc:gArgc argv:(char **)gArgv];
     }
@@ -1002,6 +1023,8 @@ int main (int argc, const char * argv[]) {
     gArgv = (char **)argv;
     int i;
 
+    scanForFullScreenOption(argc, argv);
+
     /* In case we don't need to display a window, let's not do that */
     for (i = 1; i < argc; i++) {
         const char *opt = argv[i];
-- 
1.7.5.4

Reply via email to