diff --git a/src/bin/e_main.c b/src/bin/e_main.c index ca710fb25..68297229e 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -63,7 +63,8 @@ main(int argc, char **argv) int nowelcome = 0; int after_restart = 0; char buf[1024]; - + char *s; + /* for debugging by redirecting stdout of e to a log file to tail */ setvbuf(stdout, NULL, _IONBF, 0); @@ -89,7 +90,30 @@ main(int argc, char **argv) putenv(buf); } } - + + /* fix up DISPLAY to be :N.0 if no .screen is in it */ + s = getenv("DISPLAY"); + if (s) + { + char *p; + + p = strrchr(s, ':'); + if (!p) + { + snprintf(buf, sizeof(buf), "DISPLAY=%s:0.0", s); + putenv(buf); + } + else + { + p = strrchr(p, '.'); + if (!p) + { + snprintf(buf, sizeof(buf), "DISPLAY=%s.0", s); + putenv(buf); + } + } + } + /* init edje and set it up in frozen mode */ edje_init(); edje_freeze(); diff --git a/src/bin/e_remote_main.c b/src/bin/e_remote_main.c index 84ae25f12..2287e74b0 100644 --- a/src/bin/e_remote_main.c +++ b/src/bin/e_remote_main.c @@ -53,6 +53,30 @@ int main(int argc, char **argv) { int i; + char *s, buf[1024]; + + /* fix up DISPLAY to be :N.0 if no .screen is in it */ + s = getenv("DISPLAY"); + if (s) + { + char *p; + + p = strrchr(s, ':'); + if (!p) + { + snprintf(buf, sizeof(buf), "DISPLAY=%s:0.0", s); + putenv(buf); + } + else + { + p = strrchr(p, '.'); + if (!p) + { + snprintf(buf, sizeof(buf), "DISPLAY=%s.0", s); + putenv(buf); + } + } + } /* handle some command-line parameters */ display_name = (const char *)getenv("DISPLAY"); @@ -100,7 +124,7 @@ main(int argc, char **argv) if (!_e_ipc_init()) { printf("ERROR: Enlightenment_remote cannot set up the IPC socket.\n" - "Maybe try the '-display :0' option?\n"); + "Maybe try the '-display :0.0' option?\n"); exit(-1); }