Skip to contentSkip to conversation

cocoa queue

GIT PULL Applied Peter Maydell 1 participant 12 messages May 19, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

Outstanding cocoa patches; there are more on list but I wanted to flush the queue rather than hanging onto these any longer.

thanks
-- PMM

The following changes since commit 62bf3df432d93fa6eb0f355c460d6d784b7cbc1a:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150518-3' into staging (2015-05-18 20:23:16 +0100)

are available in the git repository at:

git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-cocoa-20150519

for you to fetch changes up to b4c6a112dcfa1d24b905e6cccc763e02000937f1:

ui/cocoa: Add console items to the View menu (2015-05-19 09:11:18 +0100)

----------------------------------------------------------------
cocoa queue:
* fix various issues with full screen in the OSX UI
* set an icon for our binary file
* add entries to the View menu for QEMU consoles
* fix various warnings that are produced when building on 10.10 (largely deprecated interfaces)

----------------------------------------------------------------
Peter Maydell (6):
ui/cocoa: Drop tests for CGImageCreateWithImageInRect support ui/cocoa: Remove compatibility ifdefs for OSX 10.4
ui/cocoa: openPanelDidEnd returnCode should be NSInteger, not int ui/cocoa: Declare that QemuCocoaAppController implements NSApplicationDelegate ui/cocoa: Don't use NSWindow useOptimizedDrawing on OSX 10.10 and up ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constants

Programmingkid (4):
ui/cocoa: Fix several full screen issues on Mac OS X ui/cocoa: Make -full-screen option work on Mac OS X Makefile.target: set icon for binary file on Mac OS X ui/cocoa: Add console items to the View menu

 Makefile.target   |    4 +
 pc-bios/qemu.rsrc | 1504 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/cocoa.m        |  181 +++++--
 3 files changed, 1634 insertions(+), 55 deletions(-)
 create mode 100644 pc-bios/qemu.rsrc
#1 lore raw

[Qemu-devel] [PULL 09/10] ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constants

In OSX 10.10, the NSOKButton and NSCancelButton constants are deprecated and provoke compiler warnings. Avoid them by using the NSFileHandlingPanelCancelButton and NSFileHandlingPanelOKButton constants instead. These are the documented correct constants for the 10.6-and-up beginSheetModalForWindow API we use. We also use the same method for the pre-10.6 compatibility code path, but conveniently the constant values are the same and the constant names have been present since 10.0. Preferring the constant names that match the non-legacy API makes more sense anyway.

Message-id: [email protected]

---
 ui/cocoa.m | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
ui/cocoa.m +8 -2
index fade0fd..0a51fbc 100644
@@ -902,9 +902,15 @@ QemuCocoaView *cocoaView;
 {
     COCOA_DEBUG("QemuCocoaAppController: openPanelDidEnd\n");
 
-    if(returnCode == NSCancelButton) {
+    /* The NSFileHandlingPanelOKButton/NSFileHandlingPanelCancelButton values for
+     * returnCode strictly only apply for the 10.6-and-up beginSheetModalForWindow
+     * API. For the legacy pre-10.6 beginSheetForDirectory API they are NSOKButton
+     * and NSCancelButton. However conveniently the values are the same.
+     * We use the non-legacy names because the others are deprecated in OSX 10.10.
+     */
+    if (returnCode == NSFileHandlingPanelCancelButton) {
         exit(0);
-    } else if(returnCode == NSOKButton) {
+    } else if (returnCode == NSFileHandlingPanelOKButton) {
         char *img = (char*)[ [ [ sheet URL ] path ] cStringUsingEncoding:NSASCIIStringEncoding];
 
         char **argv = g_new(char *, 4);
Signature · 1 line
1.9.1
#2 lore raw

[Qemu-devel] [PULL 10/10] ui/cocoa: Add console items to the View menu

In reply to Peter Maydell

From: Programmingkid <[email protected]>

Add any console that is available to the current emulator as a menu item under the View menu.

[PMM: Adjusted to apply after zoom-to-fit menu item was added;
create the View menu at the same time as all the others, and only add the dynamically-determined items to it later]

---
 ui/cocoa.m | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)
ui/cocoa.m +38 -1
index 0a51fbc..85cb24c 100644
@@ -799,6 +799,7 @@ QemuCocoaView *cocoaView;
 - (void)showQEMUDoc:(id)sender;
 - (void)showQEMUTec:(id)sender;
 - (void)zoomToFit:(id) sender;
+- (void)displayConsole:(id)sender;
 @end
 
 @implementation QemuCocoaAppController
@@ -970,8 +971,13 @@ QemuCocoaView *cocoaView;
         [sender setState: NSOffState];
     }
 }
