qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 RESEND 00/11] Cocoa: ppc64 host support and various improvements
@ 2010-01-06 22:47 Andreas Färber
  2010-01-06 22:47 ` [Qemu-devel] [PATCH v2 RESEND 01/11] Cocoa: ppc64 host support Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Hello,

This is a resend of my full Cocoa series posted Dec 13, last updated on Dec 14
following a suggestion by Juha. Original intro follows.

Recently, OSX/ppc64 TCG support was merged. This series replaces the
remainder of my ppc64 series, splitting it up for review and bisectability.

It starts with fixing an essential 64-bit incompatibility,
followed by elimination of all cocoa.m warnings on a v10.5 ppc64 system.

Also included are respins of patches fixing errors/warnings on older hosts
and optimizing drawing. Support for -nographic is added.

New is my modification of window close behavior plus another drawing
optimization for non-overlapping Views.

Most of these patches do not depend on each other, so could be cherry-picked
if necessary.

Also available at git://repo.or.cz/qemu/afaerber.git, branch cocoa.

Regards,

Andreas

Andreas Färber (11):
  Cocoa: ppc64 host support
  Cocoa: Silence warning for cocoa_keycode_to_qemu
  Cocoa: Silence warning on Big Endian host
  Cocoa: Silence type warning
  Cocoa: Fix compilation on Mac OS X v10.4 and earlier
  Cocoa: Mark the View as opaque
  Cocoa: Redraw the View asynchronously
  Cocoa: Don't unconditionally show the window
  Cocoa: Shutdown when window is closed
  Cocoa: Suppress window resize animation
  Cocoa: Use optimized drawing for the window

 cocoa.m |   56 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 44 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 01/11] Cocoa: ppc64 host support
  2010-01-06 22:47 [Qemu-devel] [PATCH v2 RESEND 00/11] Cocoa: ppc64 host support and various improvements Andreas Färber
@ 2010-01-06 22:47 ` Andreas Färber
  2010-01-06 22:47   ` [Qemu-devel] [PATCH v2 RESEND 02/11] Cocoa: Silence warning for cocoa_keycode_to_qemu Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Fix integer usage in the Cocoa backend: NSInteger is long on LP64.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/uid/20000014-BBCFHHCD

This makes the graphical display show up on a ppc64 host.

v3:
- Confine NSInteger to Mac OS X v10.5 and later

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 cocoa.m |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index 55ff2b4..989efd5 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -28,6 +28,10 @@
 #include "console.h"
 #include "sysemu.h"
 
+#ifndef MAC_OS_X_VERSION_10_5
+#define MAC_OS_X_VERSION_10_5 1050
+#endif
+
 
 //#define DEBUG
 
@@ -337,7 +341,11 @@ int cocoa_keycode_to_qemu(int keycode)
         } else {
             // 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;
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 02/11] Cocoa: Silence warning for cocoa_keycode_to_qemu
  2010-01-06 22:47 ` [Qemu-devel] [PATCH v2 RESEND 01/11] Cocoa: ppc64 host support Andreas Färber
@ 2010-01-06 22:47   ` Andreas Färber
  2010-01-06 22:47     ` [Qemu-devel] [PATCH v2 RESEND 03/11] Cocoa: Silence warning on Big Endian host Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Arbuckle, Andreas Färber

Make cocoa_keycode_to_qemu static, to avoid:

warning: no previous prototype for ‘cocoa_keycode_to_qemu’

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: John Arbuckle <programmingkidx@gmail.com>
---
 cocoa.m |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index 989efd5..f80a70b 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -233,7 +233,7 @@ int keymap[] =
 */
 };
 
