changeset 32415:d1f6c6cf8905

Move gui-specific code out of common_init, it certainly does not belong there.
author reimar
date Sun, 17 Oct 2010 15:23:33 +0000
parents a14dd8b8d314
children 47f954075424
files mpcommon.c mplayer.c
diffstat 2 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mpcommon.c	Sun Oct 17 15:17:46 2010 +0000
+++ b/mpcommon.c	Sun Oct 17 15:23:33 2010 +0000
@@ -396,25 +396,9 @@
  */
 int common_init(void)
 {
-#if defined(__MINGW32__) || defined(__CYGWIN__)
-#ifdef CONFIG_WIN32DLL
+#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
     set_path_env();
 #endif
-#ifdef CONFIG_GUI
-    void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
-    if (runningmplayer && filename && use_gui) {
-        COPYDATASTRUCT csData;
-        char file[MAX_PATH];
-        char *filepart = filename;
-        if (GetFullPathName(filename, MAX_PATH, file, &filepart)) {
-            csData.dwData = 0;
-            csData.cbData = strlen(file)*2;
-            csData.lpData = file;
-            SendMessage(runningmplayer, WM_COPYDATA, (WPARAM)runningmplayer, (LPARAM)&csData);
-        }
-    }
-#endif
-#endif
     sanitize_os();
 
 #ifdef CONFIG_PRIORITY
--- a/mplayer.c	Sun Oct 17 15:17:46 2010 +0000
+++ b/mplayer.c	Sun Oct 17 15:23:33 2010 +0000
@@ -2795,6 +2795,20 @@
     }
 
   print_version("MPlayer");
+#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_GUI)
+    void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
+    if (runningmplayer && filename && use_gui) {
+        COPYDATASTRUCT csData;
+        char file[MAX_PATH];
+        char *filepart = filename;
+        if (GetFullPathName(filename, MAX_PATH, file, &filepart)) {
+            csData.dwData = 0;
+            csData.cbData = strlen(file)*2;
+            csData.lpData = file;
+            SendMessage(runningmplayer, WM_COPYDATA, (WPARAM)runningmplayer, (LPARAM)&csData);
+        }
+    }
+#endif
     if (!common_init())
         exit_player_with_rc(EXIT_NONE, 0);