[Xfce4-commits] <midori:master> Move Win32 stdout work-around to the top

Christian Dywan noreply at xfce.org
Thu Aug 30 00:44:05 CEST 2012


Updating branch refs/heads/master
         to 1ce2b96680125ec034d68ac620ded2380ed95d86 (commit)
       from 58d1436d4e37787c0d7107e8f542b9f061b39086 (commit)

commit 1ce2b96680125ec034d68ac620ded2380ed95d86
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Aug 29 23:52:50 2012 +0200

    Move Win32 stdout work-around to the top
    
    Otherwise Midori.Paths debugging won't be visible.

 midori/midori-app.c |   46 +++++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/midori/midori-app.c b/midori/midori-app.c
index 8431a9b..bd6590f 100644
--- a/midori/midori-app.c
+++ b/midori/midori-app.c
@@ -1383,6 +1383,29 @@ midori_app_setup (gint               *argc,
         { STOCK_FOLDER_NEW,   N_("New _Folder") },
     };
 
+    /* Print messages to stdout on Win32 console, cf. AbiWord
+     * http://svn.abisource.com/abiword/trunk/src/wp/main/win/Win32Main.cpp */
+    #ifdef _WIN32
+    if (fileno (stdout) != -1
+    && _get_osfhandle (fileno (stdout)) != -1)
+    {
+        /* stdout is already being redirected to a file */
+    }
+    else
+    {
+        typedef BOOL (WINAPI *AttachConsole_t) (DWORD);
+        AttachConsole_t p_AttachConsole =
+            (AttachConsole_t) GetProcAddress (GetModuleHandle ("kernel32.dll"), "AttachConsole");
+        if (p_AttachConsole != NULL && p_AttachConsole (ATTACH_PARENT_PROCESS))
+        {
+            freopen ("CONOUT$", "w", stdout);
+            dup2 (fileno (stdout), 1);
+            freopen ("CONOUT$", "w", stderr);
+            dup2 (fileno (stderr), 2);
+        }
+    }
+    #endif
+
     /* libSoup uses threads, therefore if WebKit is built with libSoup
      * or Midori is using it, we need to initialize threads. */
     #if !GLIB_CHECK_VERSION (2, 32, 0)
@@ -1430,29 +1453,6 @@ midori_app_setup (gint               *argc,
     gtk_icon_factory_add_default (factory);
     g_object_unref (factory);
 
-    /* Print messages to stdout on Win32 console, cf. AbiWord
-     * http://svn.abisource.com/abiword/trunk/src/wp/main/win/Win32Main.cpp */
-    #ifdef _WIN32
-    if (fileno (stdout) != -1
-    && _get_osfhandle (fileno (stdout)) != -1)
-    {
-        /* stdout is already being redirected to a file */
-    }
-    else
-    {
-        typedef BOOL (WINAPI *AttachConsole_t) (DWORD);
-        AttachConsole_t p_AttachConsole =
-            (AttachConsole_t) GetProcAddress (GetModuleHandle ("kernel32.dll"), "AttachConsole");
-        if (p_AttachConsole != NULL && p_AttachConsole (ATTACH_PARENT_PROCESS))
-        {
-            freopen ("CONOUT$", "w", stdout);
-            dup2 (fileno (stdout), 1);
-            freopen ("CONOUT$", "w", stderr);
-            dup2 (fileno (stderr), 2);
-        }
-    }
-    #endif
-
     return success;
 }
 


More information about the Xfce4-commits mailing list