Do not call ecore_x_init() when not using X display.

Summary:
On some systems (e.g. OS X), both Apple's windows manager and X11 can cohabit,
therefore we need to check for the DISPLAY environment variable only when ELM_DISPLAY
is not specified.

Reviewers: cedric, devilhorns, seoz, raster

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D1721
This commit is contained in:
Jean Guyomarc'h 2015-01-09 14:41:04 +09:00 committed by Carsten Haitzler (Rasterman)
parent 49b60d746c
commit ab0a1bda94
2 changed files with 54 additions and 4 deletions

View File

@ -3226,9 +3226,34 @@ void
_elm_config_sub_init(void)
{
#ifdef HAVE_ELEMENTARY_X
Eina_Bool init_x;
const char *ev = getenv("ELM_DISPLAY");
if (((ev) && (!strcmp(ev, "x11")) && (getenv("DISPLAY"))) ||
(getenv("DISPLAY")))
Eina_Bool have_display = !!getenv("DISPLAY");
if (ev) /* If ELM_DISPLAY is specified */
{
if (!strcmp(ev, "x11")) /* and it is X11 */
{
if (!have_display) /* if there is no $DISPLAY */
{
ERR("$ELM_DISPLAY is set to x11 but $DISPLAY is not set");
init_x = EINA_FALSE;
}
else /* if there is */
init_x = EINA_TRUE;
}
else /* not X11 */
init_x = EINA_FALSE;
}
else /* ELM_DISPLAY not specified */
{
if (have_display) /* If there is a $DISPLAY */
init_x = EINA_TRUE;
else /* No $DISPLAY */
init_x = EINA_FALSE;
}
if (init_x)
{
if (ecore_x_init(NULL))
{

View File

@ -957,9 +957,34 @@ elm_quicklaunch_fork(int argc,
_elm_config_sub_init();
# ifdef HAVE_ELEMENTARY_X
{
Eina_Bool init_x;
const char *ev = getenv("ELM_DISPLAY");
if (((ev) && (!strcmp(ev, "x11")) && (getenv("DISPLAY"))) ||
(getenv("DISPLAY")))
Eina_Bool have_display = !!getenv("DISPLAY");
if (ev) /* If ELM_DISPLAY is specified */
{
if (!strcmp(ev, "x11")) /* and it is X11 */
{
if (!have_display) /* if there is no $DISPLAY */
{
ERR("$ELM_DISPLAY is set to x11 but $DISPLAY"
" is not set");
init_x = EINA_FALSE;
}
else /* if there is */
init_x = EINA_TRUE;
}
else /* not X11 */
init_x = EINA_FALSE;
}
else /* ELM_DISPLAY not specified */
{
if (have_display) /* If there is a $DISPLAY */
init_x = EINA_TRUE;
else /* No $DISPLAY */
init_x = EINA_FALSE;
}
if (init_x)
ecore_x_init(NULL);
}
# endif