summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-26 15:02:14 +0000
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-26 15:02:14 +0000
commit3e7a2bd8c32a679dda793fce57f107203c48af55 (patch)
tree4997abd337a7a81a321c1aaf194e30c726fa75ed /libvo
parent85640449d2fb159da89473a8b4958ff7082fd88d (diff)
downloadmpv-3e7a2bd8c32a679dda793fce57f107203c48af55.tar.bz2
mpv-3e7a2bd8c32a679dda793fce57f107203c48af55.tar.xz
Refactor OS X foreground process setting into a separate function.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30964 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/osx_common.c23
-rw-r--r--libvo/osx_common.h1
-rw-r--r--libvo/vo_corevideo.m18
-rw-r--r--libvo/vo_quartz.c22
4 files changed, 26 insertions, 38 deletions
diff --git a/libvo/osx_common.c b/libvo/osx_common.c
index b953860e36..3ceef2fece 100644
--- a/libvo/osx_common.c
+++ b/libvo/osx_common.c
@@ -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_aspect)
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
+}
diff --git a/libvo/osx_common.h b/libvo/osx_common.h
index d20698e411..21bb3d8548 100644
--- a/libvo/osx_common.h
+++ b/libvo/osx_common.h
@@ -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 */
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index 5d25b088f4..6a62a08ef6 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -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)
{
diff --git a/libvo/vo_quartz.c b/libvo/vo_quartz.c
index 46c78b0583..ba4c5230c4 100644
--- a/libvo/vo_quartz.c
+++ b/libvo/vo_quartz.c
@@ -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;
}