[X2Go-Commits] [x2goclient] 01/01: src/onmainwindow.cpp: add (default) MacPorts prefix, /usr/local/bin and /opt/X11/bin to x2goclient's environment and child environments before starting xmodmap. Fixes: #1019.

git-admin at x2go.org git-admin at x2go.org
Wed Apr 6 06:58:08 CEST 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 3772ad2ff7b6553f71790da0527a9e1d5e399ddb
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Apr 6 06:55:33 2016 +0200

    src/onmainwindow.cpp: add (default) MacPorts prefix, /usr/local/bin and /opt/X11/bin to x2goclient's environment and child environments before starting xmodmap. Fixes: #1019.
    
    Requires a re-release of X2Go Client for OS X.
---
 debian/changelog     |    4 ++++
 src/onmainwindow.cpp |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 2030cd5..c058a99 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,10 @@ x2goclient (4.0.5.2-0x2go1) UNRELEASED; urgency=medium
       This particular style has been removed/replaced by Fusion, which
       incorporates features of both Plastique and Clearlooks styles.
     - x2goclient.spec: whitespace only.
+    - src/onmainwindow.cpp: add (default) MacPorts prefix, /usr/local/bin and
+      /opt/X11/bin to x2goclient's environment and child environments before
+      starting xmodmap. Fixes: #1019. Requires a re-release of X2Go Client for
+      OS X.
 
   [ Mike DePaulo ]
   * New upstream release (4.0.5.2):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index fedd594..4a48157 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -5623,6 +5623,56 @@ void ONMainWindow::slotSetModMap()
             path_val = "/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/opt/X11/bin";
             tmp_env.insert ("PATH", path_val);
         }
+        else {
+            /* FIXME: split/clean this up. */
+            /* Search for and add /opt/X11/bin if necessary. */
+            QStringList tmp_path = path_val.split (":");
+            bool xquartz_found = false,
+                 macports_found = false,
+                 local_found = false;
+            for (int i = 0; i < tmp_path.length (); ++i) {
+                if ((tmp_path[i] == QString ("/opt/X11/bin")) || (tmp_path[i] == QString ("/opt/X11/bin/"))) {
+                    xquartz_found = true;
+                    continue;
+                }
+
+                if ((tmp_path[i] == QString ("/opt/local/bin")) || (tmp_path[i] == QString ("/opt/local/bin/"))) {
+                    macports_found = true;
+                    continue;
+                }
+
+
+                if ((tmp_path[i] == QString ("/usr/local/bin")) || (tmp_path[i] == QString ("/usr/local/bin/"))) {
+                    local_found = true;
+                    continue;
+                }
+
+                if (xquartz_found && macports_found && local_found) {
+                    break;
+                }
+            }
+
+            if (!xquartz_found) {
+                path_val.append (":/opt/X11/bin");
+            }
+
+            if (!local_found) {
+                path_val.prepend ("/usr/local/bin:");
+            }
+
+            if (!macports_found) {
+                path_val.prepend ("/opt/local/bin:");
+            }
+
+            /* Insert will overwrite the value automatically. */
+            tmp_env.insert ("PATH", path_val);
+
+            /*
+             * Also alter our own environment so we can actually
+             * execute xmodmap and friends later on.
+             */
+            qputenv ("PATH", path_val.toUtf8 ());
+        }
 
         pr.setProcessEnvironment (tmp_env);
 

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


More information about the x2go-commits mailing list