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)
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)
3280#undef ENGINE_COMPARE 3280#undef ENGINE_COMPARE
3281 { 3281 {
3282#ifdef HAVE_ELEMENTARY_X 3282#ifdef HAVE_ELEMENTARY_X
3283 ecore_x_shutdown(); 3283 if (ecore_x_display_get()) ecore_x_shutdown();
3284#endif 3284#endif
3285 } 3285 }
3286} 3286}
@@ -3298,57 +3298,60 @@ _elm_config_sub_init(void)
3298#undef ENGINE_COMPARE 3298#undef ENGINE_COMPARE
3299 { 3299 {
3300#ifdef HAVE_ELEMENTARY_X 3300#ifdef HAVE_ELEMENTARY_X
3301 if (ecore_x_init(NULL)) 3301 if (getenv("DISPLAY"))
3302 { 3302 {
3303 Ecore_X_Window win = 0, win2 = 0, root; 3303 if (ecore_x_init(NULL))
3304
3305 if (!ecore_x_screen_is_composited(0))
3306 _elm_config->compositing = 0;
3307 ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
3308 root = ecore_x_window_root_first_get();
3309 if (ecore_x_window_prop_window_get(root,
3310 _atom[ATOM_E_CONFIG_WIN],
3311 &win, 1) == 1)
3312 { 3304 {
3313 if (ecore_x_window_prop_window_get(win, 3305 Ecore_X_Window win = 0, win2 = 0, root;
3306
3307 if (!ecore_x_screen_is_composited(0))
3308 _elm_config->compositing = 0;
3309 ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
3310 root = ecore_x_window_root_first_get();
3311 if (ecore_x_window_prop_window_get(root,
3314 _atom[ATOM_E_CONFIG_WIN], 3312 _atom[ATOM_E_CONFIG_WIN],
3315 &win2, 1) == 1) 3313 &win, 1) == 1)
3316 { 3314 {
3317 if (win2 == win) _config_win = win; 3315 if (ecore_x_window_prop_window_get(win,
3316 _atom[ATOM_E_CONFIG_WIN],
3317 &win2, 1) == 1)
3318 {
3319 if (win2 == win) _config_win = win;
3320 }
3318 } 3321 }
3319 } 3322 if (_config_win == 0)
3320 if (_config_win == 0) 3323 _config_win = ecore_x_window_permanent_new
3321 _config_win = ecore_x_window_permanent_new 3324 (root, _atom[ATOM_E_CONFIG_WIN]);
3322 (root, _atom[ATOM_E_CONFIG_WIN]); 3325
3323 3326 ecore_x_event_mask_set(_config_win,
3324 ecore_x_event_mask_set(_config_win, 3327 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
3325 ECORE_X_EVENT_MASK_WINDOW_PROPERTY); 3328 _prop_change_handler = ecore_event_handler_add
3326 _prop_change_handler = ecore_event_handler_add 3329 (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
3327 (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL); 3330 if (!getenv("ELM_PROFILE"))
3328 if (!getenv("ELM_PROFILE"))
3329 {
3330 char *s;
3331
3332 s = ecore_x_window_prop_string_get(_config_win,
3333 _atom[ATOM_E_PROFILE]);
3334 if (s)
3335 { 3331 {
3336 int changed = 0; 3332 char *s;
3337 3333
3338 if (_elm_profile) 3334 s = ecore_x_window_prop_string_get(_config_win,
3335 _atom[ATOM_E_PROFILE]);
3336 if (s)
3339 { 3337 {
3340 if (strcmp(_elm_profile, s)) changed = 1; 3338 int changed = 0;
3341 free(_elm_profile); 3339
3340 if (_elm_profile)
3341 {
3342 if (strcmp(_elm_profile, s)) changed = 1;
3343 free(_elm_profile);
3344 }
3345 _elm_profile = s;
3346 if (changed) _prop_config_get();
3347 s = strchr(_elm_profile, '/');
3348 if (s) *s = 0;
3342 } 3349 }
3343 _elm_profile = s;
3344 if (changed) _prop_config_get();
3345 s = strchr(_elm_profile, '/');
3346 if (s) *s = 0;
3347 } 3350 }
3348 } 3351 }
3352 else
3353 ERR("Cannot connect to X11 display. check $DISPLAY variable");
3349 } 3354 }
3350 else
3351 ERR("Cannot connect to X11 display. check $DISPLAY variable");
3352#endif 3355#endif
3353 } 3356 }
3354 _config_sub_apply(); 3357 _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)
796#undef ENGINE_COMPARE 796#undef ENGINE_COMPARE
797 { 797 {
798# ifdef HAVE_ELEMENTARY_X 798# ifdef HAVE_ELEMENTARY_X
799 ecore_x_sync(); 799 if (ecore_x_display_get()) ecore_x_sync();
800# endif 800# endif
801 } 801 }
802 ecore_main_loop_iterate(); 802 ecore_main_loop_iterate();
@@ -964,7 +964,7 @@ elm_quicklaunch_fork(int argc,
964#undef ENGINE_COMPARE 964#undef ENGINE_COMPARE
965 { 965 {
966# ifdef HAVE_ELEMENTARY_X 966# ifdef HAVE_ELEMENTARY_X
967 ecore_x_init(NULL); 967 if (getenv("DISPLAY")) ecore_x_init(NULL);
968# endif 968# endif
969 } 969 }
970 ecore_evas_init(); // FIXME: check errors 970 ecore_evas_init(); // FIXME: check errors