qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Programmingkid <programmingkidx@gmail.com>
To: qemu-devel qemu-devel <qemu-devel@nongnu.org>
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PATCH] Makes -full-screen option work on Mac OS X
Date: Sun, 11 Jan 2015 19:31:18 -0500	[thread overview]
Message-ID: <60B7B5DB-1DEE-4FA3-B97A-6695746EA427@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]

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

Signed-off-by: John Arbuckle <programmingkidx@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


[-- Attachment #2: Type: text/html, Size: 12292 bytes --]

             reply	other threads:[~2015-01-12  0:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12  0:31 Programmingkid [this message]
2015-01-12 16:10 ` [Qemu-devel] [PATCH] Makes -full-screen option work on Mac OS X Peter Maydell
2015-01-12 16:16   ` Programmingkid

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60B7B5DB-1DEE-4FA3-B97A-6695746EA427@gmail.com \
    --to=programmingkidx@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).