forked from e16/e16
1
0
Fork 0

Fix deriving configuration file names with libX11-1.4.

It seems that DisplayString in libX11-1.4 (1.3.99.901, at least) may
return e.g. ":0" where it would return ":0.0" in earlier releases.
Hmm...

This would break the naming of the configuration file prefix.

SVN revision: 52108
This commit is contained in:
Kim Woelders 2010-09-09 21:19:48 +00:00
parent fb6c2cc964
commit e5fd2ed36e
1 changed files with 14 additions and 16 deletions

30
src/x.c
View File

@ -1700,27 +1700,25 @@ int
EDisplayOpen(const char *dstr, int scr)
{
char dbuf[256], *s;
unsigned int ddpy, dscr;
if (scr >= 0)
{
/* Override screen */
Esnprintf(dbuf, sizeof(dbuf) - 10, "%s", dstr);
s = strchr(dbuf, ':');
if (s)
{
s = strchr(s, '.');
if (s)
*s = '\0';
}
Esnprintf(dbuf + strlen(dbuf), 10, ".%d", scr);
dstr = dbuf;
}
Esnprintf(dbuf, sizeof(dbuf), "%.256s", dstr);
s = strchr(dbuf, ':');
if (!s)
return -1;
s++;
ddpy = dscr = 0;
sscanf(s, "%u.%u", &ddpy, &dscr);
if (scr >= 0) /* Override screen */
dscr = scr;
Esnprintf(s, sizeof(dbuf) - (s - dbuf), "%u.%u", ddpy, dscr);
#ifdef USE_ECORE_X
ecore_x_init(dstr);
ecore_x_init(dbuf);
disp = ecore_x_display_get();
#else
disp = XOpenDisplay(dstr);
disp = XOpenDisplay(dbuf);
#endif
return (disp) ? 0 : -1;