-@end
 
+/* Displays the console on the screen */
+- (void)displayConsole:(id)sender
+{
+    console_select([sender tag]);
+}
+@end
 
 
 int main (int argc, const char * argv[]) {
@@ -1144,6 +1150,32 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_refresh = cocoa_refresh,
 };
 
+/* Returns a name for a given console */
+static NSString * getConsoleName(QemuConsole * console)
+{
+    return [NSString stringWithFormat: @"%s", qemu_console_get_label(console)];
+}
+
+/* Add an entry to the View menu for each console */
+static void add_console_menu_entries(void)
+{
+    NSMenu *menu;
+    NSMenuItem *menuItem;
+    int index = 0;
+
+    menu = [[[NSApp mainMenu] itemWithTitle:@"View"] submenu];
+
+    [menu addItem:[NSMenuItem separatorItem]];
+
+    while (qemu_console_lookup_by_index(index) != NULL) {
+        menuItem = [[[NSMenuItem alloc] initWithTitle: getConsoleName(qemu_console_lookup_by_index(index))
+                                               action: @selector(displayConsole:) keyEquivalent: @""] autorelease];
+        [menuItem setTag: index];
+        [menu addItem: menuItem];
+        index++;
+    }
+}
+
 void cocoa_display_init(DisplayState *ds, int full_screen)
 {
     COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
@@ -1162,4 +1194,9 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
 
     // register cleanup function
     atexit(cocoa_cleanup);
+
+    /* At this point QEMU has created all the consoles, so we can add View
+     * menu entries for them.
+     */
+    add_console_menu_entries();
 }
Signature · 1 line
1.9.1
#3 lore raw

[Qemu-devel] [PULL 01/10] ui/cocoa: Fix several full screen issues on Mac OS X

In reply to Peter Maydell

From: Programmingkid <[email protected]>

This patch makes several changes:
- Minimizes distorted full screen display by respecting aspect ratios.
- Makes full screen mode available on Mac OS 10.7 and higher.
- Allows user to decide if video should be stretched to fill the screen, using a menu item called "Zoom To Fit".
- Hides the normalWindow so it won't show up in full screen mode.
- Allows user to exit full screen mode.

[PMM: minor whitespace tweaks, remove incorrectly duplicated
use of 'f' menu accelerator key]

---
 ui/cocoa.m | 49 +++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 45 insertions(+), 4 deletions(-)
ui/cocoa.m +45 -4
index d37c29b..351b71f 100644
@@ -64,6 +64,7 @@ static int last_buttons;
 
 int gArgc;
 char **gArgv;
+bool stretch_video;
 
 // keymap conversion
 int keymap[] =
@@ -418,6 +419,18 @@ QemuCocoaView *cocoaView;
     if (isFullscreen) {
         cdx = [[NSScreen mainScreen] frame].size.width / (float)screen.width;
         cdy = [[NSScreen mainScreen] frame].size.height / (float)screen.height;
+
+        /* stretches video, but keeps same aspect ratio */
+        if (stretch_video == true) {
+            /* use smallest stretch value - prevents clipping on sides */
+            if (MIN(cdx, cdy) == cdx) {
+                cdy = cdx;
+            } else {
+                cdx = cdy;
+            }
+        } else {  /* No stretching */
+            cdx = cdy = 1;
+        }
         cw = screen.width * cdx;
         ch = screen.height * cdy;
         cx = ([[NSScreen mainScreen] frame].size.width - cw) / 2.0;
@@ -502,6 +515,7 @@ QemuCocoaView *cocoaView;
 #endif
     } else { // switch from desktop to fullscreen
         isFullscreen = TRUE;
+        [normalWindow orderOut: nil]; /* Hide the window */
         [self grabMouse];
         [self setContentDimensions];
 // test if host supports "enterFullScreenMode:withOptions" at compile time
@@ -518,8 +532,11 @@ QemuCocoaView *cocoaView;
                 styleMask:NSBorderlessWindowMask
                 backing:NSBackingStoreBuffered
                 defer:NO];
