[MPlayer-cvslog] r30964 - in trunk/libvo: osx_common.c osx_common.h vo_corevideo.m vo_quartz.c

diego subversion at mplayerhq.hu
Fri Mar 26 16:02:14 CET 2010


Author: diego
Date: Fri Mar 26 16:02:14 2010
New Revision: 30964

Log:
Refactor OS X foreground process setting into a separate function.

Modified:
   trunk/libvo/osx_common.c
   trunk/libvo/osx_common.h
   trunk/libvo/vo_corevideo.m
   trunk/libvo/vo_quartz.c

Modified: trunk/libvo/osx_common.c
==============================================================================
--- trunk/libvo/osx_common.c	Fri Mar 26 13:12:25 2010	(r30963)
+++ trunk/libvo/osx_common.c	Fri Mar 26 16:02:14 2010	(r30964)
@@ -19,6 +19,7 @@
 
 // only to get keycode definitions from HIToolbox/Events.h
 #include <Carbon/Carbon.h>
+#include "config.h"
 #include "osx_common.h"
 #include "video_out.h"
 #include "osdep/keycodes.h"
@@ -140,3 +141,25 @@ void config_movie_aspect(float config_as
         old_movie_aspect = config_aspect;
     our_aspect_change = 0;
 }
+
+/** This chunk of code is heavily based off SDL_macosx.m from SDL.
+ *  The CPSEnableForegroundOperation that was here before is private
+ *  and should not be used.
+ *  Replaced by a call to the 10.3+ TransformProcessType.
+ */
+void osx_foreground_hack(void)
+{
+#if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL)
+    ProcessSerialNumber myProc, frProc;
+    Boolean sameProc;
+
+    if (GetFrontProcess(&frProc)   == noErr &&
+        GetCurrentProcess(&myProc) == noErr) {
+        if (SameProcess(&frProc, &myProc, &sameProc) == noErr && !sameProc) {
+            TransformProcessType(&myProc,
+                                 kProcessTransformToForegroundApplication);
+        }
+        SetFrontProcess(&myProc);
+    }
+#endif
+}

Modified: trunk/libvo/osx_common.h
==============================================================================
--- trunk/libvo/osx_common.h	Fri Mar 26 13:12:25 2010	(r30963)
+++ trunk/libvo/osx_common.h	Fri Mar 26 16:02:14 2010	(r30964)
@@ -22,5 +22,6 @@
 int convert_key(unsigned key, unsigned charcode);
 void change_movie_aspect(float new_aspect);
 void config_movie_aspect(float config_aspect);
+void osx_foreground_hack(void);
 
 #endif /* MPLAYER_OSX_COMMON_H */

Modified: trunk/libvo/vo_corevideo.m
==============================================================================
--- trunk/libvo/vo_corevideo.m	Fri Mar 26 13:12:25 2010	(r30963)
+++ trunk/libvo/vo_corevideo.m	Fri Mar 26 16:02:14 2010	(r30964)
@@ -386,23 +386,7 @@ static int preinit(const char *arg)
 		NSApp = [NSApplication sharedApplication];
 		isLeopardOrLater = floor(NSAppKitVersionNumber) > 824;
 
-		#if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL)
-		//this chunk of code is heavily based off SDL_macosx.m from SDL
-		ProcessSerialNumber myProc, frProc;
-		Boolean sameProc;
-
-		if (GetFrontProcess(&frProc) == noErr)
-		{
-			if (GetCurrentProcess(&myProc) == noErr)
-			{
-				if (SameProcess(&frProc, &myProc, &sameProc) == noErr && !sameProc)
-				{
-					TransformProcessType(&myProc, kProcessTransformToForegroundApplication);
-				}
-				SetFrontProcess(&myProc);
-			}
-		}
-		#endif
+		osx_foreground_hack();
 
 		if(!mpGLView)
 		{

Modified: trunk/libvo/vo_quartz.c
==============================================================================
--- trunk/libvo/vo_quartz.c	Fri Mar 26 13:12:25 2010	(r30963)
+++ trunk/libvo/vo_quartz.c	Fri Mar 26 16:02:14 2010	(r30964)
@@ -1088,27 +1088,7 @@ static int preinit(const char *arg)
         }
     }
 
-#if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL)
-    // this chunk of code is heavily based off SDL_macosx.m from SDL
-    // the CPSEnableForegroundOperation that was here before is private and shouldn't be used
-    // replaced by a call to the 10.3+ TransformProcessType
-    {
-        ProcessSerialNumber myProc, frProc;
-        Boolean sameProc;
-
-        if (GetFrontProcess(&frProc) == noErr)
-        {
-            if (GetCurrentProcess(&myProc) == noErr)
-            {
-                if (SameProcess(&frProc, &myProc, &sameProc) == noErr && !sameProc)
-                {
-                    TransformProcessType(&myProc, kProcessTransformToForegroundApplication);
-                }
-                SetFrontProcess(&myProc);
-            }
-        }
-    }
-#endif
+    osx_foreground_hack();
 
     return 0;
 }


More information about the MPlayer-cvslog mailing list