summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-11 08:21:03 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-11 08:21:03 +0900
commit466f0af56497c4c70982844cd51c1bbefa45d593 (patch)
treef7a2d878144c256f6c3210c953787ea0d18b0a6a
parent4213973d434e3a84968860359cfd5f7dde9c01e2 (diff)
downloadelementary-466f0af56497c4c70982844cd51c1bbefa45d593.tar.gz
elm - do not do x11 main/config stuff without DISPLAY set
the engine checks are also broken - but that's a much bigger change, so this fixes elm config and main code to not do their x11 work if no DISPLAY env var is set. this is right for a wayland world where you don't want DISPLAY but WAYLAND_DISPLAY set and used. this fixes several ERRs that should never have hapapned in this setup.
-rw-r--r--src/lib/elm_config.c83
-rw-r--r--src/lib/elm_main.c4
2 files changed, 45 insertions, 42 deletions
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index a74c49cab..44fbc2e88 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -3280,7 +3280,7 @@ _elm_config_sub_shutdown(void)
#undef ENGINE_COMPARE
{
#ifdef HAVE_ELEMENTARY_X
- ecore_x_shutdown();
+ if (ecore_x_display_get()) ecore_x_shutdown();
#endif
}
}
@@ -3298,57 +3298,60 @@ _elm_config_sub_init(void)
#undef ENGINE_COMPARE
{
#ifdef HAVE_ELEMENTARY_X
- if (ecore_x_init(NULL))
+ if (getenv("DISPLAY"))
{
- Ecore_X_Window win = 0, win2 = 0, root;
-
- if (!ecore_x_screen_is_composited(0))
- _elm_config->compositing = 0;
- ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
- root = ecore_x_window_root_first_get();
- if (ecore_x_window_prop_window_get(root,
- _atom[ATOM_E_CONFIG_WIN],
- &win, 1) == 1)
+ if (ecore_x_init(NULL))
{
- if (ecore_x_window_prop_window_get(win,
+ Ecore_X_Window win = 0, win2 = 0, root;
+
+ if (!ecore_x_screen_is_composited(0))
+ _elm_config->compositing = 0;
+ ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
+ root = ecore_x_window_root_first_get();
+ if (ecore_x_window_prop_window_get(root,
_atom[ATOM_E_CONFIG_WIN],
- &win2, 1) == 1)
+ &win, 1) == 1)
{
- if (win2 == win) _config_win = win;
+ if (ecore_x_window_prop_window_get(win,
+ _atom[ATOM_E_CONFIG_WIN],
+ &win2, 1) == 1)
+ {
+ if (win2 == win) _config_win = win;
+ }
}
- }
- if (_config_win == 0)
- _config_win = ecore_x_window_permanent_new
- (root, _atom[ATOM_E_CONFIG_WIN]);
-
- ecore_x_event_mask_set(_config_win,
- ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
- _prop_change_handler = ecore_event_handler_add
- (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
- if (!getenv("ELM_PROFILE"))
- {
- char *s;
-
- s = ecore_x_window_prop_string_get(_config_win,
- _atom[ATOM_E_PROFILE]);
- if (s)
+ if (_config_win == 0)
+ _config_win = ecore_x_window_permanent_new
+ (root, _atom[ATOM_E_CONFIG_WIN]);
+
+ ecore_x_event_mask_set(_config_win,
+ ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
+ _prop_change_handler = ecore_event_handler_add
+ (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
+ if (!getenv("ELM_PROFILE"))
{
- int changed = 0;
+ char *s;
- if (_elm_profile)
+ s = ecore_x_window_prop_string_get(_config_win,
+ _atom[ATOM_E_PROFILE]);
+ if (s)
{
- if (strcmp(_elm_profile, s)) changed = 1;
- free(_elm_profile);
+ int changed = 0;
+
+ if (_elm_profile)
+ {
+ if (strcmp(_elm_profile, s)) changed = 1;
+ free(_elm_profile);
+ }
+ _elm_profile = s;
+ if (changed) _prop_config_get();
+ s = strchr(_elm_profile, '/');
+ if (s) *s = 0;
}
- _elm_profile = s;
- if (changed) _prop_config_get();
- s = strchr(_elm_profile, '/');
- if (s) *s = 0;
}
}
+ else
+ ERR("Cannot connect to X11 display. check $DISPLAY variable");
}
- else
- ERR("Cannot connect to X11 display. check $DISPLAY variable");
#endif
}
_config_sub_apply();
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index bcd72135c..e4089854d 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -796,7 +796,7 @@ elm_quicklaunch_seed(void)
#undef ENGINE_COMPARE
{
# ifdef HAVE_ELEMENTARY_X
- ecore_x_sync();
+ if (ecore_x_display_get()) ecore_x_sync();
# endif
}
ecore_main_loop_iterate();
@@ -964,7 +964,7 @@ elm_quicklaunch_fork(int argc,
#undef ENGINE_COMPARE
{
# ifdef HAVE_ELEMENTARY_X
- ecore_x_init(NULL);
+ if (getenv("DISPLAY")) ecore_x_init(NULL);
# endif
}
ecore_evas_init(); // FIXME: check errors