+            [fullScreenWindow setAcceptsMouseMovedEvents: YES];
             [fullScreenWindow setHasShadow:NO];
-            [fullScreenWindow setContentView:self];
+            [fullScreenWindow setBackgroundColor: [NSColor blackColor]];
+            [self setFrame:NSMakeRect(cx, cy, cw, ch)];
+            [[fullScreenWindow contentView] addSubview: self];
             [fullScreenWindow makeKeyAndOrderFront:self];
 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
         }
@@ -561,7 +578,7 @@ QemuCocoaView *cocoaView;
             }
 
             // release Mouse grab when pressing ctrl+alt
-            if (!isFullscreen && ([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
+            if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
                 [self ungrabMouse];
             }
             break;
@@ -798,9 +815,11 @@ QemuCocoaView *cocoaView;
 }
 - (void)startEmulationWithArgc:(int)argc argv:(char**)argv;
 - (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
+- (void)doToggleFullScreen:(id)sender;
 - (void)toggleFullScreen:(id)sender;
 - (void)showQEMUDoc:(id)sender;
 - (void)showQEMUTec:(id)sender;
+- (void)zoomToFit:(id) sender;
 @end
 
 @implementation QemuCocoaAppController
@@ -832,7 +851,7 @@ QemuCocoaView *cocoaView;
         [normalWindow useOptimizedDrawing:YES];
         [normalWindow makeKeyAndOrderFront:self];
         [normalWindow center];
-
+        stretch_video = false;
     }
     return self;
 }
@@ -921,6 +940,16 @@ QemuCocoaView *cocoaView;
         [self startEmulationWithArgc:3 argv:(char**)argv];
     }
 }
+
+/* We abstract the method called by the Enter Fullscreen menu item
+ * because Mac OS 10.7 and higher disables it. This is because of the
+ * menu item's old selector's name toggleFullScreen:
+ */
+- (void) doToggleFullScreen:(id)sender
+{
+    [self toggleFullScreen:(id)sender];
+}
+
 - (void)toggleFullScreen:(id)sender
 {
     COCOA_DEBUG("QemuCocoaAppController: toggleFullScreen\n");
@@ -943,6 +972,17 @@ QemuCocoaView *cocoaView;
     [[NSWorkspace sharedWorkspace] openFile:[NSString stringWithFormat:@"%@/../doc/qemu/qemu-tech.html",
         [[NSBundle mainBundle] resourcePath]] withApplication:@"Help Viewer"];
 }
+
+/* Stretches video to fit host monitor size */
+- (void)zoomToFit:(id) sender
+{
+    stretch_video = !stretch_video;
+    if (stretch_video == true) {
+        [sender setState: NSOnState];
+    } else {
+        [sender setState: NSOffState];
+    }
+}
 @end
 
 
