summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@gmail.com>2015-01-09 14:41:04 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-01-09 14:41:04 +0900
commit16b8b9140048a456c4f9670c3fa00434f0761745 (patch)
treeff7c643cab52d25b70976f2bd6fe51ad78e78de8
parent06e0672f609195050a18b98e1a9641bd1a43858e (diff)
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
-rw-r--r--src/lib/elm_config.c29
-rw-r--r--src/lib/elm_main.c29
2 files changed, 54 insertions, 4 deletions
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 5ddea1edb..9fa9c0df8 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -3226,9 +3226,34 @@ void
3226_elm_config_sub_init(void) 3226_elm_config_sub_init(void)
3227{ 3227{
3228#ifdef HAVE_ELEMENTARY_X 3228#ifdef HAVE_ELEMENTARY_X
3229 Eina_Bool init_x;
3229 const char *ev = getenv("ELM_DISPLAY"); 3230 const char *ev = getenv("ELM_DISPLAY");
3230 if (((ev) && (!strcmp(ev, "x11")) && (getenv("DISPLAY"))) || 3231 Eina_Bool have_display = !!getenv("DISPLAY");
3231 (getenv("DISPLAY"))) 3232
3233 if (ev) /* If ELM_DISPLAY is specified */
3234 {
3235 if (!strcmp(ev, "x11")) /* and it is X11 */
3236 {
3237 if (!have_display) /* if there is no $DISPLAY */
3238 {
3239 ERR("$ELM_DISPLAY is set to x11 but $DISPLAY is not set");
3240 init_x = EINA_FALSE;
3241 }
3242 else /* if there is */
3243 init_x = EINA_TRUE;
3244 }
3245 else /* not X11 */
3246 init_x = EINA_FALSE;
3247 }
3248 else /* ELM_DISPLAY not specified */
3249 {
3250 if (have_display) /* If there is a $DISPLAY */
3251 init_x = EINA_TRUE;
3252 else /* No $DISPLAY */
3253 init_x = EINA_FALSE;
3254 }
3255
3256 if (init_x)
3232 { 3257 {
3233 if (ecore_x_init(NULL)) 3258 if (ecore_x_init(NULL))
3234 { 3259 {
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index 0f2e42943..4bb135e6f 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -957,9 +957,34 @@ elm_quicklaunch_fork(int argc,
957 _elm_config_sub_init(); 957 _elm_config_sub_init();
958# ifdef HAVE_ELEMENTARY_X 958# ifdef HAVE_ELEMENTARY_X
959 { 959 {
960 Eina_Bool init_x;
960 const char *ev = getenv("ELM_DISPLAY"); 961 const char *ev = getenv("ELM_DISPLAY");
961 if (((ev) && (!strcmp(ev, "x11")) && (getenv("DISPLAY"))) || 962 Eina_Bool have_display = !!getenv("DISPLAY");
962 (getenv("DISPLAY"))) 963
964 if (ev) /* If ELM_DISPLAY is specified */
965 {
966 if (!strcmp(ev, "x11")) /* and it is X11 */
967 {
968 if (!have_display) /* if there is no $DISPLAY */
969 {
970 ERR("$ELM_DISPLAY is set to x11 but $DISPLAY"
971 " is not set");
972 init_x = EINA_FALSE;
973 }
974 else /* if there is */
975 init_x = EINA_TRUE;
976 }
977 else /* not X11 */
978 init_x = EINA_FALSE;
979 }
980 else /* ELM_DISPLAY not specified */
981 {
982 if (have_display) /* If there is a $DISPLAY */
983 init_x = EINA_TRUE;
984 else /* No $DISPLAY */
985 init_x = EINA_FALSE;
986 }
987 if (init_x)
963 ecore_x_init(NULL); 988 ecore_x_init(NULL);
964 } 989 }
965# endif 990# endif