diff mbox

[v2] Makes -full-screen option work on Mac OS X

Message ID F0051F6E-BB68-4155-B947-096191E6C4FA@gmail.com
State New
Headers show

Commit Message

Programmingkid Jan. 12, 2015, 4:46 p.m. UTC
This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup. 

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

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

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

Comments

Peter Maydell Jan. 14, 2015, 5:09 p.m. UTC | #1
On 12 January 2015 at 16:46, Programmingkid <programmingkidx@gmail.com> wrote:
>  This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup.
>
> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>
> ---
> Removed the set_to_full_screen variable.
> Removed the scanForFullScreenOption() function.
>
>  ui/cocoa.m |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 685081e..4cb07ba 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -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

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
Programmingkid Jan. 14, 2015, 6:20 p.m. UTC | #2
On Jan 14, 2015, at 12:09 PM, Peter Maydell wrote:

> On 12 January 2015 at 16:46, Programmingkid <programmingkidx@gmail.com> wrote:
>> This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup.
>> 
>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>> 
>> ---
>> Removed the set_to_full_screen variable.
>> Removed the scanForFullScreenOption() function.
>> 
>> ui/cocoa.m |    6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>> 
>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>> index 685081e..4cb07ba 100644
>> --- a/ui/cocoa.m
>> +++ b/ui/cocoa.m
>> @@ -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
> 
> 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.
Programmingkid Jan. 20, 2015, 7:33 p.m. UTC | #3
On Jan 14, 2015, at 12:09 PM, Peter Maydell wrote:

> On 12 January 2015 at 16:46, Programmingkid <programmingkidx@gmail.com> wrote:
>> This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup.
>> 
>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>> 
>> ---
>> Removed the set_to_full_screen variable.
>> Removed the scanForFullScreenOption() function.
>> 
>> ui/cocoa.m |    6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>> 
>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>> index 685081e..4cb07ba 100644
>> --- a/ui/cocoa.m
>> +++ b/ui/cocoa.m
>> @@ -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
> 
> 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.
diff mbox

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 685081e..4cb07ba 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -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