-int cocoa_keycode_to_qemu(int keycode)
+static int cocoa_keycode_to_qemu(int keycode)
 {
     if((sizeof(keymap)/sizeof(int)) <= keycode)
     {
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 03/11] Cocoa: Silence warning on Big Endian host
  2010-01-06 22:47   ` [Qemu-devel] [PATCH v2 RESEND 02/11] Cocoa: Silence warning for cocoa_keycode_to_qemu Andreas Färber
@ 2010-01-06 22:47     ` Andreas Färber
  2010-01-06 22:47       ` [Qemu-devel] [PATCH v2 RESEND 04/11] Cocoa: Silence type warning Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Arbuckle, Andreas Färber

__LITTLE_ENDIAN__ is undefined on Big Endian host.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: John Arbuckle <programmingkidx@gmail.com>
---
 cocoa.m |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index f80a70b..f8c2e00 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -319,7 +319,7 @@ static int cocoa_keycode_to_qemu(int keycode)
             screen.bitsPerComponent, //bitsPerComponent
             screen.bitsPerPixel, //bitsPerPixel
             (screen.width * (screen.bitsPerComponent/2)), //bytesPerRow
-#if __LITTLE_ENDIAN__
+#ifdef __LITTLE_ENDIAN__
             CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), //colorspace for OS X >= 10.4
             kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
 #else
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 04/11] Cocoa: Silence type warning
  2010-01-06 22:47     ` [Qemu-devel] [PATCH v2 RESEND 03/11] Cocoa: Silence warning on Big Endian host Andreas Färber
@ 2010-01-06 22:47       ` Andreas Färber
  2010-01-06 22:47         ` [Qemu-devel] [PATCH v2 RESEND 05/11] Cocoa: Fix compilation on Mac OS X v10.4 and earlier Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Arbuckle, Andreas Färber

Add const for "qemu" character literal, to avoid:

warning: initialization discards qualifiers from pointer target type

An earlier patch by John proposed to use char[5]. Since we do not modify
the text and later copy it into malloc'ed memory, marking it as const
seems sufficient.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: John Arbuckle <programmingkidx@gmail.com>
---
 cocoa.m |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index f8c2e00..0a95c77 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -791,7 +791,7 @@ static int cocoa_keycode_to_qemu(int keycode)
     if(returnCode == NSCancelButton) {
         exit(0);
     } else if(returnCode == NSOKButton) {
-        char *bin = "qemu";
+        const char *bin = "qemu";
         char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
 
         char **argv = (char**)malloc( sizeof(char*)*3 );
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 05/11] Cocoa: Fix compilation on Mac OS X v10.4 and earlier
  2010-01-06 22:47       ` [Qemu-devel] [PATCH v2 RESEND 04/11] Cocoa: Silence type warning Andreas Färber
@ 2010-01-06 22:47         ` Andreas Färber
  2010-01-06 22:47           ` [Qemu-devel] [PATCH v2 RESEND 06/11] Cocoa: Mark the View as opaque Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Arbuckle, Andreas Färber, Ryan Schmidt, Mike Kronenberg

NSView's enterFullScreenMode:withOptions: and
exitFullScreenModeWithOptions: are available on v10.5
and later only. Undefined methods raise warnings and
undefined constants result in errors.

Reported by Ryan Schmidt.

While at it, avoid a warning on v10.3.9,
where MAC_OS_X_VERSION_10_4 is not defined.

Spotted by John Arbuckle.

Fix associated comments.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: John Arbuckle <programmingkidx@gmail.com>
Cc: Ryan Schmidt <qemu-2009@ryandesign.com>
Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org>
---
 cocoa.m |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index 0a95c77..6f8b674 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -28,6 +28,9 @@
 #include "console.h"
 #include "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
@@ -331,7 +334,7 @@ static int cocoa_keycode_to_qemu(int keycode)
             0, //interpolate
             kCGRenderingIntentDefault //intent
         );
-// test if host support "CGImageCreateWithImageInRect" at compiletime
+// 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
@@ -428,8 +431,8 @@ static int cocoa_keycode_to_qemu(int keycode)
         isFullscreen = FALSE;
         [self ungrabMouse];
         [self setContentDimensions];
-// test if host support "enterFullScreenMode:withOptions" at compiletime
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+// 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 {
@@ -438,15 +441,15 @@ static int cocoa_keycode_to_qemu(int keycode)
             [normalWindow setContentView: self];
             [normalWindow makeKeyAndOrderFront: self];
             [NSMenu setMenuBarVisible:YES];
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
         }
 #endif
     } else { // switch from desktop to fullscreen
         isFullscreen = TRUE;
         [self grabMouse];
         [self setContentDimensions];
-// test if host support "enterFullScreenMode:withOptions" at compiletime
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+// 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,
@@ -462,7 +465,7 @@ static int cocoa_keycode_to_qemu(int keycode)
             [fullScreenWindow setHasShadow:NO];
             [fullScreenWindow setContentView:self];
             [fullScreenWindow makeKeyAndOrderFront:self];
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
         }
 #endif
     }
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 06/11] Cocoa: Mark the View as opaque
  2010-01-06 22:47         ` [Qemu-devel] [PATCH v2 RESEND 05/11] Cocoa: Fix compilation on Mac OS X v10.4 and earlier Andreas Färber
@ 2010-01-06 22:47           ` Andreas Färber
  2010-01-06 22:47             ` [Qemu-devel] [PATCH v2 RESEND 07/11] Cocoa: Redraw the View asynchronously Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mike Kronenberg, Alexander Graf, Andreas Färber,
	Juha Riihimäki

Default is NO.

Cf. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/CustomViews.html

Based on patch by Juha Riihimäki.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Juha Riihimäki <juha.riihimaki@nokia.com>
Cc: Alexander Graf <alex@csgraf.de>
Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org>
---
 cocoa.m |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index 6f8b674..dc9263a 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -305,6 +305,11 @@ static int cocoa_keycode_to_qemu(int keycode)
     [super dealloc];
 }
 
