← Back to team overview

compiz team mailing list archive

[Merge] lp:~unity-team/compiz/trunk.fix_env into lp:~unity-team/compiz/trunk

 

David Barth has proposed merging lp:~unity-team/compiz/trunk.fix_env into lp:~unity-team/compiz/trunk.

Requested reviews:
  compiz packagers (compiz)

For more details, see:
https://code.launchpad.net/~unity-team/compiz/trunk.fix_env/+merge/56566

This branch basically fixes the way we were botching the env for applications that we launch.

Because of the way compiz works, we need to ensure that the program is not just using the env as started by DISPLAY=:blah but actually the display and screen that compiz is running on (eg priv->displayString and priv->screenNum). However what we were doing in this case was replacing the display with 0.priv->screenNum every time which attempts to start any commands we wish to run on display :0. This is incorrect behaviour - it should reflect the display that compiz was actually started on.
-- 
https://code.launchpad.net/~unity-team/compiz/trunk.fix_env/+merge/56566
Your team compiz packagers is requested to review the proposed merge of lp:~unity-team/compiz/trunk.fix_env into lp:~unity-team/compiz/trunk.
=== modified file 'src/screen.cpp'
--- src/screen.cpp	2011-03-30 12:28:16 +0000
+++ src/screen.cpp	2011-04-06 13:30:56 +0000
@@ -3468,22 +3468,25 @@
 
     if (fork () == 0)
     {
-	size_t     pos;
-	CompString env (priv->displayString);
+	size_t       pos;
+	CompString   env (priv->displayString);
 
 	setsid ();
 
 	pos = env.find (':');
 	if (pos != std::string::npos)
 	{
-	    if (env.find ('.', pos) != std::string::npos)
+            size_t pointPos = env.find ('.', pos);
+
+	    if (pointPos != std::string::npos)
 	    {
-		env.erase (env.find ('.', pos));
+		env.erase (pointPos);
 	    }
 	    else
 	    {
+                unsigned int displayNum = atoi (env.substr (pos + 1).c_str ());
 		env.erase (pos);
-		env.append (":0");
+		env.append (compPrintf (":%i", displayNum));
 	    }
 	}