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",
40 /* whenever you want to add a new text class support into Elementary,
41 declare it both here and in the (default) theme */
42 static const Elm_Text_Class _elm_text_classes[] = {
43 {"button", "Button Labels"},
44 {"label", "Text Labels"},
45 {"entry", "Text Entries"},
46 {"title_bar", "Title Bar"},
47 {"list_item", "List Items"},
48 {"grid_item", "Grid Items"},
49 {"toolbar_item", "Toolbar Items"},
50 {"menu_item", "Menu Items"},
54 static void _desc_init(void);
55 static void _desc_shutdown(void);
56 static void _profile_fetch_from_conf(void);
57 static void _config_free(void);
58 static void _config_apply(void);
59 static Elm_Config *_config_user_load(void);
60 static Elm_Config *_config_system_load(void);
61 static void _config_load(void);
62 static void _config_update(void);
63 static void _env_get(void);
64 static size_t _elm_data_dir_snprintf(char *dst,
68 static size_t _elm_user_dir_snprintf(char *dst,
73 #define ELM_CONFIG_VAL(edd, type, member, dtype) \
74 EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
75 #define ELM_CONFIG_LIST(edd, type, member, eddtype) \
76 EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype)
78 #ifdef HAVE_ELEMENTARY_X
79 static Ecore_Event_Handler *_prop_change_handler = NULL;
80 static Ecore_X_Window _root_1st = 0;
82 static Ecore_X_Atom _atom[ATOM_COUNT];
83 static Ecore_X_Atom _atom_config = 0;
84 static const char *_atom_names[ATOM_COUNT] =
86 "ENLIGHTENMENT_SCALE",
87 "ENLIGHTENMENT_FINGER_SIZE",
88 "ENLIGHTENMENT_THEME",
89 "ENLIGHTENMENT_PROFILE",
90 "ENLIGHTENMENT_FONT_OVERLAY",
91 "ENLIGHTENMENT_CACHE_FLUSH_INTERVAL",
92 "ENLIGHTENMENT_CACHE_FLUSH_ENABLE",
93 "ENLIGHTENMENT_FONT_CACHE",
94 "ENLIGHTENMENT_IMAGE_CACHE",
95 "ENLIGHTENMENT_EDJE_FILE_CACHE",
96 "ENLIGHTENMENT_EDJE_COLLECTION_CACHE",
97 "ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE",
98 "ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION",
99 "ENLIGHTENMENT_THUMBSCROLL_ENABLE",
100 "ENLIGHTENMENT_THUMBSCROLL_THRESHOLD",
101 "ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD",
102 "ENLIGHTENMENT_THUMBSCROLL_FRICTION",
103 "ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION",
104 "ENLIGHTENMENT_THUMBSCROLL_SENSITIVITY_FRICTION",
105 "ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION",
106 "ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION",
107 "ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION",
108 "ENLIGHTENMENT_CONFIG"
110 #define ATOM_E_SCALE 0
111 #define ATOM_E_FINGER_SIZE 1
112 #define ATOM_E_THEME 2
113 #define ATOM_E_PROFILE 3
114 #define ATOM_E_FONT_OVERLAY 4
115 #define ATOM_E_CACHE_FLUSH_INTERVAL 5
116 #define ATOM_E_CACHE_FLUSH_ENABLE 6
117 #define ATOM_E_FONT_CACHE 7
118 #define ATOM_E_IMAGE_CACHE 8
119 #define ATOM_E_EDJE_FILE_CACHE 9
120 #define ATOM_E_EDJE_COLLECTION_CACHE 10
121 #define ATOM_E_THUMBSCROLL_BOUNCE_ENABLE 11
122 #define ATOM_E_THUMBSCROLL_BOUNCE_FRICTION 12
123 #define ATOM_E_THUMBSCROLL_ENABLE 13
124 #define ATOM_E_THUMBSCROLL_THRESHOLD 14
125 #define ATOM_E_THUMBSCROLL_MOMENTUM_THRESHOLD 15
126 #define ATOM_E_THUMBSCROLL_FRICTION 16
127 #define ATOM_E_THUMBSCROLL_BORDER_FRICTION 17
128 #define ATOM_E_THUMBSCROLL_SENSITIVITY_FRICTION 18
129 #define ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION 19
130 #define ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION 20
131 #define ATOM_E_THUMBSCROLL_ZOOM_FRICTION 21
132 #define ATOM_E_CONFIG 22
134 static Eina_Bool _prop_config_get(void);
135 static Eina_Bool _prop_change(void *data __UNUSED__,
136 int ev_type __UNUSED__,
140 _prop_config_get(void)
145 unsigned char *data = NULL;
146 Elm_Config *config_data;
148 snprintf(buf, sizeof(buf), "ENLIGHTENMENT_CONFIG_%s", _elm_profile);
149 atom = ecore_x_atom_get(buf);
151 if (!ecore_x_window_prop_property_get(_root_1st,
152 atom, _atom[ATOM_E_CONFIG],
155 if (!ecore_x_window_prop_property_get(_root_1st,
156 _atom[ATOM_E_CONFIG],
157 _atom[ATOM_E_CONFIG],
161 _atom_config = _atom[ATOM_E_CONFIG];
170 config_data = eet_data_descriptor_decode(_config_edd, data, size);
172 if (!config_data) return EINA_FALSE;
174 /* What do we do on version mismatch when someone changes the
175 * config in the rootwindow? */
176 /* Most obvious case, new version and we are still linked to
177 * whatever was there before, we just ignore until user restarts us */
178 if (config_data->config_version > ELM_CONFIG_VERSION)
180 /* What in the case the version is older? Do we even support those
181 * cases or we only check for equality above? */
184 _elm_config = config_data;
186 _elm_config_font_overlay_apply();
193 _prop_change(void *data __UNUSED__,
194 int ev_type __UNUSED__,
197 Ecore_X_Event_Window_Property *event = ev;
199 if (event->win == _root_1st)
201 if (event->atom == _atom[ATOM_E_SCALE])
203 unsigned int val = 1000;
205 if (ecore_x_window_prop_card32_get(event->win,
211 pscale = _elm_config->scale;
212 if (val > 0) _elm_config->scale = (double)val / 1000.0;
213 if (pscale != _elm_config->scale)
220 else if (event->atom == _atom[ATOM_E_FINGER_SIZE])
222 unsigned int val = 1000;
224 if (ecore_x_window_prop_card32_get(event->win,
230 pfinger_size = _elm_config->finger_size;
231 _elm_config->finger_size = val;
232 if (pfinger_size != _elm_config->finger_size)
239 else if (event->atom == _atom[ATOM_E_THEME])
243 val = ecore_x_window_prop_string_get(event->win,
245 eina_stringshare_replace(&_elm_config->theme, val);
248 _elm_theme_parse(NULL, val);
254 else if (event->atom == _atom[ATOM_E_PROFILE])
258 val = ecore_x_window_prop_string_get(event->win,
266 if (strcmp(_elm_profile, val)) changed = 1;
272 if (!_prop_config_get())
277 _elm_config_font_overlay_apply();
283 else if (event->atom == _atom[ATOM_E_FONT_OVERLAY])
285 unsigned int val = 1000;
287 if (ecore_x_window_prop_card32_get(event->win,
294 _elm_config_font_overlay_apply();
298 else if (event->atom == _atom[ATOM_E_CACHE_FLUSH_INTERVAL])
300 unsigned int val = 1000;
302 if (ecore_x_window_prop_card32_get(event->win,
306 int cache_flush_interval;
308 cache_flush_interval = _elm_config->cache_flush_poll_interval;
309 _elm_config->cache_flush_poll_interval = val;
310 if (cache_flush_interval !=
311 _elm_config->cache_flush_poll_interval)
315 else if (event->atom == _atom[ATOM_E_CACHE_FLUSH_ENABLE])
317 unsigned int val = 1000;
319 if (ecore_x_window_prop_card32_get(event->win,
323 _elm_config->cache_flush_enable = !!val;
327 else if (event->atom == _atom[ATOM_E_FONT_CACHE])
329 unsigned int val = 1000;
331 if (ecore_x_window_prop_card32_get(event->win,
337 font_cache = _elm_config->font_cache;
338 _elm_config->font_cache = val;
339 if (font_cache != _elm_config->font_cache)
343 else if (event->atom == _atom[ATOM_E_IMAGE_CACHE])
345 unsigned int val = 1000;
347 if (ecore_x_window_prop_card32_get(event->win,
353 image_cache = _elm_config->image_cache;
354 _elm_config->image_cache = val;
355 if (image_cache != _elm_config->image_cache)
359 else if (event->atom == _atom[ATOM_E_EDJE_FILE_CACHE])
361 unsigned int val = 1000;
363 if (ecore_x_window_prop_card32_get(event->win,
369 edje_file_cache = _elm_config->edje_cache;
370 _elm_config->edje_cache = val;
371 if (edje_file_cache != _elm_config->edje_cache)
375 else if (event->atom == _atom[ATOM_E_EDJE_COLLECTION_CACHE])
377 unsigned int val = 1000;
379 if (ecore_x_window_prop_card32_get(event->win,
383 int edje_collection_cache;
385 edje_collection_cache = _elm_config->edje_collection_cache;
386 _elm_config->edje_collection_cache = val;
387 if (edje_collection_cache !=
388 _elm_config->edje_collection_cache)
392 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BOUNCE_ENABLE])
394 unsigned int val = 1000;
396 if (ecore_x_window_prop_card32_get(event->win,
400 _elm_config->thumbscroll_bounce_enable = !!val;
403 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BOUNCE_FRICTION])
405 unsigned int val = 1000;
407 if (ecore_x_window_prop_card32_get(event->win,
412 _elm_config->thumbscroll_bounce_friction =
413 (double)val / 1000.0;
416 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_ENABLE])
418 unsigned int val = 1000;
420 if (ecore_x_window_prop_card32_get(event->win,
424 _elm_config->thumbscroll_enable = !!val;
427 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_THRESHOLD])
429 unsigned int val = 1000;
431 if (ecore_x_window_prop_card32_get(event->win,
435 if (val > 0) _elm_config->thumbscroll_threshold = val;
438 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_MOMENTUM_THRESHOLD])
440 unsigned int val = 1000;
442 if (ecore_x_window_prop_card32_get(event->win,
446 _elm_config->thumbscroll_momentum_threshold =
447 (double)val / 1000.0;
450 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_FRICTION])
452 unsigned int val = 1000;
454 if (ecore_x_window_prop_card32_get(event->win,
458 _elm_config->thumbscroll_friction = (double)val / 1000.0;
461 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BORDER_FRICTION])
463 unsigned int val = 1000;
465 if (ecore_x_window_prop_card32_get(event->win,
469 _elm_config->thumbscroll_border_friction =
470 (double)val / 1000.0;
473 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_SENSITIVITY_FRICTION])
475 unsigned int val = 1000;
477 if (ecore_x_window_prop_card32_get(event->win,
481 _elm_config->thumbscroll_sensitivity_friction =
482 (double)val / 1000.0;
485 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION])
487 unsigned int val = 1000;
489 if (ecore_x_window_prop_card32_get(event->win,
493 _elm_config->page_scroll_friction =
494 (double)val / 1000.0;
497 else if (event->atom ==
498 _atom[ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION])
500 unsigned int val = 1000;
502 if (ecore_x_window_prop_card32_get(event->win,
506 _elm_config->bring_in_scroll_friction =
507 (double)val / 1000.0;
510 else if (event->atom ==
511 _atom[ATOM_E_THUMBSCROLL_ZOOM_FRICTION])
513 unsigned int val = 1000;
515 if (ecore_x_window_prop_card32_get(event->win,
519 _elm_config->zoom_friction = (double)val / 1000.0;
522 else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
523 (event->atom == _atom[ATOM_E_CONFIG]))
528 return ECORE_CALLBACK_PASS_ON;
536 Eet_Data_Descriptor_Class eddc;
538 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config);
539 eddc.func.str_direct_alloc = NULL;
540 eddc.func.str_direct_free = NULL;
542 _config_edd = eet_data_descriptor_file_new(&eddc);
545 printf("EEEK! eet_data_descriptor_file_new() failed\n");
549 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
550 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Font_Overlay);
551 eddc.func.str_direct_alloc = NULL;
552 eddc.func.str_direct_free = NULL;
554 _config_font_overlay_edd = eet_data_descriptor_stream_new(&eddc);
555 if (!_config_font_overlay_edd)
557 printf("EEEK! eet_data_descriptor_stream_new() failed\n");
558 eet_data_descriptor_free(_config_edd);
561 #define T_INT EET_T_INT
562 #define T_DOUBLE EET_T_DOUBLE
563 #define T_STRING EET_T_STRING
564 #define T_UCHAR EET_T_UCHAR
566 #define T Elm_Font_Overlay
567 #define D _config_font_overlay_edd
568 ELM_CONFIG_VAL(D, T, text_class, EET_T_STRING);
569 ELM_CONFIG_VAL(D, T, font, EET_T_STRING);
570 ELM_CONFIG_VAL(D, T, size, EET_T_INT);
575 #define D _config_edd
576 ELM_CONFIG_VAL(D, T, config_version, T_INT);
577 ELM_CONFIG_VAL(D, T, engine, T_STRING);
578 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
579 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
580 ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
581 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
582 ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
583 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
584 ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
585 ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
586 ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
587 ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
588 ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
589 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
590 ELM_CONFIG_VAL(D, T, scroll_smooth_time_interval, T_DOUBLE);
591 ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
592 ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
593 ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE);
594 ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
595 ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
596 ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
597 ELM_CONFIG_VAL(D, T, compositing, T_INT);
598 /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
599 ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd);
600 ELM_CONFIG_VAL(D, T, font_hinting, T_INT);
601 ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT);
602 ELM_CONFIG_VAL(D, T, cache_flush_enable, T_UCHAR);
603 ELM_CONFIG_VAL(D, T, image_cache, T_INT);
604 ELM_CONFIG_VAL(D, T, font_cache, T_INT);
605 ELM_CONFIG_VAL(D, T, edje_cache, T_INT);
606 ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT);
607 ELM_CONFIG_VAL(D, T, finger_size, T_INT);
608 ELM_CONFIG_VAL(D, T, fps, T_DOUBLE);
609 ELM_CONFIG_VAL(D, T, theme, T_STRING);
610 ELM_CONFIG_VAL(D, T, modules, T_STRING);
611 ELM_CONFIG_VAL(D, T, tooltip_delay, T_DOUBLE);
612 ELM_CONFIG_VAL(D, T, cursor_engine_only, T_UCHAR);
613 ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR);
614 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
615 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
616 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
617 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR);
618 ELM_CONFIG_VAL(D, T, icon_size, T_INT);
619 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
620 ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR);
621 ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR);
622 ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR);
623 ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE);
624 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_enable, T_UCHAR);
625 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_factor, T_DOUBLE);
626 ELM_CONFIG_VAL(D, T, glayer_zoom_wheel_factor, T_DOUBLE);
627 ELM_CONFIG_VAL(D, T, glayer_zoom_distance_tolerance, T_DOUBLE);
628 ELM_CONFIG_VAL(D, T, glayer_rotate_finger_enable, T_UCHAR);
629 ELM_CONFIG_VAL(D, T, glayer_rotate_angular_tolerance, T_DOUBLE);
630 ELM_CONFIG_VAL(D, T, glayer_line_min_length, T_DOUBLE);
631 ELM_CONFIG_VAL(D, T, glayer_line_distance_tolerance, T_DOUBLE);
632 ELM_CONFIG_VAL(D, T, glayer_line_angular_tolerance, T_DOUBLE);
633 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
634 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
635 ELM_CONFIG_VAL(D, T, access_mode, T_INT);
636 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
650 eet_data_descriptor_free(_config_edd);
654 if (_config_font_overlay_edd)
656 eet_data_descriptor_free(_config_font_overlay_edd);
657 _config_font_overlay_edd = NULL;
662 _sort_files_cb(const void *f1,
665 return strcmp(f1, f2);
669 _elm_config_current_profile_get(void)
675 _elm_data_dir_snprintf(char *dst,
680 size_t data_dir_len, off;
683 data_dir_len = eina_strlcpy(dst, _elm_data_dir, size);
685 off = data_dir_len + 1;
690 dst[data_dir_len] = '/';
692 off = off + vsnprintf(dst + off, size - off, fmt, ap);
700 _elm_user_dir_snprintf(char *dst,
706 size_t user_dir_len, off;
710 home = evil_homedir_get();
712 home = getenv("HOME");
717 user_dir_len = eina_str_join_len(dst, size, '/', home, strlen(home),
718 ".elementary", sizeof(".elementary") - 1);
720 off = user_dir_len + 1;
725 dst[user_dir_len] = '/';
727 off = off + vsnprintf(dst + off, size - off, fmt, ap);
735 _elm_config_profile_dir_get(const char *prof,
743 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof);
745 if (ecore_file_is_dir(buf))
751 snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof);
753 if (ecore_file_is_dir(buf))
760 _elm_config_font_overlays_list(void)
762 return _elm_config->font_overlays;
766 _elm_config_font_overlay_set(const char *text_class,
770 Elm_Font_Overlay *efd;
773 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
775 if (strcmp(efd->text_class, text_class))
778 if (efd->font) eina_stringshare_del(efd->font);
779 efd->font = eina_stringshare_add(font);
781 _elm_config->font_overlays =
782 eina_list_promote_list(_elm_config->font_overlays, l);
786 /* the text class doesn't exist */
787 efd = calloc(1, sizeof(Elm_Font_Overlay));
788 efd->text_class = eina_stringshare_add(text_class);
789 efd->font = eina_stringshare_add(font);
792 _elm_config->font_overlays = eina_list_prepend(_elm_config->font_overlays,
797 _elm_config_font_overlay_remove(const char *text_class)
799 Elm_Font_Overlay *efd;
802 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
804 if (strcmp(efd->text_class, text_class))
807 _elm_config->font_overlays =
808 eina_list_remove_list(_elm_config->font_overlays, l);
809 if (efd->text_class) eina_stringshare_del(efd->text_class);
810 if (efd->font) eina_stringshare_del(efd->font);
818 _elm_config_font_overlay_apply(void)
820 Elm_Font_Overlay *efd;
824 for (i = 0; _elm_text_classes[i].desc; i++)
825 edje_text_class_del(_elm_text_classes[i].name);
827 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
828 edje_text_class_set(efd->text_class, efd->font, efd->size);
832 _elm_config_text_classes_get(void)
834 Eina_List *ret = NULL;
837 for (i = 0; _elm_text_classes[i].desc; i++)
840 tc = malloc(sizeof(*tc));
842 *tc = _elm_text_classes[i];
844 ret = eina_list_append(ret, tc);
851 _elm_config_text_classes_free(Eina_List *l)
855 EINA_LIST_FREE(l, tc)
860 _elm_config_profiles_list(void)
862 const Eina_File_Direct_Info *info;
863 Eina_List *flist = NULL;
864 Eina_Iterator *file_it;
869 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config");
871 file_it = eina_file_direct_ls(buf);
878 len = sizeof(buf) - len;
880 EINA_ITERATOR_FOREACH(file_it, info)
882 if (info->name_length >= len)
885 if (info->type == EINA_FILE_DIR)
888 eina_list_sorted_insert(flist, _sort_files_cb,
889 eina_stringshare_add(info->path +
894 eina_iterator_free(file_it);
897 len = eina_str_join_len(buf, sizeof(buf), '/', _elm_data_dir,
898 strlen(_elm_data_dir), "config",
899 sizeof("config") - 1);
901 file_it = eina_file_direct_ls(buf);
908 len = sizeof(buf) - len;
909 EINA_ITERATOR_FOREACH(file_it, info)
911 if (info->name_length >= len)
921 EINA_LIST_FOREACH(flist, l, tmp)
922 if (!strcmp(info->path + info->name_start, tmp))
927 eina_list_sorted_insert(flist, _sort_files_cb,
928 eina_stringshare_add(info->path +
937 eina_iterator_free(file_it);
941 EINA_LIST_FREE(flist, dir)
942 eina_stringshare_del(dir);
948 _profile_fetch_from_conf(void)
950 char buf[PATH_MAX], *p, *s;
954 _elm_profile = strdup("default");
956 // if env var - use profile without question
957 s = getenv("ELM_PROFILE");
961 _elm_profile = strdup(s);
966 _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
967 ef = eet_open(buf, EET_FILE_MODE_READ);
970 p = eet_read(ef, "config", &len);
974 _elm_profile = malloc(len + 1);
975 memcpy(_elm_profile, p, len);
976 _elm_profile[len] = 0;
985 _elm_data_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
986 ef = eet_open(buf, EET_FILE_MODE_READ);
989 p = eet_read(ef, "config", &len);
993 _elm_profile = malloc(len + 1);
994 memcpy(_elm_profile, p, len);
995 _elm_profile[len] = 0;
1005 Elm_Font_Overlay *fo;
1006 const char *fontdir;
1008 if (!_elm_config) return;
1009 EINA_LIST_FREE(_elm_config->font_dirs, fontdir)
1011 eina_stringshare_del(fontdir);
1013 if (_elm_config->engine) eina_stringshare_del(_elm_config->engine);
1014 EINA_LIST_FREE(_elm_config->font_overlays, fo)
1016 if (fo->text_class) eina_stringshare_del(fo->text_class);
1017 if (fo->font) eina_stringshare_del(fo->font);
1020 if (_elm_config->theme) eina_stringshare_del(_elm_config->theme);
1021 if (_elm_config->modules) eina_stringshare_del(_elm_config->modules);
1029 _elm_theme_parse(NULL, _elm_config->theme);
1030 ecore_animator_frametime_set(1.0 / _elm_config->fps);
1034 _config_sub_apply(void)
1036 edje_frametime_set(1.0 / _elm_config->fps);
1037 edje_scale_set(_elm_config->scale);
1038 edje_password_show_last_set(_elm_config->password_show_last);
1039 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1040 if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
1044 _elm_cache_flush_cb(void *data __UNUSED__)
1047 return ECORE_CALLBACK_RENEW;
1050 /* kind of abusing this call right now -- shared between all of those
1051 * properties -- but they are not meant to be called that periodically
1061 EINA_LIST_FOREACH(_elm_win_list, l, win)
1063 Evas *e = evas_object_evas_get(win);
1064 evas_image_cache_set(e, _elm_config->image_cache * 1024);
1065 evas_font_cache_set(e, _elm_config->font_cache * 1024);
1067 edje_file_cache_set(_elm_config->edje_cache);
1068 edje_collection_cache_set(_elm_config->edje_collection_cache);
1070 if (_elm_cache_flush_poller)
1072 ecore_poller_del(_elm_cache_flush_poller);
1073 _elm_cache_flush_poller = NULL;
1075 if (_elm_config->cache_flush_enable)
1077 if (_elm_config->cache_flush_poll_interval > 0)
1079 _elm_cache_flush_poller =
1080 ecore_poller_add(ECORE_POLLER_CORE,
1081 _elm_config->cache_flush_poll_interval,
1082 _elm_cache_flush_cb, NULL);
1088 _config_user_load(void)
1090 Elm_Config *cfg = NULL;
1094 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
1097 ef = eet_open(buf, EET_FILE_MODE_READ);
1100 cfg = eet_data_read(ef, _config_edd, "config");
1107 _config_system_load(void)
1109 Elm_Config *cfg = NULL;
1113 _elm_data_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
1116 ef = eet_open(buf, EET_FILE_MODE_READ);
1119 cfg = eet_data_read(ef, _config_edd, "config");
1128 _elm_config = _config_user_load();
1131 if (_elm_config->config_version < ELM_CONFIG_VERSION)
1136 /* no user config, fallback for system. No need to check version for
1137 * this one, if it's not the right one, someone screwed up at the time
1138 * of installing it */
1139 _elm_config = _config_system_load();
1140 if (_elm_config) return;
1141 /* FIXME: config load could have failed because of a non-existent
1142 * profile. Fallback to default before moving on */
1144 // config load fail - defaults
1145 /* XXX: do these make sense? Only if it's valid to install the lib
1146 * without the config, but do we want that? */
1147 _elm_config = ELM_NEW(Elm_Config);
1148 _elm_config->config_version = ELM_CONFIG_VERSION;
1149 _elm_config->engine = eina_stringshare_add("software_x11");
1150 _elm_config->vsync = 0;
1151 _elm_config->thumbscroll_enable = EINA_TRUE;
1152 _elm_config->thumbscroll_threshold = 24;
1153 _elm_config->thumbscroll_momentum_threshold = 100.0;
1154 _elm_config->thumbscroll_friction = 1.0;
1155 _elm_config->thumbscroll_bounce_friction = 0.5;
1156 _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
1157 _elm_config->page_scroll_friction = 0.5;
1158 _elm_config->bring_in_scroll_friction = 0.5;
1159 _elm_config->zoom_friction = 0.5;
1160 _elm_config->thumbscroll_border_friction = 0.5;
1161 _elm_config->thumbscroll_sensitivity_friction = 0.25; // magic number! just trial and error shows this makes it behave "nicer" and not run off at high speed all the time
1162 _elm_config->scroll_smooth_time_interval = 0.008;
1163 _elm_config->scroll_smooth_amount = 1.0;
1164 _elm_config->scroll_smooth_history_weight = 0.3;
1165 _elm_config->scroll_smooth_future_time = 0.0;
1166 _elm_config->scroll_smooth_time_window = 0.2;
1167 _elm_config->scale = 1.0;
1168 _elm_config->bgpixmap = 0;
1169 _elm_config->compositing = 1;
1170 _elm_config->font_hinting = 2;
1171 _elm_config->cache_flush_poll_interval = 512;
1172 _elm_config->cache_flush_enable = EINA_TRUE;
1173 _elm_config->font_dirs = NULL;
1174 _elm_config->image_cache = 4096;
1175 _elm_config->font_cache = 512;
1176 _elm_config->edje_cache = 32;
1177 _elm_config->edje_collection_cache = 64;
1178 _elm_config->finger_size = 40;
1179 _elm_config->fps = 60.0;
1180 _elm_config->theme = eina_stringshare_add("default");
1181 _elm_config->modules = NULL;
1182 _elm_config->tooltip_delay = 1.0;
1183 _elm_config->cursor_engine_only = EINA_TRUE;
1184 _elm_config->focus_highlight_enable = EINA_FALSE;
1185 _elm_config->focus_highlight_animate = EINA_TRUE;
1186 _elm_config->toolbar_shrink_mode = 2;
1187 _elm_config->fileselector_expand_enable = EINA_FALSE;
1188 _elm_config->inwin_dialogs_enable = EINA_FALSE;
1189 _elm_config->icon_size = 32;
1190 _elm_config->longpress_timeout = 1.0;
1191 _elm_config->effect_enable = EINA_TRUE;
1192 _elm_config->desktop_entry = EINA_FALSE;
1193 _elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
1194 _elm_config->password_show_last = EINA_FALSE;
1195 _elm_config->password_show_last_timeout = 2.0;
1196 _elm_config->glayer_zoom_finger_enable = EINA_FALSE;
1197 _elm_config->glayer_zoom_finger_factor = 1.0;
1198 _elm_config->glayer_zoom_wheel_factor = 0.05;
1199 _elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_finger_size_get() */
1200 _elm_config->glayer_rotate_finger_enable = EINA_FALSE;
1201 _elm_config->glayer_rotate_angular_tolerance = 0.034906585; /* Represents 2 DEG */
1202 _elm_config->glayer_line_min_length = 1.0; /* 1 times elm_finger_size_get() */
1203 _elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_finger_size_get() */
1204 _elm_config->glayer_line_angular_tolerance = 0.34906585; /* Represents 20 DEG */
1205 _elm_config->glayer_flick_time_limit_ms = 60; /* 60 ms to finish flick */
1206 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
1207 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
1211 _elm_config_eet_close_error_get(Eet_File *ef,
1215 const char *erstr = NULL;
1217 err = eet_close(ef);
1220 case EET_ERROR_WRITE_ERROR:
1221 erstr = "An error occurred while saving Elementary's "
1222 "settings to disk. The error could not be "
1223 "deterimined. The file where the error occurred was: "
1224 "%s. This file has been deleted to avoid corrupt data.";
1227 case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG:
1228 erstr = "Elementary's settings files are too big "
1229 "for the file system they are being saved to. "
1230 "This error is very strange as the files should "
1231 "be extremely small. Please check the settings "
1232 "for your home directory. "
1233 "The file where the error occurred was: %s ."
1234 "This file has been deleted to avoid corrupt data.";
1237 case EET_ERROR_WRITE_ERROR_IO_ERROR:
1238 erstr = "An output error occurred when writing the settings "
1239 "files for Elementary. Your disk is having troubles "
1240 "and possibly needs replacement. "
1241 "The file where the error occurred was: %s ."
1242 "This file has been deleted to avoid corrupt data.";
1245 case EET_ERROR_WRITE_ERROR_OUT_OF_SPACE:
1246 erstr = "Elementary cannot write its settings file "
1247 "because it ran out of space to write the file. "
1248 "You have either run out of disk space or have "
1249 "gone over your quota limit. "
1250 "The file where the error occurred was: %s ."
1251 "This file has been deleted to avoid corrupt data.";
1254 case EET_ERROR_WRITE_ERROR_FILE_CLOSED:
1255 erstr = "Elementary unexpectedly had the settings file "
1256 "it was writing closed on it. This is very unusual. "
1257 "The file where the error occurred was: %s "
1258 "This file has been deleted to avoid corrupt data.";
1266 /* delete any partially-written file */
1267 ecore_file_unlink(file);
1268 return strdup(erstr);
1275 _elm_config_profile_save(void)
1277 char buf[4096], buf2[4096];
1283 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
1284 if (len + 1 >= sizeof(buf))
1287 len = _elm_user_dir_snprintf(buf2, sizeof(buf2), "config/profile.cfg.tmp");
1288 if (len + 1 >= sizeof(buf2))
1291 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1295 ok = eet_write(ef, "config", _elm_profile, strlen(_elm_profile), 0);
1299 err = _elm_config_eet_close_error_get(ef, buf2);
1307 ret = ecore_file_mv(buf2, buf);
1310 ERR("Error saving Elementary's configuration file");
1314 ecore_file_unlink(buf2);
1318 ecore_file_unlink(buf2);
1323 _elm_config_save(void)
1325 char buf[4096], buf2[4096];
1331 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", _elm_profile);
1332 if (len + 1 >= sizeof(buf))
1335 ok = ecore_file_mkpath(buf);
1338 ERR("Problem acessing Elementary's user configuration directory: %s",
1343 if (!_elm_config_profile_save())
1349 if (len + sizeof("base.cfg") >= sizeof(buf) - len)
1352 memcpy(buf + len, "base.cfg", sizeof("base.cfg"));
1353 len += sizeof("base.cfg") - 1;
1355 if (len + sizeof(".tmp") >= sizeof(buf))
1358 memcpy(buf2, buf, len);
1359 memcpy(buf2 + len, ".tmp", sizeof(".tmp"));
1361 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1365 ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1);
1369 err = _elm_config_eet_close_error_get(ef, buf2);
1377 ret = ecore_file_mv(buf2, buf);
1380 ERR("Error saving Elementary's configuration file");
1384 ecore_file_unlink(buf2);
1388 ecore_file_unlink(buf2);
1393 _config_update(void)
1397 tcfg = _config_system_load();
1400 /* weird profile or something? We should probably fill
1401 * with hardcoded defaults, or get from default previx */
1404 #define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) {
1405 #define IFCFGELSE } else {
1407 #define COPYVAL(x) do {_elm_config->x = tcfg->x; } while(0)
1408 #define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while(0)
1409 #define COPYSTR(x) COPYPTR(x)
1411 /* we also need to update for property changes in the root window
1412 * if needed, but that will be dependent on new properties added
1413 * with each version */
1416 COPYVAL(longpress_timeout);
1426 /* after updating user config, we must save */
1435 s = getenv("ELM_ENGINE");
1438 if ((!strcasecmp(s, "x11")) ||
1439 (!strcasecmp(s, "x")) ||
1440 (!strcasecmp(s, "software-x11")) ||
1441 (!strcasecmp(s, "software_x11")))
1442 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_X11);
1443 else if ((!strcasecmp(s, "opengl")) ||
1444 (!strcasecmp(s, "gl")) ||
1445 (!strcasecmp(s, "opengl-x11")) ||
1446 (!strcasecmp(s, "opengl_x11")))
1447 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_X11);
1448 else if ((!strcasecmp(s, "x11-8")) ||
1449 (!strcasecmp(s, "x8")) ||
1450 (!strcasecmp(s, "software-8-x11")) ||
1451 (!strcasecmp(s, "software_8_x11")))
1452 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_8_X11);
1453 else if ((!strcasecmp(s, "x11-16")) ||
1454 (!strcasecmp(s, "x16")) ||
1455 (!strcasecmp(s, "software-16-x11")) ||
1456 (!strcasecmp(s, "software_16_x11")))
1457 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_X11);
1459 else if ((!strcasecmp(s, "xrender")) ||
1460 (!strcasecmp(s, "xr")) ||
1461 (!strcasecmp(s, "xrender-x11")) ||
1462 (!strcasecmp(s, "xrender_x11")))
1463 eina_stringshare_replace(&_elm_config->engine, ELM_XRENDER_X11);
1465 else if ((!strcasecmp(s, "fb")) ||
1466 (!strcasecmp(s, "software-fb")) ||
1467 (!strcasecmp(s, "software_fb")))
1468 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB);
1469 else if ((!strcasecmp(s, "directfb")) ||
1470 (!strcasecmp(s, "dfb")))
1471 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_DIRECTFB);
1472 else if ((!strcasecmp(s, "psl1ght")))
1473 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_PSL1GHT);
1474 else if ((!strcasecmp(s, "sdl")) ||
1475 (!strcasecmp(s, "software-sdl")) ||
1476 (!strcasecmp(s, "software_sdl")))
1477 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_SDL);
1478 else if ((!strcasecmp(s, "sdl-16")) ||
1479 (!strcasecmp(s, "software-16-sdl")) ||
1480 (!strcasecmp(s, "software_16_sdl")))
1481 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_SDL);
1482 else if ((!strcasecmp(s, "opengl-sdl")) ||
1483 (!strcasecmp(s, "opengl_sdl")) ||
1484 (!strcasecmp(s, "gl-sdl")) ||
1485 (!strcasecmp(s, "gl_sdl")))
1486 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL);
1487 else if ((!strcasecmp(s, "opengl-cocoa")) ||
1488 (!strcasecmp(s, "opengl_cocoa")) ||
1489 (!strcasecmp(s, "gl-cocoa")) ||
1490 (!strcasecmp(s, "gl_cocoa")))
1491 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_COCOA);
1492 else if ((!strcasecmp(s, "gdi")) ||
1493 (!strcasecmp(s, "software-gdi")) ||
1494 (!strcasecmp(s, "software_gdi")))
1495 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_WIN32);
1496 else if ((!strcasecmp(s, "wince-gdi")) ||
1497 (!strcasecmp(s, "software-16-wince-gdi")) ||
1498 (!strcasecmp(s, "software_16_wince_gdi")))
1499 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_WINCE);
1500 else if ((!strncmp(s, "shot:", 5)))
1501 eina_stringshare_replace(&_elm_config->engine, s);
1504 s = getenv("ELM_VSYNC");
1505 if (s) _elm_config->vsync = !!atoi(s);
1507 s = getenv("ELM_THUMBSCROLL_ENABLE");
1508 if (s) _elm_config->thumbscroll_enable = !!atoi(s);
1509 s = getenv("ELM_THUMBSCROLL_THRESHOLD");
1510 if (s) _elm_config->thumbscroll_threshold = atoi(s);
1511 // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
1512 s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
1513 if (s) _elm_config->thumbscroll_momentum_threshold = atof(s);
1514 s = getenv("ELM_THUMBSCROLL_FRICTION");
1515 if (s) _elm_config->thumbscroll_friction = atof(s);
1516 s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
1517 if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
1518 s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
1519 if (s) _elm_config->thumbscroll_bounce_friction = atof(s);
1520 s = getenv("ELM_PAGE_SCROLL_FRICTION");
1521 if (s) _elm_config->page_scroll_friction = atof(s);
1522 s = getenv("ELM_BRING_IN_SCROLL_FRICTION");
1523 if (s) _elm_config->bring_in_scroll_friction = atof(s);
1524 s = getenv("ELM_ZOOM_FRICTION");
1525 if (s) _elm_config->zoom_friction = atof(s);
1526 s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
1536 _elm_config->thumbscroll_border_friction = friction;
1538 s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION");
1548 _elm_config->thumbscroll_sensitivity_friction = friction;
1550 s = getenv("ELM_SCROLL_SMOOTH_TIME_INTERVAL");
1551 if (s) _elm_config->scroll_smooth_time_interval = atof(s);
1552 s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
1553 if (s) _elm_config->scroll_smooth_amount = atof(s);
1554 s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT");
1555 if (s) _elm_config->scroll_smooth_history_weight = atof(s);
1556 s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
1557 if (s) _elm_config->scroll_smooth_future_time = atof(s);
1558 s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
1559 if (s) _elm_config->scroll_smooth_time_window = atof(s);
1560 s = getenv("ELM_THEME");
1561 if (s) eina_stringshare_replace(&_elm_config->theme, s);
1563 s = getenv("ELM_FONT_HINTING");
1566 if (!strcasecmp(s, "none")) _elm_config->font_hinting = 0;
1567 else if (!strcasecmp(s, "auto"))
1568 _elm_config->font_hinting = 1;
1569 else if (!strcasecmp(s, "bytecode"))
1570 _elm_config->font_hinting = 2;
1573 s = getenv("ELM_FONT_PATH");
1579 EINA_LIST_FREE(_elm_config->font_dirs, p)
1581 eina_stringshare_del(p);
1584 buf2 = alloca(strlen(s) + 1);
1589 if ((*p == ':') || (*p == 0))
1594 strncpy(buf2, pp, len);
1596 _elm_config->font_dirs =
1597 eina_list_append(_elm_config->font_dirs,
1598 eina_stringshare_add(buf2));
1611 s = getenv("ELM_IMAGE_CACHE");
1612 if (s) _elm_config->image_cache = atoi(s);
1614 s = getenv("ELM_FONT_CACHE");
1615 if (s) _elm_config->font_cache = atoi(s);
1617 s = getenv("ELM_SCALE");
1618 if (s) _elm_config->scale = atof(s);
1620 _elm_config->finger_size =
1621 (double)_elm_config->finger_size * _elm_config->scale;
1622 s = getenv("ELM_FINGER_SIZE");
1623 if (s) _elm_config->finger_size = atoi(s);
1625 s = getenv("ELM_PASSWORD_SHOW_LAST");
1626 if (s) _elm_config->password_show_last = !!atoi(s);
1628 s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT");
1631 double pw_show_last_timeout = atof(s);
1632 if (pw_show_last_timeout >= 0.0)
1633 _elm_config->password_show_last_timeout = pw_show_last_timeout;
1636 s = getenv("ELM_FPS");
1637 if (s) _elm_config->fps = atof(s);
1638 if (_elm_config->fps < 1.0) _elm_config->fps = 1.0;
1640 s = getenv("ELM_MODULES");
1641 if (s) eina_stringshare_replace(&_elm_config->modules, s);
1643 /* Get RTL orientation from system */
1644 setlocale(LC_ALL, "");
1645 bindtextdomain(PACKAGE, LOCALE_DIR);
1646 _elm_config->is_mirrored = !strcmp(E_("default:LTR"), "default:RTL");
1648 s = getenv("ELM_TOOLTIP_DELAY");
1651 double delay = atof(s);
1653 _elm_config->tooltip_delay = delay;
1656 s = getenv("ELM_CURSOR_ENGINE_ONLY");
1657 if (s) _elm_config->cursor_engine_only = !!atoi(s);
1659 s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE");
1660 if (s) _elm_config->focus_highlight_enable = !!atoi(s);
1662 s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE");
1663 if (s) _elm_config->focus_highlight_animate = !!atoi(s);
1665 s = getenv("ELM_TOOLBAR_SHRINK_MODE");
1666 if (s) _elm_config->toolbar_shrink_mode = atoi(s);
1668 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE");
1669 if (s) _elm_config->fileselector_expand_enable = !!atoi(s);
1671 s = getenv("ELM_INWIN_DIALOGS_ENABLE");
1672 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s);
1674 s = getenv("ELM_ICON_SIZE");
1675 if (s) _elm_config->icon_size = atoi(s);
1677 s = getenv("ELM_LONGPRESS_TIMEOUT");
1678 if (s) _elm_config->longpress_timeout = atof(s);
1679 if (_elm_config->longpress_timeout < 0.0)
1680 _elm_config->longpress_timeout = 0.0;
1682 s = getenv("ELM_EFFECT_ENABLE");
1683 if (s) _elm_config->effect_enable = !!atoi(s);
1685 s = getenv("ELM_DESKTOP_ENTRY");
1686 if (s) _elm_config->desktop_entry = !!atoi(s);
1687 s = getenv("ELM_ACCESS_MODE");
1688 if (s) _elm_config->access_mode = ELM_ACCESS_MODE_ON;
1692 elm_mirrored_get(void)
1694 return _elm_config->is_mirrored;
1698 elm_mirrored_set(Eina_Bool mirrored)
1700 _elm_config->is_mirrored = mirrored;
1705 _elm_config_init(void)
1708 _profile_fetch_from_conf();
1710 // NOTE: Do not merge upstream code. Just leave it.
1713 // _elm_config_font_overlay_apply();
1718 _elm_config_sub_init(void)
1720 // NOTE: Do not merge upstream code. Just leave it.
1723 _elm_config_font_overlay_apply();
1726 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1727 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1728 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
1729 ENGINE_COMPARE(ELM_XRENDER_X11) ||
1730 ENGINE_COMPARE(ELM_OPENGL_X11) ||
1731 ENGINE_COMPARE(ELM_OPENGL_COCOA))
1732 #undef ENGINE_COMPARE
1734 #ifdef HAVE_ELEMENTARY_X
1735 unsigned int val = 1000;
1737 if (!ecore_x_init(NULL))
1739 ERR("Cannot connect to X11 display. check $DISPLAY variable");
1742 _root_1st = ecore_x_window_root_first_get();
1744 if (!ecore_x_screen_is_composited(0))
1745 _elm_config->compositing = 0;
1747 ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
1748 ecore_x_event_mask_set(_root_1st,
1749 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1750 _prop_change_handler = ecore_event_handler_add
1751 (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
1752 if (!getenv("ELM_FINGER_SIZE"))
1754 if (ecore_x_window_prop_card32_get(_root_1st,
1755 _atom[ATOM_E_FINGER_SIZE],
1760 _elm_config->finger_size = val;
1764 if (!getenv("ELM_THEME"))
1768 s = ecore_x_window_prop_string_get(_root_1st,
1769 _atom[ATOM_E_THEME]);
1772 eina_stringshare_replace(&_elm_config->theme, s);
1773 _elm_theme_parse(NULL, s);
1777 if (!getenv("ELM_PROFILE"))
1781 s = ecore_x_window_prop_string_get(_root_1st,
1782 _atom[ATOM_E_PROFILE]);
1789 if (strcmp(_elm_profile, s)) changed = 1;
1793 if (changed) _prop_config_get();
1798 _config_sub_apply();
1802 _elm_config_reload(void)
1807 _elm_config_font_overlay_apply();
1813 _elm_config_engine_set(const char *engine)
1815 if (_elm_config->engine && strcmp(_elm_config->engine, engine))
1816 eina_stringshare_del(_elm_config->engine);
1818 _elm_config->engine = eina_stringshare_add(engine);
1822 _elm_config_profile_set(const char *profile)
1824 Eina_Bool changed = EINA_FALSE;
1828 if (strcmp(_elm_profile, profile))
1833 _elm_profile = strdup(profile);
1840 _elm_config_font_overlay_apply();
1847 _elm_config_shutdown(void)
1849 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1850 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1851 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
1852 ENGINE_COMPARE(ELM_XRENDER_X11) ||
1853 ENGINE_COMPARE(ELM_OPENGL_X11))
1854 #undef ENGINE_COMPARE
1856 #ifdef HAVE_ELEMENTARY_X
1857 ecore_event_handler_del(_prop_change_handler);
1858 _prop_change_handler = NULL;
1865 _elm_profile = NULL;