+- (BOOL) isOpaque
+{
+    return YES;
+}
+
 - (void) drawRect:(NSRect) rect
 {
     COCOA_DEBUG("QemuCocoaView: drawRect\n");
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 07/11] Cocoa: Redraw the View asynchronously
  2010-01-06 22:47           ` [Qemu-devel] [PATCH v2 RESEND 06/11] Cocoa: Mark the View as opaque Andreas Färber
@ 2010-01-06 22:47             ` Andreas Färber
  2010-01-06 22:47               ` [Qemu-devel] [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show the window Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mike Kronenberg, Alexander Graf, Andreas Färber,
	Juha Riihimäki

Cf. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/CustomViews.html

Based on patch by Juha Riihimäki.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Juha Riihimäki <juha.riihimaki@nokia.com>
Cc: Alexander Graf <alex@csgraf.de>
Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org>
---
 cocoa.m |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index dc9263a..d5f941b 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -938,7 +938,7 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
             w * [cocoaView cdx],
             h * [cocoaView cdy]);
     }
-    [cocoaView displayRect:rect];
+    [cocoaView setNeedsDisplayInRect:rect];
 }
 
 static void cocoa_resize(DisplayState *ds)
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show the window
  2010-01-06 22:47             ` [Qemu-devel] [PATCH v2 RESEND 07/11] Cocoa: Redraw the View asynchronously Andreas Färber
