changeset 25179:6e8b40d412f0

Fix play window not get actived problem on Leopard.
author ulion
date Fri, 30 Nov 2007 00:03:01 +0000
parents e9d23081b4ab
children 48fe4b6e3bab
files libvo/vo_macosx.m
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_macosx.m	Thu Nov 29 23:32:08 2007 +0000
+++ b/libvo/vo_macosx.m	Fri Nov 30 00:03:01 2007 +0000
@@ -63,6 +63,8 @@
 static float winAlpha = 1;
 static int int_pause = 0;
 
+static BOOL isLeopardOrLater;
+
 static vo_info_t info = 
 {
 	"Mac OSX Core Video",
@@ -301,6 +303,7 @@
 	NSApplicationLoad();
 	autoreleasepool = [[NSAutoreleasePool alloc] init];
 	NSApp = [NSApplication sharedApplication];
+	isLeopardOrLater = floor(NSAppKitVersionNumber) > 824;
 	
 	if(!shared_buffer)
 	{
@@ -878,6 +881,16 @@
 	if (event == nil)
 		return;
 	[NSApp sendEvent:event];
+	// Without SDL's bootstrap code (include SDL.h in mplayer.c),
+	// on Leopard, we got trouble to get the play window auto focused
+	// when app is actived. Following code fix this problem.
+#ifndef HAVE_SDL
+	if (isLeopardOrLater && [event type] == NSAppKitDefined
+			&& [event subtype] == NSApplicationActivatedEventType) {
+		[window makeMainWindow];
+		[window makeKeyAndOrderFront:mpGLView];
+	}
+#endif
 }
 
 /*