[X2Go-Commits] [x2goclient] 01/01: Windows: Fix compatibility with PulseAudio 6.0 by specifying an absolute path to the cookie

git-admin at x2go.org git-admin at x2go.org
Mon Dec 8 12:04:44 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 ab034de9da7c31013d07db866c6a995f10436f08
Author: Mike DePaulo <mikedep333 at gmail.com>
Date:   Mon Dec 8 06:03:43 2014 -0500

    Windows: Fix compatibility with PulseAudio 6.0 by specifying an absolute path to the cookie
---
 debian/changelog |    1 +
 onmainwindow.cpp |   44 ++++++++++++++++++++++++++++++--------------
 onmainwindow.h   |    3 +++
 3 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index edeb609..d121d47 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ x2goclient (4.0.3.2-0x2go1) UNRELEASED; urgency=medium
 
   [ Mike DePaulo ]
   * New upstream release (4.0.3.2):
+    - Windows: Fix compatibility with PulseAudio 6.0
     - Windows: Enable X2Go Client for Windows to build under VS2010 nmake
       (but not the VS2010 IDE due to a Qt4 Visual Studio Add-in limitation)
       Note that the official builds are still build under MinGW.
diff --git a/onmainwindow.cpp b/onmainwindow.cpp
index 4f9d64d..1358cf8 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -9647,13 +9647,15 @@ void ONMainWindow::startPulsed()
     while ( isServerRunning ( esdPort ) )
         ++esdPort;
 
-    pulseDir=homeDir+"/.x2go/pulse";
+    // The permanent dir for the pulse auth cookie
+    pulseBaseDir=homeDir+"/.x2go/pulse";
     QDir dr ( homeDir );
-    dr.mkpath ( pulseDir );
-    pulseDir=wapiShortFileName ( pulseDir );
+    dr.mkpath ( pulseBaseDir );
 
+    // The tempoerary dir for config.pa (and pulse.log if it exists)
+    pulseDir=pulseBaseDir;
+    pulseDir=wapiShortFileName ( pulseDir );
     x2goDebug<<"pulse template: "<<pulseDir+"/tmp";
-
     QTemporaryFile* fl=new QTemporaryFile ( pulseDir+"/tmp" );
     fl->open();
     pulseDir=fl->fileName();
@@ -9669,7 +9671,7 @@ void ONMainWindow::startPulsed()
     {
         if ( pEnv[i].indexOf ( "USERPROFILE=" ) !=-1 )
             pEnv[i]="USERPROFILE="+
-                    QDir::toNativeSeparators( wapiShortFileName( homeDir+"/.x2go/pulse"));
+                    QDir::toNativeSeparators( wapiShortFileName( pulseBaseDir ));
         if ( pEnv[i].indexOf ( "TEMP=" ) !=-1 )
             pEnv[i]="TEMP="+pulseDir;
         if ( pEnv[i].indexOf ( "USERNAME=" ) !=-1 )
@@ -9680,9 +9682,16 @@ void ONMainWindow::startPulsed()
     if ( !file.open ( QIODevice::WriteOnly | QIODevice::Text ) )
         return;
     QTextStream out ( &file );
-    // http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index22h3
-    // auth-cookie is relative to %USERPROFILE%
-    // Setting auth-cookie fixes bug #422
+    /*
+    Reference:
+    http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index22h3
+
+    Setting auth-cookie fixes bug #422
+
+    PulseAudio 6.0 changed the path that auth-cookie is relative to, so
+    Tanu Kaskinen recommended we specify the absolute path instead.
+    The abs path works with at least 5.0 and 6.0
+    */
     if (pulseVersionIsLegacy)
     {
         out << "load-module module-native-protocol-tcp port="+
@@ -9690,9 +9699,13 @@ void ONMainWindow::startPulsed()
     }
     else
     {
+        pulseCookieArg="auth-cookie="+
+            QDir::toNativeSeparators (wapiShortFileName( pulseBaseDir))+
+            "\\.pulse-cookie";
+        // Double backslashes are required in config.pa
+        pulseCookieArg.replace("\\", "\\\\");
         out << "load-module module-native-protocol-tcp port="+
-            QString::number ( pulsePort )+
-            " auth-cookie="+"\\.pulse-cookie" <<endl;
+            QString::number ( pulsePort )+" "+pulseCookieArg <<endl;
     }
     out << "load-module module-esound-protocol-tcp port="+
         QString::number ( esdPort ) <<endl;
@@ -9702,12 +9715,15 @@ void ONMainWindow::startPulsed()
     pulseServer->setEnvironment ( pEnv );
     pulseArgs.clear();
 #ifdef Q_OS_WIN
-    QDir drr(homeDir+"/.x2go/pulse/.pulse/"+QHostInfo::localHostName ()+"-runtime");
+    // FIXME: Explain why this dir needs to be created.
+    pulseRuntimeDir=pulseBaseDir+"/.pulse/"+QHostInfo::localHostName ()+"-runtime";
+    QDir drr(pulseRuntimeDir);
     if (!drr.exists())
         drr.mkpath(drr.path());
-    if (QFile::exists(homeDir+"/.x2go/pulse/.pulse/"+QHostInfo::localHostName ()+"-runtime/pid"))
-        QFile::remove(homeDir+"/.x2go/pulse/.pulse/"+QHostInfo::localHostName ()+"-runtime/pid");
-    pulseDir.replace("/","\\");
+    if (QFile::exists(pulseRuntimeDir+"/pid"))
+        QFile::remove(pulseRuntimeDir+"/pid");
+
+    pulseDir=QDir::toNativeSeparators( pulseDir );
     pulseArgs<<"--exit-idle-time=-1"<<"-n"<<"-F"<<pulseDir+"\\config.pa";
     if (debugging)
         pulseArgs<<"--log-level=debug"<<"--verbose"<<"--log-target=file:"+pulseDir+"\\pulse.log";
diff --git a/onmainwindow.h b/onmainwindow.h
index e987a22..e50b400 100644
--- a/onmainwindow.h
+++ b/onmainwindow.h
@@ -836,6 +836,9 @@ private:
     bool cyEntry;
 
     QString pulseDir;
+    QString pulseBaseDir;
+    QString pulseRuntimeDir;
+    QString pulseCookieArg;
     int pulsePort;
     int esdPort;
     bool maximizeProxyWin;

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list