@ 2010-01-06 22:47               ` Andreas Färber
  2010-01-06 22:47                 ` [Qemu-devel] [PATCH v2 RESEND 09/11] Cocoa: Shutdown when window is closed Andreas Färber
  2010-01-06 22:49                 ` [Qemu-devel] Re: [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show " Alexander Graf
  0 siblings, 2 replies; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, Mike Kronenberg, Alexander Graf

When QEMU was launched in no-graphic, Curses or VNC mode,
don't run it as a Cocoa application.

Based on patch by Alexander Graf.

v1:
- Avoid type mismatch warning for argv
- Drop noCocoa variable
- Coding Style changes

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Alexander Graf <agraf@suse.de>
Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org>
---
 cocoa.m |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index d5f941b..70c249b 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -855,6 +855,16 @@ int main (int argc, const char * argv[]) {
     gArgc = argc;
     gArgv = (char **)argv;
     CPSProcessSerNum PSN;
+    int i;
+
+    /* In case we don't need to display a window, let's not do that */
+    for (i = 1; i < argc; i++) {
+        if (!strcmp(argv[i], "-vnc") ||
+            !strcmp(argv[i], "-nographic") ||
+            !strcmp(argv[i], "-curses")) {
+                return qemu_main(gArgc, gArgv);
+        }
+    }
 
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
     [NSApplication sharedApplication];
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 09/11] Cocoa: Shutdown when window is closed
  2010-01-06 22:47               ` [Qemu-devel] [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show the window Andreas Färber
@ 2010-01-06 22:47                 ` Andreas Färber
  2010-01-06 22:47                   ` [Qemu-devel] [PATCH v2 RESEND 10/11] Cocoa: Suppress window resize animation Andreas Färber
  2010-01-06 22:49                 ` [Qemu-devel] Re: [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show " Alexander Graf
  1 sibling, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, Juha Riihimäki

The application is not very useful once the guest window is closed.
QEMU is not a document-based application; terminating it automatically
saves the user another action and resembles SDL behavior.

v2:
- Use delegate method, suggested by Juha Riihimäki.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Juha Riihimäki <juha.riihimaki@nokia.com>
---
 cocoa.m |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index 70c249b..57dcff8 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -783,6 +783,11 @@ static int cocoa_keycode_to_qemu(int keycode)
     exit(0);
 }
 
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
+{
+    return YES;
+}
+
 - (void)startEmulationWithArgc:(int)argc argv:(char**)argv
 {
     COCOA_DEBUG("QemuCocoaAppController: startEmulationWithArgc\n");
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 10/11] Cocoa: Suppress window resize animation
  2010-01-06 22:47                 ` [Qemu-devel] [PATCH v2 RESEND 09/11] Cocoa: Shutdown when window is closed Andreas Färber
@ 2010-01-06 22:47                   ` Andreas Färber
  2010-01-06 22:47                     ` [Qemu-devel] [PATCH v2 RESEND 11/11] Cocoa: Use optimized drawing for the window Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mike Kronenberg, Alexander Graf, Andreas Färber,
	Juha Riihimäki

Disable the nice resize animation, to avoid drawing glitches
following a guest's screen size change.

Based on patch by Juha Riihimäki.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Juha Riihimäki <juha.riihimaki@nokia.com>
Cc: Alexander Graf <alex@csgraf.de>
Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org>
---
 cocoa.m |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index 57dcff8..bb4325c 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -419,7 +419,7 @@ static int cocoa_keycode_to_qemu(int keycode)
     } else {
         if (qemu_name)
             [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]];
-        [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, h + [normalWindow frame].size.height - screen.height) display:YES animate:YES];
+        [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + screen.height, w, h + [normalWindow frame].size.height - screen.height) display:YES animate:NO];
     }
     screen.width = w;
     screen.height = h;
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v2 RESEND 11/11] Cocoa: Use optimized drawing for the window
  2010-01-06 22:47                   ` [Qemu-devel] [PATCH v2 RESEND 10/11] Cocoa: Suppress window resize animation Andreas Färber
@ 2010-01-06 22:47                     ` Andreas Färber
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber

Default is NO.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 cocoa.m |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/cocoa.m b/cocoa.m
index bb4325c..56c789a 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -740,6 +740,7 @@ static int cocoa_keycode_to_qemu(int keycode)
         [normalWindow setAcceptsMouseMovedEvents:YES];
         [normalWindow setTitle:[NSString stringWithFormat:@"QEMU"]];
         [normalWindow setContentView:cocoaView];
