summaryrefslogtreecommitdiffhomepage
path: root/gui/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/init.cpp')
-rw-r--r--gui/init.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/gui/init.cpp b/gui/init.cpp
index 3ed4ff48..fde6f256 100644
--- a/gui/init.cpp
+++ b/gui/init.cpp
@@ -12,15 +12,14 @@
#endif
#include "migration/migration.hpp"
-#include "gui/main-window.hpp"
#include "options/options.hpp"
using namespace options;
#include "opentrack-library-path.h"
#include <memory>
+#include <cstdlib>
#include <cstring>
#include <cstdio>
-#include <cstdlib>
#include <QApplication>
#include <QStyleFactory>
@@ -94,19 +93,6 @@ void qdebug_to_console(QtMsgType, const QMessageLogContext& ctx, const QString &
std::fflush(stderr);
}
-void attach_parent_console()
-{
- if (AttachConsole(ATTACH_PARENT_PROCESS))
- {
- // XXX c++ iostreams aren't reopened
-
- _wfreopen(L"CON", L"w", stdout);
- _wfreopen(L"CON", L"w", stderr);
- _wfreopen(L"CON", L"r", stdin);
- }
- (void)qInstallMessageHandler(qdebug_to_console);
-}
-
void add_win32_path()
{
// see https://software.intel.com/en-us/articles/limitation-to-the-length-of-the-system-path-variable
@@ -157,6 +143,8 @@ void add_win32_path()
}
}
+void attach_parent_console();
+
#endif
int run_window(QApplication& app, std::unique_ptr<QWidget> main_window)
@@ -226,3 +214,20 @@ int otr_main(int argc, char** argv, std::function<QWidget*()> make_main_window)
return ret;
}
+
+#if defined _WIN32
+#include <windows.h>
+
+void attach_parent_console()
+{
+ if (AttachConsole(ATTACH_PARENT_PROCESS))
+ {
+ // XXX c++ iostreams aren't reopened
+
+ _wfreopen(L"CON", L"w", stdout);
+ _wfreopen(L"CON", L"w", stderr);
+ _wfreopen(L"CON", L"r", stdin);
+ }
+ (void)qInstallMessageHandler(qdebug_to_console);
+}
+#endif