force display to be [disp_name]:X.Y even if it is just [disp_name]:X

SVN revision: 12775
This commit is contained in:
Carsten Haitzler 2005-01-05 09:09:03 +00:00
parent 49ac422b1d
commit 2339d78f29
2 changed files with 51 additions and 3 deletions

View File

@ -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();

View File

@ -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);
}