summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-04-30 21:44:07 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-04-30 21:44:07 +0800
commit6fcc35026d3f7ceef49e77f255d48e2597b6320e (patch)
tree3ac8df48a163d948776c115691ef86e682548fcb /src
parent9e05959898a53dee6022a9dd2983d9e2935e6593 (diff)
downloadmobilebling-6fcc35026d3f7ceef49e77f255d48e2597b6320e.tar.gz
mobilebling-6fcc35026d3f7ceef49e77f255d48e2597b6320e.tar.bz2
Set correct DISPLAY env when launching commands. Do not force :0
Diffstat (limited to 'src')
-rw-r--r--src/screen.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/screen.cpp b/src/screen.cpp
index 4ea9c26..684c4ed 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -3411,22 +3411,25 @@ CompScreen::runCommand (CompString command)
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));
}
}