2 # include "elementary_config.h"
9 #include <Elementary.h>
13 Elm_Config *_elm_config = NULL;
14 char *_elm_profile = NULL;
15 static Eet_Data_Descriptor *_config_edd = NULL;
16 static Eet_Data_Descriptor *_config_font_overlay_edd = NULL;
18 static Ecore_Poller *_elm_cache_flush_poller = NULL;
20 const char *_elm_engines[] = {
29 "software_16_wince_gdi",
37 /* whenever you want to add a new text class support into Elementary,
38 declare it both here and in the (default) theme */
39 static const Elm_Text_Class _elm_text_classes[] = {
40 {"button", "Button Labels"},
41 {"label", "Text Labels"},
42 {"entry", "Text Entries"},
43 {"title_bar", "Title Bar"},
44 {"list_item", "List Items"},
45 {"grid_item", "Grid Items"},
46 {"toolbar_item", "Toolbar Items"},
47 {"menu_item", "Menu Items"},
51 static void _desc_init(void);
52 static void _desc_shutdown(void);
53 static void _profile_fetch_from_conf(void);
54 static void _config_free(void);
55 static void _config_apply(void);
56 static Elm_Config *_config_user_load(void);
57 static Elm_Config *_config_system_load(void);
58 static void _config_load(void);
59 static void _config_update(void);
60 static void _env_get(void);
61 static size_t _elm_data_dir_snprintf(char *dst,
65 static size_t _elm_user_dir_snprintf(char *dst,
70 #define ELM_CONFIG_VAL(edd, type, member, dtype) \
71 EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
72 #define ELM_CONFIG_LIST(edd, type, member, eddtype) \
73 EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype)
75 #ifdef HAVE_ELEMENTARY_X
76 static Ecore_Event_Handler *_prop_change_handler = NULL;
77 static Ecore_X_Window _root_1st = 0;
79 static Ecore_X_Atom _atom[ATOM_COUNT];
80 static Ecore_X_Atom _atom_config = 0;
81 static const char *_atom_names[ATOM_COUNT] =
83 "ENLIGHTENMENT_SCALE",
84 "ENLIGHTENMENT_FINGER_SIZE",
85 "ENLIGHTENMENT_THEME",
86 "ENLIGHTENMENT_PROFILE",
87 "ENLIGHTENMENT_FONT_OVERLAY",
88 "ENLIGHTENMENT_CACHE_FLUSH_INTERVAL",
89 "ENLIGHTENMENT_CACHE_FLUSH_ENABLE",
90 "ENLIGHTENMENT_FONT_CACHE",
91 "ENLIGHTENMENT_IMAGE_CACHE",
92 "ENLIGHTENMENT_EDJE_FILE_CACHE",
93 "ENLIGHTENMENT_EDJE_COLLECTION_CACHE",
94 "ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE",
95 "ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION",
96 "ENLIGHTENMENT_THUMBSCROLL_ENABLE",
97 "ENLIGHTENMENT_THUMBSCROLL_THRESHOLD",
98 "ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD",
99 "ENLIGHTENMENT_THUMBSCROLL_FRICTION",
100 "ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION",
101 "ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION",
102 "ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION",
103 "ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION",
104 "ENLIGHTENMENT_CONFIG"
106 #define ATOM_E_SCALE 0
107 #define ATOM_E_FINGER_SIZE 1
108 #define ATOM_E_THEME 2
109 #define ATOM_E_PROFILE 3
110 #define ATOM_E_FONT_OVERLAY 4
111 #define ATOM_E_CACHE_FLUSH_INTERVAL 5
112 #define ATOM_E_CACHE_FLUSH_ENABLE 6
113 #define ATOM_E_FONT_CACHE 7
114 #define ATOM_E_IMAGE_CACHE 8
115 #define ATOM_E_EDJE_FILE_CACHE 9
116 #define ATOM_E_EDJE_COLLECTION_CACHE 10
117 #define ATOM_E_THUMBSCROLL_BOUNCE_ENABLE 11
118 #define ATOM_E_THUMBSCROLL_BOUNCE_FRICTION 12
119 #define ATOM_E_THUMBSCROLL_ENABLE 13
120 #define ATOM_E_THUMBSCROLL_THRESHOLD 14
121 #define ATOM_E_THUMBSCROLL_MOMENTUM_THRESHOLD 15
122 #define ATOM_E_THUMBSCROLL_FRICTION 16
123 #define ATOM_E_THUMBSCROLL_BORDER_FRICTION 17
124 #define ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION 18
125 #define ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION 19
126 #define ATOM_E_THUMBSCROLL_ZOOM_FRICTION 20
127 #define ATOM_E_CONFIG 21
129 static Eina_Bool _prop_config_get(void);
130 static Eina_Bool _prop_change(void *data __UNUSED__,
131 int ev_type __UNUSED__,
135 _prop_config_get(void)
140 unsigned char *data = NULL;
141 Elm_Config *config_data;
143 snprintf(buf, sizeof(buf), "ENLIGHTENMENT_CONFIG_%s", _elm_profile);
144 atom = ecore_x_atom_get(buf);
146 if (!ecore_x_window_prop_property_get(_root_1st,
147 atom, _atom[ATOM_E_CONFIG],
150 if (!ecore_x_window_prop_property_get(_root_1st,
151 _atom[ATOM_E_CONFIG],
152 _atom[ATOM_E_CONFIG],
156 _atom_config = _atom[ATOM_E_CONFIG];
165 config_data = eet_data_descriptor_decode(_config_edd, data, size);
167 if (!config_data) return EINA_FALSE;
169 /* What do we do on version mismatch when someone changes the
170 * config in the rootwindow? */
171 /* Most obvious case, new version and we are still linked to
172 * whatever was there before, we just ignore until user restarts us */
173 if (config_data->config_version > ELM_CONFIG_VERSION)
175 /* What in the case the version is older? Do we even support those
176 * cases or we only check for equality above? */
179 _elm_config = config_data;
181 _elm_config_font_overlay_apply();
188 _prop_change(void *data __UNUSED__,
189 int ev_type __UNUSED__,
192 Ecore_X_Event_Window_Property *event = ev;
194 if (event->win == _root_1st)
196 if (event->atom == _atom[ATOM_E_SCALE])
198 unsigned int val = 1000;
200 if (ecore_x_window_prop_card32_get(event->win,
206 pscale = _elm_config->scale;
207 if (val > 0) _elm_config->scale = (double)val / 1000.0;
208 if (pscale != _elm_config->scale)
215 else if (event->atom == _atom[ATOM_E_FINGER_SIZE])
217 unsigned int val = 1000;
219 if (ecore_x_window_prop_card32_get(event->win,
225 pfinger_size = _elm_config->finger_size;
226 _elm_config->finger_size = val;
227 if (pfinger_size != _elm_config->finger_size)
234 else if (event->atom == _atom[ATOM_E_THEME])
238 val = ecore_x_window_prop_string_get(event->win,
240 eina_stringshare_replace(&_elm_config->theme, val);
243 _elm_theme_parse(NULL, val);
249 else if (event->atom == _atom[ATOM_E_PROFILE])
253 val = ecore_x_window_prop_string_get(event->win,
261 if (strcmp(_elm_profile, val)) changed = 1;
267 if (!_prop_config_get())
272 _elm_config_font_overlay_apply();
278 else if (event->atom == _atom[ATOM_E_FONT_OVERLAY])
280 unsigned int val = 1000;
282 if (ecore_x_window_prop_card32_get(event->win,
289 _elm_config_font_overlay_apply();
293 else if (event->atom == _atom[ATOM_E_CACHE_FLUSH_INTERVAL])
295 unsigned int val = 1000;
297 if (ecore_x_window_prop_card32_get(event->win,
301 int cache_flush_interval;
303 cache_flush_interval = _elm_config->cache_flush_poll_interval;
304 _elm_config->cache_flush_poll_interval = val;
305 if (cache_flush_interval !=
306 _elm_config->cache_flush_poll_interval)
310 else if (event->atom == _atom[ATOM_E_CACHE_FLUSH_ENABLE])
312 unsigned int val = 1000;
314 if (ecore_x_window_prop_card32_get(event->win,
318 _elm_config->cache_flush_enable = !!val;
322 else if (event->atom == _atom[ATOM_E_FONT_CACHE])
324 unsigned int val = 1000;
326 if (ecore_x_window_prop_card32_get(event->win,
332 font_cache = _elm_config->font_cache;
333 _elm_config->font_cache = val;
334 if (font_cache != _elm_config->font_cache)
338 else if (event->atom == _atom[ATOM_E_IMAGE_CACHE])
340 unsigned int val = 1000;
342 if (ecore_x_window_prop_card32_get(event->win,
348 image_cache = _elm_config->image_cache;
349 _elm_config->image_cache = val;
350 if (image_cache != _elm_config->image_cache)
354 else if (event->atom == _atom[ATOM_E_EDJE_FILE_CACHE])
356 unsigned int val = 1000;
358 if (ecore_x_window_prop_card32_get(event->win,
364 edje_file_cache = _elm_config->edje_cache;
365 _elm_config->edje_cache = val;
366 if (edje_file_cache != _elm_config->edje_cache)
370 else if (event->atom == _atom[ATOM_E_EDJE_COLLECTION_CACHE])
372 unsigned int val = 1000;
374 if (ecore_x_window_prop_card32_get(event->win,
378 int edje_collection_cache;
380 edje_collection_cache = _elm_config->edje_collection_cache;
381 _elm_config->edje_collection_cache = val;
382 if (edje_collection_cache !=
383 _elm_config->edje_collection_cache)
387 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BOUNCE_ENABLE])
389 unsigned int val = 1000;
391 if (ecore_x_window_prop_card32_get(event->win,
395 _elm_config->thumbscroll_bounce_enable = !!val;
398 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BOUNCE_FRICTION])
400 unsigned int val = 1000;
402 if (ecore_x_window_prop_card32_get(event->win,
407 _elm_config->thumbscroll_bounce_friction =
408 (double)val / 1000.0;
411 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_ENABLE])
413 unsigned int val = 1000;
415 if (ecore_x_window_prop_card32_get(event->win,
419 _elm_config->thumbscroll_enable = !!val;
422 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_THRESHOLD])
424 unsigned int val = 1000;
426 if (ecore_x_window_prop_card32_get(event->win,
430 if (val > 0) _elm_config->thumbscroll_threshold = val;
433 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_MOMENTUM_THRESHOLD])
435 unsigned int val = 1000;
437 if (ecore_x_window_prop_card32_get(event->win,
441 _elm_config->thumbscroll_momentum_threshold =
442 (double)val / 1000.0;
445 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_FRICTION])
447 unsigned int val = 1000;
449 if (ecore_x_window_prop_card32_get(event->win,
453 _elm_config->thumbscroll_friction = (double)val / 1000.0;
456 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BORDER_FRICTION])
458 unsigned int val = 1000;
460 if (ecore_x_window_prop_card32_get(event->win,
464 _elm_config->thumbscroll_border_friction =
465 (double)val / 1000.0;
468 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION])
470 unsigned int val = 1000;
472 if (ecore_x_window_prop_card32_get(event->win,
476 _elm_config->page_scroll_friction =
477 (double)val / 1000.0;
480 else if (event->atom ==
481 _atom[ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION])
483 unsigned int val = 1000;
485 if (ecore_x_window_prop_card32_get(event->win,
489 _elm_config->bring_in_scroll_friction =
490 (double)val / 1000.0;
493 else if (event->atom ==
494 _atom[ATOM_E_THUMBSCROLL_ZOOM_FRICTION])
496 unsigned int val = 1000;
498 if (ecore_x_window_prop_card32_get(event->win,
502 _elm_config->zoom_friction = (double)val / 1000.0;
505 else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
506 (event->atom == _atom[ATOM_E_CONFIG]))
511 return ECORE_CALLBACK_PASS_ON;
519 Eet_Data_Descriptor_Class eddc;
521 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config);
522 eddc.func.str_direct_alloc = NULL;
523 eddc.func.str_direct_free = NULL;
525 _config_edd = eet_data_descriptor_file_new(&eddc);
528 printf("EEEK! eet_data_descriptor_file_new() failed\n");
532 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
533 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Font_Overlay);
534 eddc.func.str_direct_alloc = NULL;
535 eddc.func.str_direct_free = NULL;
537 _config_font_overlay_edd = eet_data_descriptor_stream_new(&eddc);
538 if (!_config_font_overlay_edd)
540 printf("EEEK! eet_data_descriptor_stream_new() failed\n");
541 eet_data_descriptor_free(_config_edd);
544 #define T_INT EET_T_INT
545 #define T_DOUBLE EET_T_DOUBLE
546 #define T_STRING EET_T_STRING
547 #define T_UCHAR EET_T_UCHAR
549 #define T Elm_Font_Overlay
550 #define D _config_font_overlay_edd
551 ELM_CONFIG_VAL(D, T, text_class, EET_T_STRING);
552 ELM_CONFIG_VAL(D, T, font, EET_T_STRING);
553 ELM_CONFIG_VAL(D, T, size, EET_T_INT);
558 #define D _config_edd
559 ELM_CONFIG_VAL(D, T, config_version, T_INT);
560 ELM_CONFIG_VAL(D, T, engine, T_STRING);
561 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
562 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
563 ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
564 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
565 ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
566 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
567 ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
568 ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
569 ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
570 ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
571 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
572 ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
573 ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
574 ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE);
575 ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
576 ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
577 ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
578 ELM_CONFIG_VAL(D, T, compositing, T_INT);
579 /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
580 ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd);
581 ELM_CONFIG_VAL(D, T, font_hinting, T_INT);
582 ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT);
583 ELM_CONFIG_VAL(D, T, cache_flush_enable, T_UCHAR);
584 ELM_CONFIG_VAL(D, T, image_cache, T_INT);
585 ELM_CONFIG_VAL(D, T, font_cache, T_INT);
586 ELM_CONFIG_VAL(D, T, edje_cache, T_INT);
587 ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT);
588 ELM_CONFIG_VAL(D, T, finger_size, T_INT);
589 ELM_CONFIG_VAL(D, T, fps, T_DOUBLE);
590 ELM_CONFIG_VAL(D, T, theme, T_STRING);
591 ELM_CONFIG_VAL(D, T, modules, T_STRING);
592 ELM_CONFIG_VAL(D, T, tooltip_delay, T_DOUBLE);
593 ELM_CONFIG_VAL(D, T, cursor_engine_only, T_UCHAR);
594 ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR);
595 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
596 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
597 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
598 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR);
599 ELM_CONFIG_VAL(D, T, icon_size, T_INT);
600 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
601 ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR);
602 ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR);
603 ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR);
604 ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE);
605 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_factor, T_DOUBLE);
606 ELM_CONFIG_VAL(D, T, glayer_zoom_wheel_factor, T_DOUBLE);
607 ELM_CONFIG_VAL(D, T, glayer_zoom_distance_tolerance, T_DOUBLE);
608 ELM_CONFIG_VAL(D, T, glayer_rotate_angular_tolerance, T_DOUBLE);
609 ELM_CONFIG_VAL(D, T, glayer_line_min_length, T_DOUBLE);
610 ELM_CONFIG_VAL(D, T, glayer_line_distance_tolerance, T_DOUBLE);
611 ELM_CONFIG_VAL(D, T, glayer_line_angular_tolerance, T_DOUBLE);
612 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
613 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
614 ELM_CONFIG_VAL(D, T, access_mode, T_INT);
615 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
629 eet_data_descriptor_free(_config_edd);
633 if (_config_font_overlay_edd)
635 eet_data_descriptor_free(_config_font_overlay_edd);
636 _config_font_overlay_edd = NULL;
641 _sort_files_cb(const void *f1,
644 return strcmp(f1, f2);
648 _elm_config_current_profile_get(void)
654 _elm_data_dir_snprintf(char *dst,
659 size_t data_dir_len, off;
662 data_dir_len = eina_strlcpy(dst, _elm_data_dir, size);
664 off = data_dir_len + 1;
669 dst[data_dir_len] = '/';
671 off = off + vsnprintf(dst + off, size - off, fmt, ap);
679 _elm_user_dir_snprintf(char *dst,
685 size_t user_dir_len, off;
689 home = evil_homedir_get();
691 home = getenv("HOME");
696 user_dir_len = eina_str_join_len(dst, size, '/', home, strlen(home),
697 ".elementary", sizeof(".elementary") - 1);
699 off = user_dir_len + 1;
704 dst[user_dir_len] = '/';
706 off = off + vsnprintf(dst + off, size - off, fmt, ap);
714 _elm_config_profile_dir_get(const char *prof,
722 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof);
724 if (ecore_file_is_dir(buf))
730 snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof);
732 if (ecore_file_is_dir(buf))
739 _elm_config_font_overlays_list(void)
741 return _elm_config->font_overlays;
745 _elm_config_font_overlay_set(const char *text_class,
749 Elm_Font_Overlay *efd;
752 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
754 if (strcmp(efd->text_class, text_class))
757 if (efd->font) eina_stringshare_del(efd->font);
758 efd->font = eina_stringshare_add(font);
760 _elm_config->font_overlays =
761 eina_list_promote_list(_elm_config->font_overlays, l);
765 /* the text class doesn't exist */
766 efd = calloc(1, sizeof(Elm_Font_Overlay));
767 efd->text_class = eina_stringshare_add(text_class);
768 efd->font = eina_stringshare_add(font);
771 _elm_config->font_overlays = eina_list_prepend(_elm_config->font_overlays,
776 _elm_config_font_overlay_remove(const char *text_class)
778 Elm_Font_Overlay *efd;
781 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
783 if (strcmp(efd->text_class, text_class))
786 _elm_config->font_overlays =
787 eina_list_remove_list(_elm_config->font_overlays, l);
788 if (efd->text_class) eina_stringshare_del(efd->text_class);
789 if (efd->font) eina_stringshare_del(efd->font);
797 _elm_config_font_overlay_apply(void)
799 Elm_Font_Overlay *efd;
803 for (i = 0; _elm_text_classes[i].desc; i++)
804 edje_text_class_del(_elm_text_classes[i].name);
806 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
807 edje_text_class_set(efd->text_class, efd->font, efd->size);
811 _elm_config_text_classes_get(void)
813 Eina_List *ret = NULL;
816 for (i = 0; _elm_text_classes[i].desc; i++)
819 tc = malloc(sizeof(*tc));
821 *tc = _elm_text_classes[i];
823 ret = eina_list_append(ret, tc);
830 _elm_config_text_classes_free(Eina_List *l)
834 EINA_LIST_FREE(l, tc)
839 _elm_config_profiles_list(void)
841 const Eina_File_Direct_Info *info;
842 Eina_List *flist = NULL;
843 Eina_Iterator *file_it;
848 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config");
850 file_it = eina_file_direct_ls(buf);
857 len = sizeof(buf) - len;
859 EINA_ITERATOR_FOREACH(file_it, info)
861 if (info->name_length >= len)
864 if (info->type == EINA_FILE_DIR)
867 eina_list_sorted_insert(flist, _sort_files_cb,
868 eina_stringshare_add(info->path +
873 eina_iterator_free(file_it);
876 len = eina_str_join_len(buf, sizeof(buf), '/', _elm_data_dir,
877 strlen(_elm_data_dir), "config",
878 sizeof("config") - 1);
880 file_it = eina_file_direct_ls(buf);
887 len = sizeof(buf) - len;
888 EINA_ITERATOR_FOREACH(file_it, info)
890 if (info->name_length >= len)
900 EINA_LIST_FOREACH(flist, l, tmp)
901 if (!strcmp(info->path + info->name_start, tmp))
906 eina_list_sorted_insert(flist, _sort_files_cb,
907 eina_stringshare_add(info->path +
916 eina_iterator_free(file_it);
920 EINA_LIST_FREE(flist, dir)
921 eina_stringshare_del(dir);
927 _profile_fetch_from_conf(void)
929 char buf[PATH_MAX], *p, *s;
933 _elm_profile = strdup("default");
935 // if env var - use profile without question
936 s = getenv("ELM_PROFILE");
940 _elm_profile = strdup(s);
945 _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
946 ef = eet_open(buf, EET_FILE_MODE_READ);
949 p = eet_read(ef, "config", &len);
953 _elm_profile = malloc(len + 1);
954 memcpy(_elm_profile, p, len);
955 _elm_profile[len] = 0;
964 _elm_data_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
965 ef = eet_open(buf, EET_FILE_MODE_READ);
968 p = eet_read(ef, "config", &len);
972 _elm_profile = malloc(len + 1);
973 memcpy(_elm_profile, p, len);
974 _elm_profile[len] = 0;
984 Elm_Font_Overlay *fo;
987 if (!_elm_config) return;
988 EINA_LIST_FREE(_elm_config->font_dirs, fontdir)
990 eina_stringshare_del(fontdir);
992 if (_elm_config->engine) eina_stringshare_del(_elm_config->engine);
993 EINA_LIST_FREE(_elm_config->font_overlays, fo)
995 if (fo->text_class) eina_stringshare_del(fo->text_class);
996 if (fo->font) eina_stringshare_del(fo->font);
999 if (_elm_config->theme) eina_stringshare_del(_elm_config->theme);
1000 if (_elm_config->modules) eina_stringshare_del(_elm_config->modules);
1008 _elm_theme_parse(NULL, _elm_config->theme);
1009 ecore_animator_frametime_set(1.0 / _elm_config->fps);
1013 _config_sub_apply(void)
1015 edje_frametime_set(1.0 / _elm_config->fps);
1016 edje_scale_set(_elm_config->scale);
1017 edje_password_show_last_set(_elm_config->password_show_last);
1018 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1019 if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
1023 _elm_cache_flush_cb(void *data __UNUSED__)
1026 return ECORE_CALLBACK_RENEW;
1029 /* kind of abusing this call right now -- shared between all of those
1030 * properties -- but they are not meant to be called that periodically
1040 EINA_LIST_FOREACH(_elm_win_list, l, win)
1042 Evas *e = evas_object_evas_get(win);
1043 evas_image_cache_set(e, _elm_config->image_cache * 1024);
1044 evas_font_cache_set(e, _elm_config->font_cache * 1024);
1046 edje_file_cache_set(_elm_config->edje_cache);
1047 edje_collection_cache_set(_elm_config->edje_collection_cache);
1049 if (_elm_cache_flush_poller)
1051 ecore_poller_del(_elm_cache_flush_poller);
1052 _elm_cache_flush_poller = NULL;
1054 if (_elm_config->cache_flush_enable)
1056 if (_elm_config->cache_flush_poll_interval > 0)
1058 _elm_cache_flush_poller =
1059 ecore_poller_add(ECORE_POLLER_CORE,
1060 _elm_config->cache_flush_poll_interval,
1061 _elm_cache_flush_cb, NULL);
1067 _config_user_load(void)
1069 Elm_Config *cfg = NULL;
1073 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
1076 ef = eet_open(buf, EET_FILE_MODE_READ);
1079 cfg = eet_data_read(ef, _config_edd, "config");
1086 _config_system_load(void)
1088 Elm_Config *cfg = NULL;
1092 _elm_data_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
1095 ef = eet_open(buf, EET_FILE_MODE_READ);
1098 cfg = eet_data_read(ef, _config_edd, "config");
1107 _elm_config = _config_user_load();
1110 if (_elm_config->config_version < ELM_CONFIG_VERSION)
1115 /* no user config, fallback for system. No need to check version for
1116 * this one, if it's not the right one, someone screwed up at the time
1117 * of installing it */
1118 _elm_config = _config_system_load();
1119 if (_elm_config) return;
1120 /* FIXME: config load could have failed because of a non-existent
1121 * profile. Fallback to default before moving on */
1123 // config load fail - defaults
1124 /* XXX: do these make sense? Only if it's valid to install the lib
1125 * without the config, but do we want that? */
1126 _elm_config = ELM_NEW(Elm_Config);
1127 _elm_config->config_version = ELM_CONFIG_VERSION;
1128 _elm_config->engine = eina_stringshare_add("software_x11");
1129 _elm_config->vsync = 0;
1130 _elm_config->thumbscroll_enable = EINA_TRUE;
1131 _elm_config->thumbscroll_threshold = 24;
1132 _elm_config->thumbscroll_momentum_threshold = 100.0;
1133 _elm_config->thumbscroll_friction = 1.0;
1134 _elm_config->thumbscroll_bounce_friction = 0.5;
1135 _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
1136 _elm_config->page_scroll_friction = 0.5;
1137 _elm_config->bring_in_scroll_friction = 0.5;
1138 _elm_config->zoom_friction = 0.5;
1139 _elm_config->thumbscroll_border_friction = 0.5;
1140 _elm_config->scroll_smooth_amount = 1.0;
1141 _elm_config->scroll_smooth_history_weight = 0.3;
1142 _elm_config->scroll_smooth_future_time = 0.0;
1143 _elm_config->scroll_smooth_time_window = 0.2;
1144 _elm_config->scale = 1.0;
1145 _elm_config->bgpixmap = 0;
1146 _elm_config->compositing = 1;
1147 _elm_config->font_hinting = 2;
1148 _elm_config->cache_flush_poll_interval = 512;
1149 _elm_config->cache_flush_enable = EINA_TRUE;
1150 _elm_config->font_dirs = NULL;
1151 _elm_config->image_cache = 4096;
1152 _elm_config->font_cache = 512;
1153 _elm_config->edje_cache = 32;
1154 _elm_config->edje_collection_cache = 64;
1155 _elm_config->finger_size = 40;
1156 _elm_config->fps = 60.0;
1157 _elm_config->theme = eina_stringshare_add("default");
1158 _elm_config->modules = NULL;
1159 _elm_config->tooltip_delay = 1.0;
1160 _elm_config->cursor_engine_only = EINA_TRUE;
1161 _elm_config->focus_highlight_enable = EINA_FALSE;
1162 _elm_config->focus_highlight_animate = EINA_TRUE;
1163 _elm_config->toolbar_shrink_mode = 2;
1164 _elm_config->fileselector_expand_enable = EINA_FALSE;
1165 _elm_config->inwin_dialogs_enable = EINA_FALSE;
1166 _elm_config->icon_size = 32;
1167 _elm_config->longpress_timeout = 1.0;
1168 _elm_config->effect_enable = EINA_TRUE;
1169 _elm_config->desktop_entry = EINA_FALSE;
1170 _elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
1171 _elm_config->password_show_last = EINA_FALSE;
1172 _elm_config->password_show_last_timeout = 2.0;
1173 _elm_config->glayer_zoom_finger_factor = 1.0;
1174 _elm_config->glayer_zoom_wheel_factor = 0.05;
1175 _elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_finger_size_get() */
1176 _elm_config->glayer_rotate_angular_tolerance = 0.034906585; /* Represents 2 DEG */
1177 _elm_config->glayer_line_min_length = 1.0; /* 1 times elm_finger_size_get() */
1178 _elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_finger_size_get() */
1179 _elm_config->glayer_line_angular_tolerance = 0.34906585; /* Represents 20 DEG */
1180 _elm_config->glayer_flick_time_limit_ms = 60; /* 60 ms to finish flick */
1181 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
1182 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
1186 _elm_config_eet_close_error_get(Eet_File *ef,
1190 const char *erstr = NULL;
1192 err = eet_close(ef);
1195 case EET_ERROR_WRITE_ERROR:
1196 erstr = "An error occurred while saving Elementary's "
1197 "settings to disk. The error could not be "
1198 "deterimined. The file where the error occurred was: "
1199 "%s. This file has been deleted to avoid corrupt data.";
1202 case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG:
1203 erstr = "Elementary's settings files are too big "
1204 "for the file system they are being saved to. "
1205 "This error is very strange as the files should "
1206 "be extremely small. Please check the settings "
1207 "for your home directory. "
1208 "The file where the error occurred was: %s ."
1209 "This file has been deleted to avoid corrupt data.";
1212 case EET_ERROR_WRITE_ERROR_IO_ERROR:
1213 erstr = "An output error occurred when writing the settings "
1214 "files for Elementary. Your disk is having troubles "
1215 "and possibly needs replacement. "
1216 "The file where the error occurred was: %s ."
1217 "This file has been deleted to avoid corrupt data.";
1220 case EET_ERROR_WRITE_ERROR_OUT_OF_SPACE:
1221 erstr = "Elementary cannot write its settings file "
1222 "because it ran out of space to write the file. "
1223 "You have either run out of disk space or have "
1224 "gone over your quota limit. "
1225 "The file where the error occurred was: %s ."
1226 "This file has been deleted to avoid corrupt data.";
1229 case EET_ERROR_WRITE_ERROR_FILE_CLOSED:
1230 erstr = "Elementary unexpectedly had the settings file "
1231 "it was writing closed on it. This is very unusual. "
1232 "The file where the error occurred was: %s "
1233 "This file has been deleted to avoid corrupt data.";
1241 /* delete any partially-written file */
1242 ecore_file_unlink(file);
1243 return strdup(erstr);
1250 _elm_config_profile_save(void)
1252 char buf[4096], buf2[4096];
1258 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
1259 if (len + 1 >= sizeof(buf))
1262 len = _elm_user_dir_snprintf(buf2, sizeof(buf2), "config/profile.cfg.tmp");
1263 if (len + 1 >= sizeof(buf2))
1266 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1270 ok = eet_write(ef, "config", _elm_profile, strlen(_elm_profile), 0);
1274 err = _elm_config_eet_close_error_get(ef, buf2);
1282 ret = ecore_file_mv(buf2, buf);
1285 ERR("Error saving Elementary's configuration file");
1289 ecore_file_unlink(buf2);
1293 ecore_file_unlink(buf2);
1298 _elm_config_save(void)
1300 char buf[4096], buf2[4096];
1306 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", _elm_profile);
1307 if (len + 1 >= sizeof(buf))
1310 ok = ecore_file_mkpath(buf);
1313 ERR("Problem acessing Elementary's user configuration directory: %s",
1318 if (!_elm_config_profile_save())
1324 if (len + sizeof("base.cfg") >= sizeof(buf) - len)
1327 memcpy(buf + len, "base.cfg", sizeof("base.cfg"));
1328 len += sizeof("base.cfg") - 1;
1330 if (len + sizeof(".tmp") >= sizeof(buf))
1333 memcpy(buf2, buf, len);
1334 memcpy(buf2 + len, ".tmp", sizeof(".tmp"));
1336 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1340 ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1);
1344 err = _elm_config_eet_close_error_get(ef, buf2);
1352 ret = ecore_file_mv(buf2, buf);
1355 ERR("Error saving Elementary's configuration file");
1359 ecore_file_unlink(buf2);
1363 ecore_file_unlink(buf2);
1368 _config_update(void)
1372 tcfg = _config_system_load();
1375 /* weird profile or something? We should probably fill
1376 * with hardcoded defaults, or get from default previx */
1379 #define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) {
1380 #define IFCFGELSE } else {
1382 #define COPYVAL(x) do {_elm_config->x = tcfg->x; } while(0)
1383 #define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while(0)
1384 #define COPYSTR(x) COPYPTR(x)
1386 /* we also need to update for property changes in the root window
1387 * if needed, but that will be dependent on new properties added
1388 * with each version */
1391 COPYVAL(longpress_timeout);
1401 /* after updating user config, we must save */
1410 s = getenv("ELM_ENGINE");
1413 if ((!strcasecmp(s, "x11")) ||
1414 (!strcasecmp(s, "x")) ||
1415 (!strcasecmp(s, "software-x11")) ||
1416 (!strcasecmp(s, "software_x11")))
1417 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_X11);
1418 else if ((!strcasecmp(s, "opengl")) ||
1419 (!strcasecmp(s, "gl")) ||
1420 (!strcasecmp(s, "opengl-x11")) ||
1421 (!strcasecmp(s, "opengl_x11")))
1422 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_X11);
1423 else if ((!strcasecmp(s, "x11-8")) ||
1424 (!strcasecmp(s, "x8")) ||
1425 (!strcasecmp(s, "software-8-x11")) ||
1426 (!strcasecmp(s, "software_8_x11")))
1427 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_8_X11);
1428 else if ((!strcasecmp(s, "x11-16")) ||
1429 (!strcasecmp(s, "x16")) ||
1430 (!strcasecmp(s, "software-16-x11")) ||
1431 (!strcasecmp(s, "software_16_x11")))
1432 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_X11);
1434 else if ((!strcasecmp(s, "xrender")) ||
1435 (!strcasecmp(s, "xr")) ||
1436 (!strcasecmp(s, "xrender-x11")) ||
1437 (!strcasecmp(s, "xrender_x11")))
1438 eina_stringshare_replace(&_elm_config->engine, ELM_XRENDER_X11);
1440 else if ((!strcasecmp(s, "fb")) ||
1441 (!strcasecmp(s, "software-fb")) ||
1442 (!strcasecmp(s, "software_fb")))
1443 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB);
1444 else if ((!strcasecmp(s, "directfb")) ||
1445 (!strcasecmp(s, "dfb")))
1446 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_DIRECTFB);
1447 else if ((!strcasecmp(s, "sdl")) ||
1448 (!strcasecmp(s, "software-sdl")) ||
1449 (!strcasecmp(s, "software_sdl")))
1450 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_SDL);
1451 else if ((!strcasecmp(s, "sdl-16")) ||
1452 (!strcasecmp(s, "software-16-sdl")) ||
1453 (!strcasecmp(s, "software_16_sdl")))
1454 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_SDL);
1455 else if ((!strcasecmp(s, "opengl-sdl")) ||
1456 (!strcasecmp(s, "opengl_sdl")) ||
1457 (!strcasecmp(s, "gl-sdl")) ||
1458 (!strcasecmp(s, "gl_sdl")))
1459 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL);
1460 else if ((!strcasecmp(s, "gdi")) ||
1461 (!strcasecmp(s, "software-gdi")) ||
1462 (!strcasecmp(s, "software_gdi")))
1463 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_WIN32);
1464 else if ((!strcasecmp(s, "wince-gdi")) ||
1465 (!strcasecmp(s, "software-16-wince-gdi")) ||
1466 (!strcasecmp(s, "software_16_wince_gdi")))
1467 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_WINCE);
1468 else if (!strcasecmp(s, "buffer"))
1469 eina_stringshare_replace(&_elm_config->engine, ELM_BUFFER);
1470 else if ((!strncmp(s, "shot:", 5)))
1471 eina_stringshare_replace(&_elm_config->engine, s);
1474 s = getenv("ELM_VSYNC");
1475 if (s) _elm_config->vsync = !!atoi(s);
1477 s = getenv("ELM_THUMBSCROLL_ENABLE");
1478 if (s) _elm_config->thumbscroll_enable = !!atoi(s);
1479 s = getenv("ELM_THUMBSCROLL_THRESHOLD");
1480 if (s) _elm_config->thumbscroll_threshold = atoi(s);
1481 // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
1482 s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
1483 if (s) _elm_config->thumbscroll_momentum_threshold = atof(s);
1484 s = getenv("ELM_THUMBSCROLL_FRICTION");
1485 if (s) _elm_config->thumbscroll_friction = atof(s);
1486 s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
1487 if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
1488 s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
1489 if (s) _elm_config->thumbscroll_bounce_friction = atof(s);
1490 s = getenv("ELM_PAGE_SCROLL_FRICTION");
1491 if (s) _elm_config->page_scroll_friction = atof(s);
1492 s = getenv("ELM_BRING_IN_SCROLL_FRICTION");
1493 if (s) _elm_config->bring_in_scroll_friction = atof(s);
1494 s = getenv("ELM_ZOOM_FRICTION");
1495 if (s) _elm_config->zoom_friction = atof(s);
1496 s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
1506 _elm_config->thumbscroll_border_friction = friction;
1508 s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
1509 if (s) _elm_config->scroll_smooth_amount = atof(s);
1510 s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT");
1511 if (s) _elm_config->scroll_smooth_history_weight = atof(s);
1512 s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
1513 if (s) _elm_config->scroll_smooth_future_time = atof(s);
1514 s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
1515 if (s) _elm_config->scroll_smooth_time_window = atof(s);
1516 s = getenv("ELM_THEME");
1517 if (s) eina_stringshare_replace(&_elm_config->theme, s);
1519 s = getenv("ELM_FONT_HINTING");
1522 if (!strcasecmp(s, "none")) _elm_config->font_hinting = 0;
1523 else if (!strcasecmp(s, "auto"))
1524 _elm_config->font_hinting = 1;
1525 else if (!strcasecmp(s, "bytecode"))
1526 _elm_config->font_hinting = 2;
1529 s = getenv("ELM_FONT_PATH");
1535 EINA_LIST_FREE(_elm_config->font_dirs, p)
1537 eina_stringshare_del(p);
1540 buf2 = alloca(strlen(s) + 1);
1545 if ((*p == ':') || (*p == 0))
1550 strncpy(buf2, pp, len);
1552 _elm_config->font_dirs =
1553 eina_list_append(_elm_config->font_dirs,
1554 eina_stringshare_add(buf2));
1567 s = getenv("ELM_IMAGE_CACHE");
1568 if (s) _elm_config->image_cache = atoi(s);
1570 s = getenv("ELM_FONT_CACHE");
1571 if (s) _elm_config->font_cache = atoi(s);
1573 s = getenv("ELM_SCALE");
1574 if (s) _elm_config->scale = atof(s);
1576 _elm_config->finger_size =
1577 (double)_elm_config->finger_size * _elm_config->scale;
1578 s = getenv("ELM_FINGER_SIZE");
1579 if (s) _elm_config->finger_size = atoi(s);
1581 s = getenv("ELM_PASSWORD_SHOW_LAST");
1582 if (s) _elm_config->password_show_last = !!atoi(s);
1584 s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT");
1587 double pw_show_last_timeout = atof(s);
1588 if (pw_show_last_timeout >= 0.0)
1589 _elm_config->password_show_last_timeout = pw_show_last_timeout;
1592 s = getenv("ELM_FPS");
1593 if (s) _elm_config->fps = atof(s);
1594 if (_elm_config->fps < 1.0) _elm_config->fps = 1.0;
1596 s = getenv("ELM_MODULES");
1597 if (s) eina_stringshare_replace(&_elm_config->modules, s);
1599 /* Get RTL orientation from system */
1600 setlocale(LC_ALL, "");
1601 bindtextdomain(PACKAGE, LOCALE_DIR);
1602 _elm_config->is_mirrored = !strcmp(E_("default:LTR"), "default:RTL");
1604 s = getenv("ELM_TOOLTIP_DELAY");
1607 double delay = atof(s);
1609 _elm_config->tooltip_delay = delay;
1612 s = getenv("ELM_CURSOR_ENGINE_ONLY");
1613 if (s) _elm_config->cursor_engine_only = !!atoi(s);
1615 s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE");
1616 if (s) _elm_config->focus_highlight_enable = !!atoi(s);
1618 s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE");
1619 if (s) _elm_config->focus_highlight_animate = !!atoi(s);
1621 s = getenv("ELM_TOOLBAR_SHRINK_MODE");
1622 if (s) _elm_config->toolbar_shrink_mode = atoi(s);
1624 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE");
1625 if (s) _elm_config->fileselector_expand_enable = !!atoi(s);
1627 s = getenv("ELM_INWIN_DIALOGS_ENABLE");
1628 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s);
1630 s = getenv("ELM_ICON_SIZE");
1631 if (s) _elm_config->icon_size = atoi(s);
1633 s = getenv("ELM_LONGPRESS_TIMEOUT");
1634 if (s) _elm_config->longpress_timeout = atof(s);
1635 if (_elm_config->longpress_timeout < 0.0)
1636 _elm_config->longpress_timeout = 0.0;
1638 s = getenv("ELM_EFFECT_ENABLE");
1639 if (s) _elm_config->effect_enable = !!atoi(s);
1641 s = getenv("ELM_DESKTOP_ENTRY");
1642 if (s) _elm_config->desktop_entry = !!atoi(s);
1643 s = getenv("ELM_ACCESS_MODE");
1644 if (s) _elm_config->access_mode = ELM_ACCESS_MODE_ON;
1648 elm_mirrored_get(void)
1650 return _elm_config->is_mirrored;
1654 elm_mirrored_set(Eina_Bool mirrored)
1656 _elm_config->is_mirrored = mirrored;
1664 const char *cur_dom = textdomain(NULL);
1665 const char *trans_comment = gettext("");
1666 const char *msg_locale = setlocale(LC_MESSAGES, NULL);
1668 /* Same concept as what glib does:
1669 * We shouldn't translate if there are no translations for the
1670 * application in the current locale + domain. (Unless locale is
1671 * en_/C where translating only parts of the interface make some
1674 _elm_config->translate = !(strcmp (cur_dom, "messages") &&
1675 !*trans_comment && strncmp (msg_locale, "en_", 3) &&
1676 strcmp (msg_locale, "C"));
1681 _elm_config_init(void)
1684 _profile_fetch_from_conf();
1686 _translation_init();
1689 _elm_config_font_overlay_apply();
1694 _elm_config_sub_init(void)
1696 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1697 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1698 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
1699 ENGINE_COMPARE(ELM_XRENDER_X11) ||
1700 ENGINE_COMPARE(ELM_OPENGL_X11))
1701 #undef ENGINE_COMPARE
1703 #ifdef HAVE_ELEMENTARY_X
1704 unsigned int val = 1000;
1706 if (!ecore_x_init(NULL))
1708 ERR("Cannot connect to X11 display. check $DISPLAY variable");
1711 _root_1st = ecore_x_window_root_first_get();
1713 if (!ecore_x_screen_is_composited(0))
1714 _elm_config->compositing = 0;
1716 ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
1717 ecore_x_event_mask_set(_root_1st,
1718 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1719 _prop_change_handler = ecore_event_handler_add
1720 (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
1721 if (!getenv("ELM_SCALE"))
1723 if (ecore_x_window_prop_card32_get(_root_1st,
1724 _atom[ATOM_E_SCALE],
1729 _elm_config->scale = (double)val / 1000.0;
1730 // FIXME: hack until e export finger size too
1731 if (!getenv("ELM_FINGER_SIZE"))
1733 _elm_config->finger_size = 40.0 * _elm_config->scale;
1735 edje_scale_set(_elm_config->scale);
1739 if (!getenv("ELM_FINGER_SIZE"))
1741 if (ecore_x_window_prop_card32_get(_root_1st,
1742 _atom[ATOM_E_FINGER_SIZE],
1747 _elm_config->finger_size = val;
1751 if (!getenv("ELM_THEME"))
1755 s = ecore_x_window_prop_string_get(_root_1st,
1756 _atom[ATOM_E_THEME]);
1759 eina_stringshare_replace(&_elm_config->theme, s);
1760 _elm_theme_parse(NULL, s);
1764 if (!getenv("ELM_PROFILE"))
1768 s = ecore_x_window_prop_string_get(_root_1st,
1769 _atom[ATOM_E_PROFILE]);
1776 if (strcmp(_elm_profile, s)) changed = 1;
1780 if (changed) _prop_config_get();
1785 _config_sub_apply();
1789 _elm_config_reload(void)
1794 _elm_config_font_overlay_apply();
1800 _elm_config_engine_set(const char *engine)
1802 if (_elm_config->engine && strcmp(_elm_config->engine, engine))
1803 eina_stringshare_del(_elm_config->engine);
1805 _elm_config->engine = eina_stringshare_add(engine);
1809 _elm_config_profile_set(const char *profile)
1811 Eina_Bool changed = EINA_FALSE;
1815 if (strcmp(_elm_profile, profile))
1820 _elm_profile = strdup(profile);
1827 _elm_config_font_overlay_apply();
1834 _elm_config_shutdown(void)
1836 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1837 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1838 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
1839 ENGINE_COMPARE(ELM_XRENDER_X11) ||
1840 ENGINE_COMPARE(ELM_OPENGL_X11))
1841 #undef ENGINE_COMPARE
1843 #ifdef HAVE_ELEMENTARY_X
1844 ecore_event_handler_del(_prop_change_handler);
1845 _prop_change_handler = NULL;
1852 _elm_profile = NULL;