[X2Go-Commits] [x2goclient] 01/01: Windows: Fix cookie handling when PulseAudio is downgraded after cookie is created.
git-admin at x2go.org
git-admin at x2go.org
Wed Mar 19 00:52:41 CET 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goclient.
commit ed895e030c52025c7e1ebce6e1d6b6e7c524f8d3
Author: Mike DePaulo <mikedep333 at gmail.com>
Date: Tue Mar 18 19:52:23 2014 -0400
Windows: Fix cookie handling when PulseAudio is downgraded after cookie is created.
---
onmainwindow.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++-----------
onmainwindow.h | 4 ++++
2 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/onmainwindow.cpp b/onmainwindow.cpp
index 638f826..fbae475 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -158,6 +158,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent )
homeDir=QDir::homePath();
#ifdef Q_OS_WIN
+ pulseVersionTest=0l;
pulseServer=0l;
xorg=0l;
xDisplay=0;
@@ -400,6 +401,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent )
#ifdef Q_OS_WIN
winServersReady=false;
saveCygnusSettings();
+ pulseVersionIsLegacy=false;
#endif
initPassDlg();
initSelectSessDlg();
@@ -5147,20 +5149,26 @@ void ONMainWindow::slotRetResumeSess ( bool result,
"/.pulse-cookie", this, SLOT ( slotPCookieReady ( bool, QString,int )));
}
#else
- QString cooFile;
+ // The only cookie file path used by PulseAudio 2.1 and earlier.
+ // These PulseAudio versions do not support overriding the cookie file path.
+ if (pulseVersionIsLegacy)
+ cooFile = wapiShortFileName ( homeDir ) + "/.x2go/pulse/.pulse-cookie";
// Default cookie file path used by PulseAudio 3.0 and later.
// Cannot be overriden due to PulseAudio bug 75006.
- if ( QFile::exists
- (wapiShortFileName ( homeDir ) + "/.x2go/pulse/.config/pulse/cookie") )
+ else
{
- cooFile =
- (wapiShortFileName ( homeDir ) + "/.x2go/pulse/.config/pulse/cookie");
- }
- else
- {
- /* The only cookie file path used by PulseAudio 2.1 and earlier.
- PulseAudio 3.0 and later will still use it if the primary path DNE */
- cooFile = wapiShortFileName ( homeDir ) + "/.x2go/pulse/.pulse-cookie";
+ if ( QFile::exists
+ (wapiShortFileName ( homeDir ) + "/.x2go/pulse/.config/pulse/cookie") )
+ {
+ cooFile =
+ (wapiShortFileName ( homeDir ) + "/.x2go/pulse/.config/pulse/cookie");
+ }
+ else
+ {
+ // PulseAudio 3.0 and later will still use this path if it exists
+ // but the defaultt path DNE */
+ cooFile = wapiShortFileName ( homeDir ) + "/.x2go/pulse/.pulse-cookie";
+ }
}
QString destFile="$HOME/.x2go/C-"+
@@ -9648,6 +9656,31 @@ void ONMainWindow::removeCygwinEntry()
void ONMainWindow::startPulsed()
{
+#ifdef Q_OS_WIN
+ pulseVersionTest=new QProcess ( 0 );
+ pulseVersionTest->start ( "pulse\\pulseaudio.exe --version" );
+
+ pulseVersionTest->waitForFinished();
+ QString pulseVersionLine=
+ pulseVersionTest->readAllStandardOutput().replace("\n"," ").simplified();
+
+ x2goDebug <<"PulseAudio Version Line: "<<pulseVersionLine;
+ if (pulseVersionLine.contains("pulseaudio 0.", Qt::CaseInsensitive))
+ pulseVersionIsLegacy = true;
+ if (pulseVersionLine.contains("pulseaudio 1.", Qt::CaseInsensitive))
+ pulseVersionIsLegacy = true;
+ if (pulseVersionLine.contains("pulseaudio 2.", Qt::CaseInsensitive))
+ pulseVersionIsLegacy = true;
+
+ if (pulseVersionIsLegacy)
+ {
+ x2goDebug <<"PulseAudio <= 2.1 Detected. Using .pulse-cookie";
+ }
+ else
+ {
+ x2goDebug <<"PulseAudio >= 3.0 Detected. Using .config/pulse/cookie or .pulse-cookie in that order.";
+ }
+#endif
while ( isServerRunning ( pulsePort ) )
++pulsePort;
esdPort=pulsePort+1;
diff --git a/onmainwindow.h b/onmainwindow.h
index afe63a7..faa2f97 100644
--- a/onmainwindow.h
+++ b/onmainwindow.h
@@ -773,6 +773,10 @@ private:
bool winSshdStarted;
static QString u3Device;
+ QString cooFile;
+ QString pulseVersionTestOutput;
+ QProcess* pulseVersionTest;
+ bool pulseVersionIsLegacy;
QProcess* pulseServer;
QStringList pulseArgs;
QTimer* pulseTimer;
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list