* [Qemu-devel] Cocoa: ppc64 host support and various improvements @ 2009-12-13 2:55 Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 01/11] Cocoa: ppc64 host support Andreas Färber 0 siblings, 1 reply; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 UTC (permalink / raw) To: qemu-devel Hello, 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 01/11] Cocoa: ppc64 host support 2009-12-13 2:55 [Qemu-devel] Cocoa: ppc64 host support and various improvements Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 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 @ 2009-12-13 2:55 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 02/11] Cocoa: Silence warning for cocoa_keycode_to_qemu 2009-12-13 2:55 ` [Qemu-devel] [PATCH 01/11] Cocoa: ppc64 host support Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 03/11] Cocoa: Silence warning on Big Endian host Andreas Färber 0 siblings, 1 reply; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 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 03/11] Cocoa: Silence warning on Big Endian host 2009-12-13 2:55 ` [Qemu-devel] [PATCH 02/11] Cocoa: Silence warning for cocoa_keycode_to_qemu Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 04/11] Cocoa: Silence type warning Andreas Färber 0 siblings, 1 reply; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 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 04/11] Cocoa: Silence type warning 2009-12-13 2:55 ` [Qemu-devel] [PATCH 03/11] Cocoa: Silence warning on Big Endian host Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 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 @ 2009-12-13 2:55 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 05/11] Cocoa: Fix compilation on Mac OS X v10.4 and earlier 2009-12-13 2:55 ` [Qemu-devel] [PATCH 04/11] Cocoa: Silence type warning Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 06/11] Cocoa: Mark the View as opaque Andreas Färber 0 siblings, 1 reply; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 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 06/11] Cocoa: Mark the View as opaque 2009-12-13 2:55 ` [Qemu-devel] [PATCH 05/11] Cocoa: Fix compilation on Mac OS X v10.4 and earlier Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 07/11] Cocoa: Redraw the View asynchronously Andreas Färber 0 siblings, 1 reply; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 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 07/11] Cocoa: Redraw the View asynchronously 2009-12-13 2:55 ` [Qemu-devel] [PATCH 06/11] Cocoa: Mark the View as opaque Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 08/11] Cocoa: Don't unconditionally show the window Andreas Färber 0 siblings, 1 reply; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 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 08/11] Cocoa: Don't unconditionally show the window 2009-12-13 2:55 ` [Qemu-devel] [PATCH 07/11] Cocoa: Redraw the View asynchronously Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Andreas Färber 0 siblings, 1 reply; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 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 09/11] Cocoa: Shutdown when window is closed 2009-12-13 2:55 ` [Qemu-devel] [PATCH 08/11] Cocoa: Don't unconditionally show the window Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 10/11] Cocoa: Suppress window resize animation Andreas Färber 2009-12-14 7:04 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Juha.Riihimaki 0 siblings, 2 replies; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 UTC (permalink / raw) To: qemu-devel; +Cc: Alexander Graf, Andreas Färber, Mike Kronenberg 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. Signed-off-by: Andreas Färber <andreas.faerber@web.de> Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org> Cc: Alexander Graf <alex@csgraf.de> --- cocoa.m | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/cocoa.m b/cocoa.m index 70c249b..09ed3cd 100644 --- a/cocoa.m +++ b/cocoa.m @@ -712,6 +712,7 @@ static int cocoa_keycode_to_qemu(int keycode) - (void)toggleFullScreen:(id)sender; - (void)showQEMUDoc:(id)sender; - (void)showQEMUTec:(id)sender; +- (void)windowWillClose:(NSNotification *)notification; @end @implementation QemuCocoaAppController @@ -737,6 +738,7 @@ static int cocoa_keycode_to_qemu(int keycode) fprintf(stderr, "(cocoa) can't create window\n"); exit(1); } + [normalWindow setDelegate:self]; [normalWindow setAcceptsMouseMovedEvents:YES]; [normalWindow setTitle:[NSString stringWithFormat:@"QEMU"]]; [normalWindow setContentView:cocoaView]; @@ -835,6 +837,11 @@ static int cocoa_keycode_to_qemu(int keycode) [[NSWorkspace sharedWorkspace] openFile:[NSString stringWithFormat:@"%@/../doc/qemu/qemu-tech.html", [[NSBundle mainBundle] resourcePath]] withApplication:@"Help Viewer"]; } + +- (void)windowWillClose:(NSNotification *)notification +{ + [NSApp terminate:self]; +} @end -- 1.6.5.3 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 10/11] Cocoa: Suppress window resize animation 2009-12-13 2:55 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 11/11] Cocoa: Use optimized drawing for the window Andreas Färber 2009-12-14 7:04 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Juha.Riihimaki 1 sibling, 1 reply; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 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 09ed3cd..7179151 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 11/11] Cocoa: Use optimized drawing for the window 2009-12-13 2:55 ` [Qemu-devel] [PATCH 10/11] Cocoa: Suppress window resize animation Andreas Färber @ 2009-12-13 2:55 ` Andreas Färber 0 siblings, 0 replies; 15+ messages in thread From: Andreas Färber @ 2009-12-13 2:55 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 7179151..fa64cf3 100644 --- a/cocoa.m +++ b/cocoa.m @@ -742,6 +742,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
* Re: [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed 2009-12-13 2:55 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 10/11] Cocoa: Suppress window resize animation Andreas Färber @ 2009-12-14 7:04 ` Juha.Riihimaki 2009-12-14 21:25 ` [Qemu-devel] [PATCH v2 " Andreas Färber 2009-12-14 21:44 ` [Qemu-devel] [PATCH " Andreas Färber 1 sibling, 2 replies; 15+ messages in thread From: Juha.Riihimaki @ 2009-12-14 7:04 UTC (permalink / raw) To: andreas.faerber; +Cc: alex, mike.kronenberg, qemu-devel On Dec 13, 2009, at 04:55, ext Andreas Färber wrote: > 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. > > Signed-off-by: Andreas Färber <andreas.faerber@web.de> > Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org> > Cc: Alexander Graf <alex@csgraf.de> > --- > cocoa.m | 7 +++++++ > 1 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/cocoa.m b/cocoa.m > index 70c249b..09ed3cd 100644 > --- a/cocoa.m > +++ b/cocoa.m > @@ -712,6 +712,7 @@ static int cocoa_keycode_to_qemu(int keycode) > - (void)toggleFullScreen:(id)sender; > - (void)showQEMUDoc:(id)sender; > - (void)showQEMUTec:(id)sender; > +- (void)windowWillClose:(NSNotification *)notification; > @end > > @implementation QemuCocoaAppController > @@ -737,6 +738,7 @@ static int cocoa_keycode_to_qemu(int keycode) > fprintf(stderr, "(cocoa) can't create window\n"); > exit(1); > } > + [normalWindow setDelegate:self]; > [normalWindow setAcceptsMouseMovedEvents:YES]; > [normalWindow setTitle:[NSString stringWithFormat:@"QEMU"]]; > [normalWindow setContentView:cocoaView]; > @@ -835,6 +837,11 @@ static int cocoa_keycode_to_qemu(int keycode) > [[NSWorkspace sharedWorkspace] openFile:[NSString stringWithFormat:@"%@/../doc/qemu/qemu-tech.html", > [[NSBundle mainBundle] resourcePath]] withApplication:@"Help Viewer"]; > } > + > +- (void)windowWillClose:(NSNotification *)notification > +{ > + [NSApp terminate:self]; > +} > @end > Another way to achieve the same thing is to instead of the above changes just introduce a new method for the QemuCocoaAppController like: - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { return YES; } Regards, Juha ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH v2 09/11] Cocoa: Shutdown when window is closed 2009-12-14 7:04 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Juha.Riihimaki @ 2009-12-14 21:25 ` Andreas Färber 2009-12-14 21:44 ` [Qemu-devel] [PATCH " Andreas Färber 1 sibling, 0 replies; 15+ messages in thread From: Andreas Färber @ 2009-12-14 21:25 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
* Re: [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed 2009-12-14 7:04 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Juha.Riihimaki 2009-12-14 21:25 ` [Qemu-devel] [PATCH v2 " Andreas Färber @ 2009-12-14 21:44 ` Andreas Färber 1 sibling, 0 replies; 15+ messages in thread From: Andreas Färber @ 2009-12-14 21:44 UTC (permalink / raw) To: Juha.Riihimaki; +Cc: Alexander Graf, Mike Kronenberg, QEMU Developers Hi, Am 14.12.2009 um 08:04 schrieb <Juha.Riihimaki@nokia.com> <Juha.Riihimaki@nokia.com >: > > On Dec 13, 2009, at 04:55, ext Andreas Färber wrote: > >> 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. >> >> Signed-off-by: Andreas Färber <andreas.faerber@web.de> >> Cc: Mike Kronenberg <mike.kronenberg@kronenberg.org> >> Cc: Alexander Graf <alex@csgraf.de> >> --- >> cocoa.m | 7 +++++++ >> 1 files changed, 7 insertions(+), 0 deletions(-) >> >> diff --git a/cocoa.m b/cocoa.m >> index 70c249b..09ed3cd 100644 >> --- a/cocoa.m >> +++ b/cocoa.m >> @@ -835,6 +837,11 @@ static int cocoa_keycode_to_qemu(int keycode) >> [[NSWorkspace sharedWorkspace] openFile:[NSString >> stringWithFormat:@"%@/../doc/qemu/qemu-tech.html", >> [[NSBundle mainBundle] resourcePath]] withApplication:@"Help >> Viewer"]; >> } >> + >> +- (void)windowWillClose:(NSNotification *)notification >> +{ >> + [NSApp terminate:self]; >> +} >> @end >> > > Another way to achieve the same thing is to instead of the above > changes just introduce a new method for the QemuCocoaAppController > like: > > - (BOOL)applicationShouldTerminateAfterLastWindowClosed: > (NSApplication *)theApplication > { > return YES; > } That's ingenious. I had searched for something like this, but around NSWindow... thanks! Any other comments? Would you like to add an SoB to the now four patches proposed by you? Regards, Andreas ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2009-12-14 21:48 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-12-13 2:55 [Qemu-devel] Cocoa: ppc64 host support and various improvements Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 01/11] Cocoa: ppc64 host support Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 02/11] Cocoa: Silence warning for cocoa_keycode_to_qemu Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 03/11] Cocoa: Silence warning on Big Endian host Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 04/11] Cocoa: Silence type warning Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 05/11] Cocoa: Fix compilation on Mac OS X v10.4 and earlier Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 06/11] Cocoa: Mark the View as opaque Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 07/11] Cocoa: Redraw the View asynchronously Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 08/11] Cocoa: Don't unconditionally show the window Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 10/11] Cocoa: Suppress window resize animation Andreas Färber 2009-12-13 2:55 ` [Qemu-devel] [PATCH 11/11] Cocoa: Use optimized drawing for the window Andreas Färber 2009-12-14 7:04 ` [Qemu-devel] [PATCH 09/11] Cocoa: Shutdown when window is closed Juha.Riihimaki 2009-12-14 21:25 ` [Qemu-devel] [PATCH v2 " Andreas Färber 2009-12-14 21:44 ` [Qemu-devel] [PATCH " Andreas Färber
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).