@@ -1005,7 +1045,8 @@ int main (int argc, const char * argv[]) {
 
     // View menu
     menu = [[NSMenu alloc] initWithTitle:@"View"];
-    [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Enter Fullscreen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"] autorelease]]; // Fullscreen
+    [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Enter Fullscreen" action:@selector(doToggleFullScreen:) keyEquivalent:@"f"] autorelease]]; // Fullscreen
+    [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Zoom To Fit" action:@selector(zoomToFit:) keyEquivalent:@""] autorelease]];
     menuItem = [[[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""] autorelease];
     [menuItem setSubmenu:menu];
     [[NSApp mainMenu] addItem:menuItem];
Signature · 1 line
1.9.1
#4 lore raw

[Qemu-devel] [PULL 04/10] ui/cocoa: Drop tests for CGImageCreateWithImageInRect support

In reply to Peter Maydell

The code that tries to test at both compiletime and runtime for whether CGImageCreateWithImageInRect is supported provokes a compile warning on OSX 10.3:

ui/cocoa.m:378:13: warning: comparison of function 'CGImageCreateWithImageInRect'
equal to a null pointer is always false[-Wtautological-pointer-compare]
if (CGImageCreateWithImageInRect == NULL) { // test if "CGImageCreateWithImageInRect" is
supported on host at runtime

            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~    ~~~~

The simplest way to deal with this is just to drop this code, since we don't in practice support OSX 10.4 anyway. (10.5 was released in 2007 and is the last PPC version, so is the earliest we really need to continue to support at all.)

Message-id: [email protected]

---
 ui/cocoa.m | 50 ++++++++++++++++++++------------------------------
 1 file changed, 20 insertions(+), 30 deletions(-)
ui/cocoa.m +20 -30
index d1d29bc..6e69952 100644
@@ -374,40 +374,30 @@ QemuCocoaView *cocoaView;
             0, //interpolate
             kCGRenderingIntentDefault //intent
         );
-// test if host supports "CGImageCreateWithImageInRect" at compile time
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
-        if (CGImageCreateWithImageInRect == NULL) { // test if "CGImageCreateWithImageInRect" is supported on host at runtime
-#endif
-            // compatibility drawing code (draws everything) (OS X < 10.4)
-            CGContextDrawImage (viewContextRef, CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height), imageRef);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
-        } else {
-            // selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
-            const NSRect *rectList;
+        // selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
+        const NSRect *rectList;
 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
-            NSInteger rectCount;
+        NSInteger rectCount;
 #else
-            int rectCount;
+        int rectCount;
 #endif
-            int i;
-            CGImageRef clipImageRef;
-            CGRect clipRect;
-
-            [self getRectsBeingDrawn:&rectList count:&rectCount];
-            for (i = 0; i < rectCount; i++) {
-                clipRect.origin.x = rectList[i].origin.x / cdx;
-                clipRect.origin.y = (float)screen.height - (rectList[i].origin.y + rectList[i].size.height) / cdy;
-                clipRect.size.width = rectList[i].size.width / cdx;
-                clipRect.size.height = rectList[i].size.height / cdy;
-                clipImageRef = CGImageCreateWithImageInRect(
-                    imageRef,
-                    clipRect
-                );
-                CGContextDrawImage (viewContextRef, cgrect(rectList[i]), clipImageRef);
-                CGImageRelease (clipImageRef);
-            }
+        int i;
+        CGImageRef clipImageRef;
+        CGRect clipRect;
+
+        [self getRectsBeingDrawn:&rectList count:&rectCount];
+        for (i = 0; i < rectCount; i++) {
+            clipRect.origin.x = rectList[i].origin.x / cdx;
+            clipRect.origin.y = (float)screen.height - (rectList[i].origin.y + rectList[i].size.height) / cdy;
+            clipRect.size.width = rectList[i].size.width / cdx;
+            clipRect.size.height = rectList[i].size.height / cdy;
+            clipImageRef = CGImageCreateWithImageInRect(
+                                                        imageRef,
+                                                        clipRect
+                                                        );
+            CGContextDrawImage (viewContextRef, cgrect(rectList[i]), clipImageRef);
+            CGImageRelease (clipImageRef);
         }
-#endif
         CGImageRelease (imageRef);
     }
 }
Signature · 1 line
1.9.1
#5 lore raw

[Qemu-devel] [PULL 05/10] ui/cocoa: Remove compatibility ifdefs for OSX 10.4

In reply to Peter Maydell

Remove compatibility ifdefs that work around OSX 10.4 not providing various typedefs and functions.

Message-id: [email protected]

---
 ui/cocoa.m | 17 -----------------
 1 file changed, 17 deletions(-)
ui/cocoa.m +0 -17
index 6e69952..f6c5fb4 100644
@@ -30,9 +30,6 @@
 #include "ui/input.h"
 #include "sysemu/sysemu.h"
 
-#ifndef MAC_OS_X_VERSION_10_4
-#define MAC_OS_X_VERSION_10_4 1040
-#endif
 #ifndef MAC_OS_X_VERSION_10_5
 #define MAC_OS_X_VERSION_10_5 1050
 #endif
@@ -376,11 +373,7 @@ QemuCocoaView *cocoaView;
         );
         // selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
         const NSRect *rectList;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
         NSInteger rectCount;
-#else
-        int rectCount;
-#endif
         int i;
         CGImageRef clipImageRef;
         CGRect clipRect;
@@ -490,33 +483,25 @@ QemuCocoaView *cocoaView;
         isFullscreen = FALSE;
         [self ungrabMouse];
         [self setContentDimensions];
-// test if host supports "exitFullScreenModeWithOptions" at compile time
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
         if ([NSView respondsToSelector:@selector(exitFullScreenModeWithOptions:)]) { // test if "exitFullScreenModeWithOptions" is supported on host at runtime
             [self exitFullScreenModeWithOptions:nil];
         } else {
-#endif
             [fullScreenWindow close];
             [normalWindow setContentView: self];
             [normalWindow makeKeyAndOrderFront: self];
             [NSMenu setMenuBarVisible:YES];
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
         }
-#endif
     } else { // switch from desktop to fullscreen
         isFullscreen = TRUE;
         [normalWindow orderOut: nil]; /* Hide the window */
         [self grabMouse];
         [self setContentDimensions];
-// test if host supports "enterFullScreenMode:withOptions" at compile time
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
         if ([NSView respondsToSelector:@selector(enterFullScreenMode:withOptions:)]) { // test if "enterFullScreenMode:withOptions" is supported on host at runtime
             [self enterFullScreenMode:[NSScreen mainScreen] withOptions:[NSDictionary dictionaryWithObjectsAndKeys:
                 [NSNumber numberWithBool:NO], NSFullScreenModeAllScreens,
                 [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], kCGDisplayModeIsStretched, nil], NSFullScreenModeSetting,
                  nil]];
         } else {
-#endif
             [NSMenu setMenuBarVisible:NO];
             fullScreenWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame]
                 styleMask:NSBorderlessWindowMask
@@ -528,9 +513,7 @@ QemuCocoaView *cocoaView;
             [self setFrame:NSMakeRect(cx, cy, cw, ch)];
             [[fullScreenWindow contentView] addSubview: self];
             [fullScreenWindow makeKeyAndOrderFront:self];
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
         }
