Skip to contentSkip to conversation

Makes -full-screen option work on Mac OS X

PATCH Superseded Programmingkid 2 participants 4 messages Jan 12, 2015 – Jan 20, 2015

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Makes -full-screen option work on Mac OS X

This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup.

---
Removed the set_to_full_screen variable.
Removed the scanForFullScreenOption() function.

 ui/cocoa.m |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
ui/cocoa.m +6 -0
index 685081e..4cb07ba 100644
@@ -1163,6 +1163,12 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
 {
     COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
 
+    /* if fullscreen mode is to be used */
+    if (full_screen == true) {
+        [NSApp activateIgnoringOtherApps: YES];
+        [[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
+    }
+
     dcl = g_malloc0(sizeof(DisplayChangeListener));
 
     // register vga output callbacks
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 18 lines · Programmingkid

This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup.

---
Removed the set_to_full_screen variable.
Removed the scanForFullScreenOption() function.

 ui/cocoa.m |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
ui/cocoa.m +0 -0
index 685081e..4cb07ba 100644
@@ -1163,6 +1163,12 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
 {
     COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");

ui/cocoa.m void cocoa_display_init(DisplayState *ds, int full_screen) · line 1174

Quoted 10 lines
ui/cocoa.m +6 -0
 
+    /* if fullscreen mode is to be used */
+    if (full_screen == true) {
+        [NSApp activateIgnoringOtherApps: YES];
+        [[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
+    }
+
     dcl = g_malloc0(sizeof(DisplayChangeListener));
 
     // register vga output callbacks

This generates a compile warning for me:
/Users/pm215/src/qemu/ui/cocoa.m:1150:55: warning: instance method '-toggleFullScreen:' not found (return type defaults to 'id')

      [-Wobjc-method-access]
        [[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
                                                      ^~~~~~~~~~~~~~~~

thanks
-- PMM

#2 lore raw
Quoted 28 lines · Peter Maydell
Quoted 27 lines · Programmingkid

This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup.

---
Removed the set_to_full_screen variable.
Removed the scanForFullScreenOption() function.

ui/cocoa.m | 6 ++++++

1 files changed, 6 insertions(+), 0 deletions(-)
ui/cocoa.m +6 -0
index 685081e..4cb07ba 100644
@@ -1163,6 +1163,12 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
 {
    COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
 
+    /* if fullscreen mode is to be used */
+    if (full_screen == true) {
+        [NSApp activateIgnoringOtherApps: YES];
+        [[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
+    }
+
    dcl = g_malloc0(sizeof(DisplayChangeListener));
 
Quoted 8 lines

ui/cocoa.m void cocoa_display_init(DisplayState *ds, int full_screen) · line 1174

Quoted 1 line
ui/cocoa.m +0 -0
    // register vga output callbacks

This generates a compile warning for me:
/Users/pm215/src/qemu/ui/cocoa.m:1150:55: warning: instance method '-toggleFullScreen:' not found (return type defaults to 'id')

     [-Wobjc-method-access]
       [[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
                                                     ^~~~~~~~~~~~~~~~

I will see what I can do.

#3 lore raw
In reply to Peter Maydell
Quoted 28 lines · Peter Maydell
Quoted 27 lines · Programmingkid

This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup.

---
Removed the set_to_full_screen variable.
Removed the scanForFullScreenOption() function.

ui/cocoa.m | 6 ++++++

1 files changed, 6 insertions(+), 0 deletions(-)
ui/cocoa.m +6 -0
index 685081e..4cb07ba 100644
@@ -1163,6 +1163,12 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
 {
    COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
 
+    /* if fullscreen mode is to be used */
+    if (full_screen == true) {
+        [NSApp activateIgnoringOtherApps: YES];
+        [[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
+    }
+
    dcl = g_malloc0(sizeof(DisplayChangeListener));
 
Quoted 8 lines

ui/cocoa.m void cocoa_display_init(DisplayState *ds, int full_screen) · line 1174

Quoted 1 line
ui/cocoa.m +0 -0
    // register vga output callbacks

This generates a compile warning for me:
/Users/pm215/src/qemu/ui/cocoa.m:1150:55: warning: instance method '-toggleFullScreen:' not found (return type defaults to 'id')

     [-Wobjc-method-access]
       [[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
                                                     ^~~~~~~~~~~~~~~~

Would you accept a patch that eliminated this warning by disabling -Wobjc-method-access?

The problem is Objective-C classes usually are in two files, the header and the .m file. Cocoa.m places both the interface and implementation of the QemuCocoaAppController in one file, so that is why I think we are seeing this message.