+        [normalWindow useOptimizedDrawing:YES];
         [normalWindow makeKeyAndOrderFront:self];
 		[normalWindow center];
 
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] Re: [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show the window
  2010-01-06 22:47               ` [Qemu-devel] [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show the window Andreas Färber
  2010-01-06 22:47                 ` [Qemu-devel] [PATCH v2 RESEND 09/11] Cocoa: Shutdown when window is closed Andreas Färber
@ 2010-01-06 22:49                 ` Alexander Graf
  2010-01-06 23:18                   ` Andreas Färber
  1 sibling, 1 reply; 15+ messages in thread
From: Alexander Graf @ 2010-01-06 22:49 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Mike Kronenberg, qemu-devel


On 06.01.2010, at 23:47, Andreas Färber wrote:

> When QEMU was launched in no-graphic, Curses or VNC mode,
> don't run it as a Cocoa application.
> 
> Based on patch by Alexander Graf.
> 
> v1:
> - Avoid type mismatch warning for argv
> - Drop noCocoa variable
> - Coding Style changes
> 
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org>
> ---
> cocoa.m |   10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/cocoa.m b/cocoa.m
> index d5f941b..70c249b 100644
> --- a/cocoa.m
> +++ b/cocoa.m
> @@ -855,6 +855,16 @@ int main (int argc, const char * argv[]) {
>     gArgc = argc;
>     gArgv = (char **)argv;
>     CPSProcessSerNum PSN;
> +    int i;
> +
> +    /* In case we don't need to display a window, let's not do that */
> +    for (i = 1; i < argc; i++) {
> +        if (!strcmp(argv[i], "-vnc") ||
> +            !strcmp(argv[i], "-nographic") ||
> +            !strcmp(argv[i], "-curses")) {
> +                return qemu_main(gArgc, gArgv);
> +        }
> +    }

Hm, does that work with qemu -hda /tmp/bla.img -nographic?

Alex

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] Re: [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show the window
  2010-01-06 22:49                 ` [Qemu-devel] Re: [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show " Alexander Graf
@ 2010-01-06 23:18                   ` Andreas Färber
  2010-01-06 23:23                     ` Alexander Graf
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2010-01-06 23:18 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Mike Kronenberg, qemu-devel


Am 06.01.2010 um 23:49 schrieb Alexander Graf:

>
> On 06.01.2010, at 23:47, Andreas Färber wrote:
>
>> When QEMU was launched in no-graphic, Curses or VNC mode,
>> don't run it as a Cocoa application.
>>
>> Based on patch by Alexander Graf.
>>
>> v1:
>> - Avoid type mismatch warning for argv
>> - Drop noCocoa variable
>> - Coding Style changes
>>
>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>> Cc: Alexander Graf <agraf@suse.de>
>> Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org>
>> ---
>> cocoa.m |   10 ++++++++++
>> 1 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/cocoa.m b/cocoa.m
>> index d5f941b..70c249b 100644
>> --- a/cocoa.m
>> +++ b/cocoa.m
>> @@ -855,6 +855,16 @@ int main (int argc, const char * argv[]) {
>>    gArgc = argc;
>>    gArgv = (char **)argv;
>>    CPSProcessSerNum PSN;
>> +    int i;
>> +
>> +    /* In case we don't need to display a window, let's not do  
>> that */
>> +    for (i = 1; i < argc; i++) {
>> +        if (!strcmp(argv[i], "-vnc") ||
>> +            !strcmp(argv[i], "-nographic") ||
>> +            !strcmp(argv[i], "-curses")) {
>> +                return qemu_main(gArgc, gArgv);
>> +        }
>> +    }
>
> Hm, does that work with qemu -hda /tmp/bla.img -nographic?

Yes, your code! :) I just did the minor changes decribed unter v1.

I run Milax that way:
qemu-system-sparc64 -m 256 -boot d -cdrom milax032sparc.iso -nographic

Andreas

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] Re: [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show the window
  2010-01-06 23:18                   ` Andreas Färber
@ 2010-01-06 23:23                     ` Alexander Graf
  0 siblings, 0 replies; 15+ messages in thread
From: Alexander Graf @ 2010-01-06 23:23 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Mike Kronenberg, qemu-devel


On 07.01.2010, at 00:18, Andreas Färber wrote:

> 
> Am 06.01.2010 um 23:49 schrieb Alexander Graf:
> 
>> 
>> On 06.01.2010, at 23:47, Andreas Färber wrote:
>> 
>>> When QEMU was launched in no-graphic, Curses or VNC mode,
>>> don't run it as a Cocoa application.
>>> 
>>> Based on patch by Alexander Graf.
>>> 
>>> v1:
>>> - Avoid type mismatch warning for argv
>>> - Drop noCocoa variable
>>> - Coding Style changes
>>> 
>>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>>> Cc: Alexander Graf <agraf@suse.de>
>>> Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org>
>>> ---
>>> cocoa.m |   10 ++++++++++
>>> 1 files changed, 10 insertions(+), 0 deletions(-)
>>> 
>>> diff --git a/cocoa.m b/cocoa.m
>>> index d5f941b..70c249b 100644
>>> --- a/cocoa.m
>>> +++ b/cocoa.m
>>> @@ -855,6 +855,16 @@ int main (int argc, const char * argv[]) {
>>>   gArgc = argc;
>>>   gArgv = (char **)argv;
>>>   CPSProcessSerNum PSN;
>>> +    int i;
>>> +
>>> +    /* In case we don't need to display a window, let's not do that */
>>> +    for (i = 1; i < argc; i++) {
>>> +        if (!strcmp(argv[i], "-vnc") ||
>>> +            !strcmp(argv[i], "-nographic") ||
>>> +            !strcmp(argv[i], "-curses")) {
>>> +                return qemu_main(gArgc, gArgv);
>>> +        }
>>> +    }
>> 
>> Hm, does that work with qemu -hda /tmp/bla.img -nographic?
> 
> Yes, your code! :) I just did the minor changes decribed unter v1.

Oh, in case any of these arguments is passed, we just directly call the 'normal' main function. I was really being tricky back then :-).

Alex

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-01-06 23:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-06 22:47 [Qemu-devel] [PATCH v2 RESEND 00/11] Cocoa: ppc64 host support and various improvements Andreas Färber
2010-01-06 22:47 ` [Qemu-devel] [PATCH v2 RESEND 01/11] Cocoa: ppc64 host support Andreas Färber
2010-01-06 22:47   ` [Qemu-devel] [PATCH v2 RESEND 02/11] Cocoa: Silence warning for cocoa_keycode_to_qemu Andreas Färber
2010-01-06 22:47     ` [Qemu-devel] [PATCH v2 RESEND 03/11] Cocoa: Silence warning on Big Endian host Andreas Färber
2010-01-06 22:47       ` [Qemu-devel] [PATCH v2 RESEND 04/11] Cocoa: Silence type warning Andreas Färber
2010-01-06 22:47         ` [Qemu-devel] [PATCH v2 RESEND 05/11] Cocoa: Fix compilation on Mac OS X v10.4 and earlier Andreas Färber
2010-01-06 22:47           ` [Qemu-devel] [PATCH v2 RESEND 06/11] Cocoa: Mark the View as opaque Andreas Färber
2010-01-06 22:47             ` [Qemu-devel] [PATCH v2 RESEND 07/11] Cocoa: Redraw the View asynchronously Andreas Färber
2010-01-06 22:47               ` [Qemu-devel] [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show the window Andreas Färber
2010-01-06 22:47                 ` [Qemu-devel] [PATCH v2 RESEND 09/11] Cocoa: Shutdown when window is closed Andreas Färber
2010-01-06 22:47                   ` [Qemu-devel] [PATCH v2 RESEND 10/11] Cocoa: Suppress window resize animation Andreas Färber
2010-01-06 22:47                     ` [Qemu-devel] [PATCH v2 RESEND 11/11] Cocoa: Use optimized drawing for the window Andreas Färber
2010-01-06 22:49                 ` [Qemu-devel] Re: [PATCH v2 RESEND 08/11] Cocoa: Don't unconditionally show " Alexander Graf
2010-01-06 23:18                   ` Andreas Färber
2010-01-06 23:23                     ` Alexander Graf

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).