-#endif
     }
 }
 
Signature · 1 line
1.9.1
#6 lore raw

[Qemu-devel] [PULL 06/10] ui/cocoa: openPanelDidEnd returnCode should be NSInteger, not int

In reply to Peter Maydell

The type for openPanelDidEnd's returnCode argument should be NSInteger, not int. This only matters for the OSX 10.5 code path where we pass the method directly to an OSX function to call.

Message-id: [email protected]

---
 ui/cocoa.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ui/cocoa.m +2 -2
index f6c5fb4..563ea47 100644
@@ -787,7 +787,7 @@ QemuCocoaView *cocoaView;
 {
 }
 - (void)startEmulationWithArgc:(int)argc argv:(char**)argv;
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
 - (void)doToggleFullScreen:(id)sender;
 - (void)toggleFullScreen:(id)sender;
 - (void)showQEMUDoc:(id)sender;
@@ -890,7 +890,7 @@ QemuCocoaView *cocoaView;
     exit(status);
 }
 
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
 {
     COCOA_DEBUG("QemuCocoaAppController: openPanelDidEnd\n");
 
Signature · 1 line
1.9.1
#7 lore raw

[Qemu-devel] [PULL 07/10] ui/cocoa: Declare that QemuCocoaAppController implements NSApplicationDelegate

In reply to Peter Maydell

Our class QemuCocoaAppController implements the NSApplicationDelegate interface, and we pass an object of this class to [NSApp setDelegate]. However, we weren't declaring in the class definition that we implemented this interface; in OSX 10.10 this provokes the following (slighly misleading) warning:
ui/cocoa.m:1031:24: warning: sending 'QemuCocoaAppController *' to parameter of

      incompatible type 'id<NSFileManagerDelegate>'
    [NSApp setDelegate:appController];
                       ^~~~~~~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:109:47:
note: passing argument to parameter 'delegate' here
@property (assign) id <NSFileManagerDelegate> delegate NS_AVAILABLE(10_5,
2_0);
                                              ^

Annoyingly, this interface wasn't formally defined until OSX 10.6, so we have to surround the relevant part of the @interface line with an ifdef.

Message-id: [email protected]

---
 ui/cocoa.m | 3 +++
 1 file changed, 3 insertions(+)
ui/cocoa.m +3 -0
index 563ea47..e7b29e0 100644
@@ -784,6 +784,9 @@ QemuCocoaView *cocoaView;
  ------------------------------------------------------
 */
 @interface QemuCocoaAppController : NSObject
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
+                                             <NSApplicationDelegate>
+#endif
 {
 }
 - (void)startEmulationWithArgc:(int)argc argv:(char**)argv;
Signature · 1 line
1.9.1
#8 lore raw

[Qemu-devel] [PULL 02/10] ui/cocoa: Make -full-screen option work on Mac OS X

In reply to Peter Maydell

From: Programmingkid <[email protected]>

This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup, on Mac OS X.

---
 ui/cocoa.m | 6 ++++++
 1 file changed, 6 insertions(+)
ui/cocoa.m +6 -0
index 351b71f..d1d29bc 100644
@@ -1161,6 +1161,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];
+        [(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
+    }
+
     dcl = g_malloc0(sizeof(DisplayChangeListener));
 
     // register vga output callbacks
Signature · 1 line
1.9.1
#9 lore raw

[Qemu-devel] [PULL 08/10] ui/cocoa: Don't use NSWindow useOptimizedDrawing on OSX 10.10 and up

In reply to Peter Maydell

Starting in OSX 10.10, NSWindow useOptimizedDrawing is deprecated, so don't use it there.

Message-id: [email protected]

---
 ui/cocoa.m | 5 +++++
 1 file changed, 5 insertions(+)
ui/cocoa.m +5 -0
index e7b29e0..fade0fd 100644
@@ -36,6 +36,9 @@
 #ifndef MAC_OS_X_VERSION_10_6
 #define MAC_OS_X_VERSION_10_6 1060
 #endif
+#ifndef MAC_OS_X_VERSION_10_10
+#define MAC_OS_X_VERSION_10_10 101000
+#endif
 
 
 //#define DEBUG
@@ -824,7 +827,9 @@ QemuCocoaView *cocoaView;
         [normalWindow setAcceptsMouseMovedEvents:YES];
         [normalWindow setTitle:[NSString stringWithFormat:@"QEMU"]];
         [normalWindow setContentView:cocoaView];
+#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10)
         [normalWindow useOptimizedDrawing:YES];
+#endif
         [normalWindow makeKeyAndOrderFront:self];
         [normalWindow center];
         stretch_video = false;
Signature · 1 line
1.9.1
#10 lore raw

[Qemu-devel] [PULL 03/10] Makefile.target: set icon for binary file on Mac OS X

In reply to Peter Maydell

From: Programmingkid <[email protected]>

Implements setting the icon for the binary file in Mac OS X.

[PMM: tweaked makefile to use $@ and quiet-command]
---
 Makefile.target   |    4 +
 pc-bios/qemu.rsrc | 1504 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1508 insertions(+)
 create mode 100644 pc-bios/qemu.rsrc
Makefile.target +4 -0
index 1083377..be01dd3 100644
@@ -180,6 +180,10 @@ $(QEMU_PROG_BUILD): config-devices.mak
 # build either PROG or PROGW
 $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
 	$(call LINK, $(filter-out %.mak, $^))
+ifdef CONFIG_DARWIN
+	$(call quiet-command,Rez -append $(SRC_PATH)/pc-bios/qemu.rsrc -o $@,"  REZ   $(TARGET_DIR)$@")
+	$(call quiet-command,SetFile -a C $@,"  SETFILE $(TARGET_DIR)$@")
+endif
 
 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
 	$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
pc-bios/qemu.rsrc new file +1504 -0

1,504 lines not on this page · raw message

Signature · 1 line
1.9.1
author Applied
#11 lore raw
In reply to Peter Maydell
Quoted 19 lines · Peter Maydell

Outstanding cocoa patches; there are more on list but I wanted to flush the queue rather than hanging onto these any longer.

thanks
-- PMM

The following changes since commit 62bf3df432d93fa6eb0f355c460d6d784b7cbc1a:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150518-3' into staging (2015-05-18 20:23:16 +0100)

are available in the git repository at:

git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-cocoa-20150519

for you to fetch changes up to b4c6a112dcfa1d24b905e6cccc763e02000937f1:

ui/cocoa: Add console items to the View menu (2015-05-19 09:11:18 +0100)

Quoted 7 lines

----------------------------------------------------------------
cocoa queue:
* fix various issues with full screen in the OSX UI
* set an icon for our binary file
* add entries to the View menu for QEMU consoles
* fix various warnings that are produced when building on 10.10 (largely deprecated interfaces)

Applied, thanks.

-- PMM