From 14445f03b01efdd221d21b411ebbbc47856675b3 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 14 Feb 2010 20:08:24 +0000 Subject: [PATCH] Fix a xine race condition on win32 by showing the debug console :S --- src/main.cpp | 12 ++++++++++++ src/mainwindow.cpp | 2 +- src/src.pro | 7 ++++--- src/xine-engine.cpp | 8 +++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 835d9d978..34c19246c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,9 @@ +#ifdef Q_OS_WIN32 +# define _WIN32_WINNT 0x0500 +# include +# include +#endif // Q_OS_WIN32 + #include "mainwindow.h" #include "directory.h" #include "song.h" @@ -23,6 +29,12 @@ int main(int argc, char *argv[]) { // Couldn't send the message so start anyway } +#ifdef Q_OS_WIN32 + // CONFIG += console seems to fix a race condition in xine. God knows why :/ + // Hide the console window here so it doen't annoy the user. + ShowWindow( GetConsoleWindow(), SW_HIDE ); +#endif // Q_OS_WIN32 + MainWindow w; a.setActivationWindow(&w); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ff220379d..eccd55f4c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -237,7 +237,7 @@ MainWindow::MainWindow(QWidget *parent) connect(stop, SIGNAL(activated()), ui_.action_stop, SLOT(trigger())); connect(next, SIGNAL(activated()), ui_.action_next_track, SLOT(trigger())); connect(prev, SIGNAL(activated()), ui_.action_previous_track, SLOT(trigger())); -#endif // Q_OS_DARWIN +#endif // Q_OS_LINUX // Settings connect(settings_dialog_, SIGNAL(accepted()), player_, SLOT(ReloadSettings())); diff --git a/src/src.pro b/src/src.pro index 6e05c452c..07f44874a 100644 --- a/src/src.pro +++ b/src/src.pro @@ -183,9 +183,10 @@ win32|fedora-win32-cross:SOURCES += ../3rdparty/qtsingleapplication/qtlockedfile win32|fedora-win32-cross: { # Hide the console on windows - CONFIG -= console - CONFIG += windows - LIBS += -Wl,-subsystem,windows + #LIBS += -Wl,-subsystem,windows + + # Show console for now since it seems to fix a xine race condition :( + CONFIG += console } # Installs diff --git a/src/xine-engine.cpp b/src/xine-engine.cpp index bb738269d..41085dfc9 100644 --- a/src/xine-engine.cpp +++ b/src/xine-engine.cpp @@ -41,7 +41,9 @@ extern "C" //define this to use xine in a more standard way -//#define XINE_SAFE_MODE +#ifdef Q_OS_WIN32 +#define XINE_SAFE_MODE +#endif ///some logging static globals @@ -262,8 +264,8 @@ XineEngine::load( const QUrl &url, bool isStream ) else { #ifdef XINE_PARAM_GAPLESS_SWITCH - if ( xine_check_version(1,1,1) && !(m_xfadeLength > 0) ) - xine_set_param( m_stream, XINE_PARAM_GAPLESS_SWITCH, 0); + //if ( xine_check_version(1,1,1) && !(m_xfadeLength > 0) ) + //xine_set_param( m_stream, XINE_PARAM_GAPLESS_SWITCH, 0); #endif }