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",
36 /* whenever you want to add a new text class support into Elementary,
37 declare it both here and in the (default) theme */
38 static const Elm_Text_Class _elm_text_classes[] = {
39 {"button", "Button Labels"},
40 {"label", "Text Labels"},
41 {"entry", "Text Entries"},
42 {"title_bar", "Title Bar"},
43 {"list_item", "List Items"},
44 {"grid_item", "Grid Items"},
45 {"toolbar_item", "Toolbar Items"},
46 {"menu_item", "Menu Items"},
50 static void _desc_init(void);
51 static void _desc_shutdown(void);
52 static void _profile_fetch_from_conf(void);
53 static void _config_free(void);
54 static void _config_apply(void);
55 static Elm_Config *_config_user_load(void);
56 static Elm_Config *_config_system_load(void);
57 static void _config_load(void);
58 static void _config_update(void);
59 static void _env_get(void);
60 static size_t _elm_data_dir_snprintf(char *dst,
64 static size_t _elm_user_dir_snprintf(char *dst,
69 #define ELM_CONFIG_VAL(edd, type, member, dtype) \
70 EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
71 #define ELM_CONFIG_LIST(edd, type, member, eddtype) \
72 EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype)
74 #ifdef HAVE_ELEMENTARY_X
75 static Ecore_Event_Handler *_prop_change_handler = NULL;
76 static Ecore_X_Window _root_1st = 0;
78 static Ecore_X_Atom _atom[ATOM_COUNT];
79 static Ecore_X_Atom _atom_config = 0;
80 static const char *_atom_names[ATOM_COUNT] =
82 "ENLIGHTENMENT_SCALE",
83 "ENLIGHTENMENT_FINGER_SIZE",
84 "ENLIGHTENMENT_THEME",
85 "ENLIGHTENMENT_PROFILE",
86 "ENLIGHTENMENT_FONT_OVERLAY",
87 "ENLIGHTENMENT_CACHE_FLUSH_INTERVAL",
88 "ENLIGHTENMENT_CACHE_FLUSH_ENABLE",
89 "ENLIGHTENMENT_FONT_CACHE",
90 "ENLIGHTENMENT_IMAGE_CACHE",
91 "ENLIGHTENMENT_EDJE_FILE_CACHE",
92 "ENLIGHTENMENT_EDJE_COLLECTION_CACHE",
93 "ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE",
94 "ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION",
95 "ENLIGHTENMENT_THUMBSCROLL_ENABLE",
96 "ENLIGHTENMENT_THUMBSCROLL_THRESHOLD",
97 "ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD",
98 "ENLIGHTENMENT_THUMBSCROLL_FRICTION",
99 "ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION",
100 "ENLIGHTENMENT_THUMBSCROLL_SENSITIVITY_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_SENSITIVITY_FRICTION 18
125 #define ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION 19
126 #define ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION 20
127 #define ATOM_E_THUMBSCROLL_ZOOM_FRICTION 21
128 #define ATOM_E_CONFIG 22
130 static Eina_Bool _prop_config_get(void);
131 static Eina_Bool _prop_change(void *data __UNUSED__,
132 int ev_type __UNUSED__,
136 _prop_config_get(void)
141 unsigned char *data = NULL;
142 Elm_Config *config_data;
144 snprintf(buf, sizeof(buf), "ENLIGHTENMENT_CONFIG_%s", _elm_profile);
145 atom = ecore_x_atom_get(buf);
147 if (!ecore_x_window_prop_property_get(_root_1st,
148 atom, _atom[ATOM_E_CONFIG],
151 if (!ecore_x_window_prop_property_get(_root_1st,
152 _atom[ATOM_E_CONFIG],
153 _atom[ATOM_E_CONFIG],
157 _atom_config = _atom[ATOM_E_CONFIG];
166 config_data = eet_data_descriptor_decode(_config_edd, data, size);
168 if (!config_data) return EINA_FALSE;
170 /* What do we do on version mismatch when someone changes the
171 * config in the rootwindow? */
172 /* Most obvious case, new version and we are still linked to
173 * whatever was there before, we just ignore until user restarts us */
174 if (config_data->config_version > ELM_CONFIG_VERSION)
176 /* What in the case the version is older? Do we even support those
177 * cases or we only check for equality above? */
180 _elm_config = config_data;
182 _elm_config_font_overlay_apply();
189 _prop_change(void *data __UNUSED__,
190 int ev_type __UNUSED__,
193 Ecore_X_Event_Window_Property *event = ev;
195 if (event->win == _root_1st)
197 if (event->atom == _atom[ATOM_E_SCALE])
199 unsigned int val = 1000;
201 if (ecore_x_window_prop_card32_get(event->win,
207 pscale = _elm_config->scale;
208 if (val > 0) _elm_config->scale = (double)val / 1000.0;
209 if (pscale != _elm_config->scale)
216 else if (event->atom == _atom[ATOM_E_FINGER_SIZE])
218 unsigned int val = 1000;
220 if (ecore_x_window_prop_card32_get(event->win,
226 pfinger_size = _elm_config->finger_size;
227 _elm_config->finger_size = val;
228 if (pfinger_size != _elm_config->finger_size)
235 else if (event->atom == _atom[ATOM_E_THEME])
239 val = ecore_x_window_prop_string_get(event->win,
241 eina_stringshare_replace(&_elm_config->theme, val);
244 _elm_theme_parse(NULL, val);
250 else if (event->atom == _atom[ATOM_E_PROFILE])
254 val = ecore_x_window_prop_string_get(event->win,
262 if (strcmp(_elm_profile, val)) changed = 1;
268 if (!_prop_config_get())
273 _elm_config_font_overlay_apply();
279 else if (event->atom == _atom[ATOM_E_FONT_OVERLAY])
281 unsigned int val = 1000;
283 if (ecore_x_window_prop_card32_get(event->win,
290 _elm_config_font_overlay_apply();
294 else if (event->atom == _atom[ATOM_E_CACHE_FLUSH_INTERVAL])
296 unsigned int val = 1000;
298 if (ecore_x_window_prop_card32_get(event->win,
302 int cache_flush_interval;
304 cache_flush_interval = _elm_config->cache_flush_poll_interval;
305 _elm_config->cache_flush_poll_interval = val;
306 if (cache_flush_interval !=
307 _elm_config->cache_flush_poll_interval)
311 else if (event->atom == _atom[ATOM_E_CACHE_FLUSH_ENABLE])
313 unsigned int val = 1000;
315 if (ecore_x_window_prop_card32_get(event->win,
319 _elm_config->cache_flush_enable = !!val;
323 else if (event->atom == _atom[ATOM_E_FONT_CACHE])
325 unsigned int val = 1000;
327 if (ecore_x_window_prop_card32_get(event->win,
333 font_cache = _elm_config->font_cache;
334 _elm_config->font_cache = val;
335 if (font_cache != _elm_config->font_cache)
339 else if (event->atom == _atom[ATOM_E_IMAGE_CACHE])
341 unsigned int val = 1000;
343 if (ecore_x_window_prop_card32_get(event->win,
349 image_cache = _elm_config->image_cache;
350 _elm_config->image_cache = val;
351 if (image_cache != _elm_config->image_cache)
355 else if (event->atom == _atom[ATOM_E_EDJE_FILE_CACHE])
357 unsigned int val = 1000;
359 if (ecore_x_window_prop_card32_get(event->win,
365 edje_file_cache = _elm_config->edje_cache;
366 _elm_config->edje_cache = val;
367 if (edje_file_cache != _elm_config->edje_cache)
371 else if (event->atom == _atom[ATOM_E_EDJE_COLLECTION_CACHE])
373 unsigned int val = 1000;
375 if (ecore_x_window_prop_card32_get(event->win,
379 int edje_collection_cache;
381 edje_collection_cache = _elm_config->edje_collection_cache;
382 _elm_config->edje_collection_cache = val;
383 if (edje_collection_cache !=
384 _elm_config->edje_collection_cache)
388 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BOUNCE_ENABLE])
390 unsigned int val = 1000;
392 if (ecore_x_window_prop_card32_get(event->win,
396 _elm_config->thumbscroll_bounce_enable = !!val;
399 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BOUNCE_FRICTION])
401 unsigned int val = 1000;
403 if (ecore_x_window_prop_card32_get(event->win,
408 _elm_config->thumbscroll_bounce_friction =
409 (double)val / 1000.0;
412 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_ENABLE])
414 unsigned int val = 1000;
416 if (ecore_x_window_prop_card32_get(event->win,
420 _elm_config->thumbscroll_enable = !!val;
423 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_THRESHOLD])
425 unsigned int val = 1000;
427 if (ecore_x_window_prop_card32_get(event->win,
431 if (val > 0) _elm_config->thumbscroll_threshold = val;
434 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_MOMENTUM_THRESHOLD])
436 unsigned int val = 1000;
438 if (ecore_x_window_prop_card32_get(event->win,
442 _elm_config->thumbscroll_momentum_threshold =
443 (double)val / 1000.0;
446 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_FRICTION])
448 unsigned int val = 1000;
450 if (ecore_x_window_prop_card32_get(event->win,
454 _elm_config->thumbscroll_friction = (double)val / 1000.0;
457 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_BORDER_FRICTION])
459 unsigned int val = 1000;
461 if (ecore_x_window_prop_card32_get(event->win,
465 _elm_config->thumbscroll_border_friction =
466 (double)val / 1000.0;
469 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_SENSITIVITY_FRICTION])
471 unsigned int val = 1000;
473 if (ecore_x_window_prop_card32_get(event->win,
477 _elm_config->thumbscroll_sensitivity_friction =
478 (double)val / 1000.0;
481 else if (event->atom == _atom[ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION])
483 unsigned int val = 1000;
485 if (ecore_x_window_prop_card32_get(event->win,
489 _elm_config->page_scroll_friction =
490 (double)val / 1000.0;
493 else if (event->atom ==
494 _atom[ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION])
496 unsigned int val = 1000;
498 if (ecore_x_window_prop_card32_get(event->win,
502 _elm_config->bring_in_scroll_friction =
503 (double)val / 1000.0;
506 else if (event->atom ==
507 _atom[ATOM_E_THUMBSCROLL_ZOOM_FRICTION])
509 unsigned int val = 1000;
511 if (ecore_x_window_prop_card32_get(event->win,
515 _elm_config->zoom_friction = (double)val / 1000.0;
518 else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
519 (event->atom == _atom[ATOM_E_CONFIG]))
524 return ECORE_CALLBACK_PASS_ON;
532 Eet_Data_Descriptor_Class eddc;
534 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config);
535 eddc.func.str_direct_alloc = NULL;
536 eddc.func.str_direct_free = NULL;
538 _config_edd = eet_data_descriptor_file_new(&eddc);
541 printf("EEEK! eet_data_descriptor_file_new() failed\n");
545 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
546 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Font_Overlay);
547 eddc.func.str_direct_alloc = NULL;
548 eddc.func.str_direct_free = NULL;
550 _config_font_overlay_edd = eet_data_descriptor_stream_new(&eddc);
551 if (!_config_font_overlay_edd)
553 printf("EEEK! eet_data_descriptor_stream_new() failed\n");
554 eet_data_descriptor_free(_config_edd);
557 #define T_INT EET_T_INT
558 #define T_DOUBLE EET_T_DOUBLE
559 #define T_STRING EET_T_STRING
560 #define T_UCHAR EET_T_UCHAR
562 #define T Elm_Font_Overlay
563 #define D _config_font_overlay_edd
564 ELM_CONFIG_VAL(D, T, text_class, EET_T_STRING);
565 ELM_CONFIG_VAL(D, T, font, EET_T_STRING);
566 ELM_CONFIG_VAL(D, T, size, EET_T_INT);
571 #define D _config_edd
572 ELM_CONFIG_VAL(D, T, config_version, T_INT);
573 ELM_CONFIG_VAL(D, T, engine, T_STRING);
574 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
575 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
576 ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
577 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
578 ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
579 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
580 ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
581 ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
582 ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
583 ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
584 ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
585 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
586 ELM_CONFIG_VAL(D, T, scroll_smooth_time_interval, T_DOUBLE);
587 ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
588 ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
589 ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE);
590 ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
591 ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
592 ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
593 ELM_CONFIG_VAL(D, T, compositing, T_INT);
594 /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
595 ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd);
596 ELM_CONFIG_VAL(D, T, font_hinting, T_INT);
597 ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT);
598 ELM_CONFIG_VAL(D, T, cache_flush_enable, T_UCHAR);
599 ELM_CONFIG_VAL(D, T, image_cache, T_INT);
600 ELM_CONFIG_VAL(D, T, font_cache, T_INT);
601 ELM_CONFIG_VAL(D, T, edje_cache, T_INT);
602 ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT);
603 ELM_CONFIG_VAL(D, T, finger_size, T_INT);
604 ELM_CONFIG_VAL(D, T, fps, T_DOUBLE);
605 ELM_CONFIG_VAL(D, T, theme, T_STRING);
606 ELM_CONFIG_VAL(D, T, modules, T_STRING);
607 ELM_CONFIG_VAL(D, T, tooltip_delay, T_DOUBLE);
608 ELM_CONFIG_VAL(D, T, cursor_engine_only, T_UCHAR);
609 ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR);
610 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
611 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
612 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
613 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR);
614 ELM_CONFIG_VAL(D, T, icon_size, T_INT);
615 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
616 ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR);
617 ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR);
618 ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR);
619 ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE);
620 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_factor, T_DOUBLE);
621 ELM_CONFIG_VAL(D, T, glayer_zoom_wheel_factor, T_DOUBLE);
622 ELM_CONFIG_VAL(D, T, glayer_zoom_distance_tolerance, T_DOUBLE);
623 ELM_CONFIG_VAL(D, T, glayer_rotate_angular_tolerance, T_DOUBLE);
624 ELM_CONFIG_VAL(D, T, glayer_line_min_length, T_DOUBLE);
625 ELM_CONFIG_VAL(D, T, glayer_line_distance_tolerance, T_DOUBLE);
626 ELM_CONFIG_VAL(D, T, glayer_line_angular_tolerance, T_DOUBLE);
627 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
628 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
629 ELM_CONFIG_VAL(D, T, access_mode, T_INT);
630 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
644 eet_data_descriptor_free(_config_edd);
648 if (_config_font_overlay_edd)
650 eet_data_descriptor_free(_config_font_overlay_edd);
651 _config_font_overlay_edd = NULL;
656 _sort_files_cb(const void *f1,
659 return strcmp(f1, f2);
663 _elm_config_current_profile_get(void)
669 _elm_data_dir_snprintf(char *dst,
674 size_t data_dir_len, off;
677 data_dir_len = eina_strlcpy(dst, _elm_data_dir, size);
679 off = data_dir_len + 1;
684 dst[data_dir_len] = '/';
686 off = off + vsnprintf(dst + off, size - off, fmt, ap);
694 _elm_user_dir_snprintf(char *dst,
700 size_t user_dir_len, off;
704 home = evil_homedir_get();
706 home = getenv("HOME");
711 user_dir_len = eina_str_join_len(dst, size, '/', home, strlen(home),
712 ".elementary", sizeof(".elementary") - 1);
714 off = user_dir_len + 1;
719 dst[user_dir_len] = '/';
721 off = off + vsnprintf(dst + off, size - off, fmt, ap);
729 _elm_config_profile_dir_get(const char *prof,
737 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof);
739 if (ecore_file_is_dir(buf))
745 snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof);
747 if (ecore_file_is_dir(buf))
754 _elm_config_font_overlays_list(void)
756 return _elm_config->font_overlays;
760 _elm_config_font_overlay_set(const char *text_class,
764 Elm_Font_Overlay *efd;
767 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
769 if (strcmp(efd->text_class, text_class))
772 if (efd->font) eina_stringshare_del(efd->font);
773 efd->font = eina_stringshare_add(font);
775 _elm_config->font_overlays =
776 eina_list_promote_list(_elm_config->font_overlays, l);
780 /* the text class doesn't exist */
781 efd = calloc(1, sizeof(Elm_Font_Overlay));
782 efd->text_class = eina_stringshare_add(text_class);
783 efd->font = eina_stringshare_add(font);
786 _elm_config->font_overlays = eina_list_prepend(_elm_config->font_overlays,
791 _elm_config_font_overlay_remove(const char *text_class)
793 Elm_Font_Overlay *efd;
796 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
798 if (strcmp(efd->text_class, text_class))
801 _elm_config->font_overlays =
802 eina_list_remove_list(_elm_config->font_overlays, l);
803 if (efd->text_class) eina_stringshare_del(efd->text_class);
804 if (efd->font) eina_stringshare_del(efd->font);
812 _elm_config_font_overlay_apply(void)
814 Elm_Font_Overlay *efd;
818 for (i = 0; _elm_text_classes[i].desc; i++)
819 edje_text_class_del(_elm_text_classes[i].name);
821 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
822 edje_text_class_set(efd->text_class, efd->font, efd->size);
826 _elm_config_text_classes_get(void)
828 Eina_List *ret = NULL;
831 for (i = 0; _elm_text_classes[i].desc; i++)
834 tc = malloc(sizeof(*tc));
836 *tc = _elm_text_classes[i];
838 ret = eina_list_append(ret, tc);
845 _elm_config_text_classes_free(Eina_List *l)
849 EINA_LIST_FREE(l, tc)
854 _elm_config_profiles_list(void)
856 const Eina_File_Direct_Info *info;
857 Eina_List *flist = NULL;
858 Eina_Iterator *file_it;
863 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config");
865 file_it = eina_file_direct_ls(buf);
872 len = sizeof(buf) - len;
874 EINA_ITERATOR_FOREACH(file_it, info)
876 if (info->name_length >= len)
879 if (info->type == EINA_FILE_DIR)
882 eina_list_sorted_insert(flist, _sort_files_cb,
883 eina_stringshare_add(info->path +
888 eina_iterator_free(file_it);
891 len = eina_str_join_len(buf, sizeof(buf), '/', _elm_data_dir,
892 strlen(_elm_data_dir), "config",
893 sizeof("config") - 1);
895 file_it = eina_file_direct_ls(buf);
902 len = sizeof(buf) - len;
903 EINA_ITERATOR_FOREACH(file_it, info)
905 if (info->name_length >= len)
915 EINA_LIST_FOREACH(flist, l, tmp)
916 if (!strcmp(info->path + info->name_start, tmp))
921 eina_list_sorted_insert(flist, _sort_files_cb,
922 eina_stringshare_add(info->path +
931 eina_iterator_free(file_it);
935 EINA_LIST_FREE(flist, dir)
936 eina_stringshare_del(dir);
942 _profile_fetch_from_conf(void)
944 char buf[PATH_MAX], *p, *s;
948 _elm_profile = strdup("default");
950 // if env var - use profile without question
951 s = getenv("ELM_PROFILE");
955 _elm_profile = strdup(s);
960 _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
961 ef = eet_open(buf, EET_FILE_MODE_READ);
964 p = eet_read(ef, "config", &len);
968 _elm_profile = malloc(len + 1);
969 memcpy(_elm_profile, p, len);
970 _elm_profile[len] = 0;
979 _elm_data_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
980 ef = eet_open(buf, EET_FILE_MODE_READ);
983 p = eet_read(ef, "config", &len);
987 _elm_profile = malloc(len + 1);
988 memcpy(_elm_profile, p, len);
989 _elm_profile[len] = 0;
999 Elm_Font_Overlay *fo;
1000 const char *fontdir;
1002 if (!_elm_config) return;
1003 EINA_LIST_FREE(_elm_config->font_dirs, fontdir)
1005 eina_stringshare_del(fontdir);
1007 if (_elm_config->engine) eina_stringshare_del(_elm_config->engine);
1008 EINA_LIST_FREE(_elm_config->font_overlays, fo)
1010 if (fo->text_class) eina_stringshare_del(fo->text_class);
1011 if (fo->font) eina_stringshare_del(fo->font);
1014 if (_elm_config->theme) eina_stringshare_del(_elm_config->theme);
1015 if (_elm_config->modules) eina_stringshare_del(_elm_config->modules);
1023 _elm_theme_parse(NULL, _elm_config->theme);
1024 ecore_animator_frametime_set(1.0 / _elm_config->fps);
1028 _config_sub_apply(void)
1030 edje_frametime_set(1.0 / _elm_config->fps);
1031 edje_scale_set(_elm_config->scale);
1032 edje_password_show_last_set(_elm_config->password_show_last);
1033 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1034 if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
1038 _elm_cache_flush_cb(void *data __UNUSED__)
1041 return ECORE_CALLBACK_RENEW;
1044 /* kind of abusing this call right now -- shared between all of those
1045 * properties -- but they are not meant to be called that periodically
1055 EINA_LIST_FOREACH(_elm_win_list, l, win)
1057 Evas *e = evas_object_evas_get(win);
1058 evas_image_cache_set(e, _elm_config->image_cache * 1024);
1059 evas_font_cache_set(e, _elm_config->font_cache * 1024);
1061 edje_file_cache_set(_elm_config->edje_cache);
1062 edje_collection_cache_set(_elm_config->edje_collection_cache);
1064 if (_elm_cache_flush_poller)
1066 ecore_poller_del(_elm_cache_flush_poller);
1067 _elm_cache_flush_poller = NULL;
1069 if (_elm_config->cache_flush_enable)
1071 if (_elm_config->cache_flush_poll_interval > 0)
1073 _elm_cache_flush_poller =
1074 ecore_poller_add(ECORE_POLLER_CORE,
1075 _elm_config->cache_flush_poll_interval,
1076 _elm_cache_flush_cb, NULL);
1082 _config_user_load(void)
1084 Elm_Config *cfg = NULL;
1088 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
1091 ef = eet_open(buf, EET_FILE_MODE_READ);
1094 cfg = eet_data_read(ef, _config_edd, "config");
1101 _config_system_load(void)
1103 Elm_Config *cfg = NULL;
1107 _elm_data_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
1110 ef = eet_open(buf, EET_FILE_MODE_READ);
1113 cfg = eet_data_read(ef, _config_edd, "config");
1122 _elm_config = _config_user_load();
1125 if (_elm_config->config_version < ELM_CONFIG_VERSION)
1130 /* no user config, fallback for system. No need to check version for
1131 * this one, if it's not the right one, someone screwed up at the time
1132 * of installing it */
1133 _elm_config = _config_system_load();
1134 if (_elm_config) return;
1135 /* FIXME: config load could have failed because of a non-existent
1136 * profile. Fallback to default before moving on */
1138 // config load fail - defaults
1139 /* XXX: do these make sense? Only if it's valid to install the lib
1140 * without the config, but do we want that? */
1141 _elm_config = ELM_NEW(Elm_Config);
1142 _elm_config->config_version = ELM_CONFIG_VERSION;
1143 _elm_config->engine = eina_stringshare_add("software_x11");
1144 _elm_config->vsync = 0;
1145 _elm_config->thumbscroll_enable = EINA_TRUE;
1146 _elm_config->thumbscroll_threshold = 24;
1147 _elm_config->thumbscroll_momentum_threshold = 100.0;
1148 _elm_config->thumbscroll_friction = 1.0;
1149 _elm_config->thumbscroll_bounce_friction = 0.5;
1150 _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
1151 _elm_config->page_scroll_friction = 0.5;
1152 _elm_config->bring_in_scroll_friction = 0.5;
1153 _elm_config->zoom_friction = 0.5;
1154 _elm_config->thumbscroll_border_friction = 0.5;
1155 _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
1156 _elm_config->scroll_smooth_time_interval = 0.008;
1157 _elm_config->scroll_smooth_amount = 1.0;
1158 _elm_config->scroll_smooth_history_weight = 0.3;
1159 _elm_config->scroll_smooth_future_time = 0.0;
1160 _elm_config->scroll_smooth_time_window = 0.2;
1161 _elm_config->scale = 1.0;
1162 _elm_config->bgpixmap = 0;
1163 _elm_config->compositing = 1;
1164 _elm_config->font_hinting = 2;
1165 _elm_config->cache_flush_poll_interval = 512;
1166 _elm_config->cache_flush_enable = EINA_TRUE;
1167 _elm_config->font_dirs = NULL;
1168 _elm_config->image_cache = 4096;
1169 _elm_config->font_cache = 512;
1170 _elm_config->edje_cache = 32;
1171 _elm_config->edje_collection_cache = 64;
1172 _elm_config->finger_size = 40;
1173 _elm_config->fps = 60.0;
1174 _elm_config->theme = eina_stringshare_add("default");
1175 _elm_config->modules = NULL;
1176 _elm_config->tooltip_delay = 1.0;
1177 _elm_config->cursor_engine_only = EINA_TRUE;
1178 _elm_config->focus_highlight_enable = EINA_FALSE;
1179 _elm_config->focus_highlight_animate = EINA_TRUE;
1180 _elm_config->toolbar_shrink_mode = 2;
1181 _elm_config->fileselector_expand_enable = EINA_FALSE;
1182 _elm_config->inwin_dialogs_enable = EINA_FALSE;
1183 _elm_config->icon_size = 32;
1184 _elm_config->longpress_timeout = 1.0;
1185 _elm_config->effect_enable = EINA_TRUE;
1186 _elm_config->desktop_entry = EINA_FALSE;
1187 _elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
1188 _elm_config->password_show_last = EINA_FALSE;
1189 _elm_config->password_show_last_timeout = 2.0;
1190 _elm_config->glayer_zoom_finger_factor = 1.0;
1191 _elm_config->glayer_zoom_wheel_factor = 0.05;
1192 _elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_finger_size_get() */
1193 _elm_config->glayer_rotate_angular_tolerance = 0.034906585; /* Represents 2 DEG */
1194 _elm_config->glayer_line_min_length = 1.0; /* 1 times elm_finger_size_get() */
1195 _elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_finger_size_get() */
1196 _elm_config->glayer_line_angular_tolerance = 0.34906585; /* Represents 20 DEG */
1197 _elm_config->glayer_flick_time_limit_ms = 60; /* 60 ms to finish flick */
1198 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
1199 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
1203 _elm_config_eet_close_error_get(Eet_File *ef,
1207 const char *erstr = NULL;
1209 err = eet_close(ef);
1212 case EET_ERROR_WRITE_ERROR:
1213 erstr = "An error occurred while saving Elementary's "
1214 "settings to disk. The error could not be "
1215 "deterimined. The file where the error occurred was: "
1216 "%s. This file has been deleted to avoid corrupt data.";
1219 case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG:
1220 erstr = "Elementary's settings files are too big "
1221 "for the file system they are being saved to. "
1222 "This error is very strange as the files should "
1223 "be extremely small. Please check the settings "
1224 "for your home directory. "
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_IO_ERROR:
1230 erstr = "An output error occurred when writing the settings "
1231 "files for Elementary. Your disk is having troubles "
1232 "and possibly needs replacement. "
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_OUT_OF_SPACE:
1238 erstr = "Elementary cannot write its settings file "
1239 "because it ran out of space to write the file. "
1240 "You have either run out of disk space or have "
1241 "gone over your quota limit. "
1242 "The file where the error occurred was: %s ."
1243 "This file has been deleted to avoid corrupt data.";
1246 case EET_ERROR_WRITE_ERROR_FILE_CLOSED:
1247 erstr = "Elementary unexpectedly had the settings file "
1248 "it was writing closed on it. This is very unusual. "
1249 "The file where the error occurred was: %s "
1250 "This file has been deleted to avoid corrupt data.";
1258 /* delete any partially-written file */
1259 ecore_file_unlink(file);
1260 return strdup(erstr);
1267 _elm_config_profile_save(void)
1269 char buf[4096], buf2[4096];
1275 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
1276 if (len + 1 >= sizeof(buf))
1279 len = _elm_user_dir_snprintf(buf2, sizeof(buf2), "config/profile.cfg.tmp");
1280 if (len + 1 >= sizeof(buf2))
1283 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1287 ok = eet_write(ef, "config", _elm_profile, strlen(_elm_profile), 0);
1291 err = _elm_config_eet_close_error_get(ef, buf2);
1299 ret = ecore_file_mv(buf2, buf);
1302 ERR("Error saving Elementary's configuration file");
1306 ecore_file_unlink(buf2);
1310 ecore_file_unlink(buf2);
1315 _elm_config_save(void)
1317 char buf[4096], buf2[4096];
1323 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", _elm_profile);
1324 if (len + 1 >= sizeof(buf))
1327 ok = ecore_file_mkpath(buf);
1330 ERR("Problem acessing Elementary's user configuration directory: %s",
1335 if (!_elm_config_profile_save())
1341 if (len + sizeof("base.cfg") >= sizeof(buf) - len)
1344 memcpy(buf + len, "base.cfg", sizeof("base.cfg"));
1345 len += sizeof("base.cfg") - 1;
1347 if (len + sizeof(".tmp") >= sizeof(buf))
1350 memcpy(buf2, buf, len);
1351 memcpy(buf2 + len, ".tmp", sizeof(".tmp"));
1353 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1357 ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1);
1361 err = _elm_config_eet_close_error_get(ef, buf2);
1369 ret = ecore_file_mv(buf2, buf);
1372 ERR("Error saving Elementary's configuration file");
1376 ecore_file_unlink(buf2);
1380 ecore_file_unlink(buf2);
1385 _config_update(void)
1389 tcfg = _config_system_load();
1392 /* weird profile or something? We should probably fill
1393 * with hardcoded defaults, or get from default previx */
1396 #define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) {
1397 #define IFCFGELSE } else {
1399 #define COPYVAL(x) do {_elm_config->x = tcfg->x; } while(0)
1400 #define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while(0)
1401 #define COPYSTR(x) COPYPTR(x)
1403 /* we also need to update for property changes in the root window
1404 * if needed, but that will be dependent on new properties added
1405 * with each version */
1408 COPYVAL(longpress_timeout);
1418 /* after updating user config, we must save */
1427 s = getenv("ELM_ENGINE");
1430 if ((!strcasecmp(s, "x11")) ||
1431 (!strcasecmp(s, "x")) ||
1432 (!strcasecmp(s, "software-x11")) ||
1433 (!strcasecmp(s, "software_x11")))
1434 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_X11);
1435 else if ((!strcasecmp(s, "opengl")) ||
1436 (!strcasecmp(s, "gl")) ||
1437 (!strcasecmp(s, "opengl-x11")) ||
1438 (!strcasecmp(s, "opengl_x11")))
1439 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_X11);
1440 else if ((!strcasecmp(s, "x11-8")) ||
1441 (!strcasecmp(s, "x8")) ||
1442 (!strcasecmp(s, "software-8-x11")) ||
1443 (!strcasecmp(s, "software_8_x11")))
1444 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_8_X11);
1445 else if ((!strcasecmp(s, "x11-16")) ||
1446 (!strcasecmp(s, "x16")) ||
1447 (!strcasecmp(s, "software-16-x11")) ||
1448 (!strcasecmp(s, "software_16_x11")))
1449 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_X11);
1451 else if ((!strcasecmp(s, "xrender")) ||
1452 (!strcasecmp(s, "xr")) ||
1453 (!strcasecmp(s, "xrender-x11")) ||
1454 (!strcasecmp(s, "xrender_x11")))
1455 eina_stringshare_replace(&_elm_config->engine, ELM_XRENDER_X11);
1457 else if ((!strcasecmp(s, "fb")) ||
1458 (!strcasecmp(s, "software-fb")) ||
1459 (!strcasecmp(s, "software_fb")))
1460 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB);
1461 else if ((!strcasecmp(s, "directfb")) ||
1462 (!strcasecmp(s, "dfb")))
1463 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_DIRECTFB);
1464 else if ((!strcasecmp(s, "sdl")) ||
1465 (!strcasecmp(s, "software-sdl")) ||
1466 (!strcasecmp(s, "software_sdl")))
1467 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_SDL);
1468 else if ((!strcasecmp(s, "sdl-16")) ||
1469 (!strcasecmp(s, "software-16-sdl")) ||
1470 (!strcasecmp(s, "software_16_sdl")))
1471 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_SDL);
1472 else if ((!strcasecmp(s, "opengl-sdl")) ||
1473 (!strcasecmp(s, "opengl_sdl")) ||
1474 (!strcasecmp(s, "gl-sdl")) ||
1475 (!strcasecmp(s, "gl_sdl")))
1476 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL);
1477 else if ((!strcasecmp(s, "gdi")) ||
1478 (!strcasecmp(s, "software-gdi")) ||
1479 (!strcasecmp(s, "software_gdi")))
1480 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_WIN32);
1481 else if ((!strcasecmp(s, "wince-gdi")) ||
1482 (!strcasecmp(s, "software-16-wince-gdi")) ||
1483 (!strcasecmp(s, "software_16_wince_gdi")))
1484 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_WINCE);
1485 else if ((!strncmp(s, "shot:", 5)))
1486 eina_stringshare_replace(&_elm_config->engine, s);
1489 s = getenv("ELM_VSYNC");
1490 if (s) _elm_config->vsync = !!atoi(s);
1492 s = getenv("ELM_THUMBSCROLL_ENABLE");
1493 if (s) _elm_config->thumbscroll_enable = !!atoi(s);
1494 s = getenv("ELM_THUMBSCROLL_THRESHOLD");
1495 if (s) _elm_config->thumbscroll_threshold = atoi(s);
1496 // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
1497 s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
1498 if (s) _elm_config->thumbscroll_momentum_threshold = atof(s);
1499 s = getenv("ELM_THUMBSCROLL_FRICTION");
1500 if (s) _elm_config->thumbscroll_friction = atof(s);
1501 s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
1502 if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
1503 s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
1504 if (s) _elm_config->thumbscroll_bounce_friction = atof(s);
1505 s = getenv("ELM_PAGE_SCROLL_FRICTION");
1506 if (s) _elm_config->page_scroll_friction = atof(s);
1507 s = getenv("ELM_BRING_IN_SCROLL_FRICTION");
1508 if (s) _elm_config->bring_in_scroll_friction = atof(s);
1509 s = getenv("ELM_ZOOM_FRICTION");
1510 if (s) _elm_config->zoom_friction = atof(s);
1511 s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
1521 _elm_config->thumbscroll_border_friction = friction;
1523 s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION");
1533 _elm_config->thumbscroll_sensitivity_friction = friction;
1535 s = getenv("ELM_SCROLL_SMOOTH_TIME_INTERVAL");
1536 if (s) _elm_config->scroll_smooth_time_interval = atof(s);
1537 s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
1538 if (s) _elm_config->scroll_smooth_amount = atof(s);
1539 s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT");
1540 if (s) _elm_config->scroll_smooth_history_weight = atof(s);
1541 s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
1542 if (s) _elm_config->scroll_smooth_future_time = atof(s);
1543 s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
1544 if (s) _elm_config->scroll_smooth_time_window = atof(s);
1545 s = getenv("ELM_THEME");
1546 if (s) eina_stringshare_replace(&_elm_config->theme, s);
1548 s = getenv("ELM_FONT_HINTING");
1551 if (!strcasecmp(s, "none")) _elm_config->font_hinting = 0;
1552 else if (!strcasecmp(s, "auto"))
1553 _elm_config->font_hinting = 1;
1554 else if (!strcasecmp(s, "bytecode"))
1555 _elm_config->font_hinting = 2;
1558 s = getenv("ELM_FONT_PATH");
1564 EINA_LIST_FREE(_elm_config->font_dirs, p)
1566 eina_stringshare_del(p);
1569 buf2 = alloca(strlen(s) + 1);
1574 if ((*p == ':') || (*p == 0))
1579 strncpy(buf2, pp, len);
1581 _elm_config->font_dirs =
1582 eina_list_append(_elm_config->font_dirs,
1583 eina_stringshare_add(buf2));
1596 s = getenv("ELM_IMAGE_CACHE");
1597 if (s) _elm_config->image_cache = atoi(s);
1599 s = getenv("ELM_FONT_CACHE");
1600 if (s) _elm_config->font_cache = atoi(s);
1602 s = getenv("ELM_SCALE");
1603 if (s) _elm_config->scale = atof(s);
1605 _elm_config->finger_size =
1606 (double)_elm_config->finger_size * _elm_config->scale;
1607 s = getenv("ELM_FINGER_SIZE");
1608 if (s) _elm_config->finger_size = atoi(s);
1610 s = getenv("ELM_PASSWORD_SHOW_LAST");
1611 if (s) _elm_config->password_show_last = !!atoi(s);
1613 s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT");
1616 double pw_show_last_timeout = atof(s);
1617 if (pw_show_last_timeout >= 0.0)
1618 _elm_config->password_show_last_timeout = pw_show_last_timeout;
1621 s = getenv("ELM_FPS");
1622 if (s) _elm_config->fps = atof(s);
1623 if (_elm_config->fps < 1.0) _elm_config->fps = 1.0;
1625 s = getenv("ELM_MODULES");
1626 if (s) eina_stringshare_replace(&_elm_config->modules, s);
1628 /* Get RTL orientation from system */
1629 setlocale(LC_ALL, "");
1630 bindtextdomain(PACKAGE, LOCALE_DIR);
1631 _elm_config->is_mirrored = !strcmp(E_("default:LTR"), "default:RTL");
1633 s = getenv("ELM_TOOLTIP_DELAY");
1636 double delay = atof(s);
1638 _elm_config->tooltip_delay = delay;
1641 s = getenv("ELM_CURSOR_ENGINE_ONLY");
1642 if (s) _elm_config->cursor_engine_only = !!atoi(s);
1644 s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE");
1645 if (s) _elm_config->focus_highlight_enable = !!atoi(s);
1647 s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE");
1648 if (s) _elm_config->focus_highlight_animate = !!atoi(s);
1650 s = getenv("ELM_TOOLBAR_SHRINK_MODE");
1651 if (s) _elm_config->toolbar_shrink_mode = atoi(s);
1653 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE");
1654 if (s) _elm_config->fileselector_expand_enable = !!atoi(s);
1656 s = getenv("ELM_INWIN_DIALOGS_ENABLE");
1657 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s);
1659 s = getenv("ELM_ICON_SIZE");
1660 if (s) _elm_config->icon_size = atoi(s);
1662 s = getenv("ELM_LONGPRESS_TIMEOUT");
1663 if (s) _elm_config->longpress_timeout = atof(s);
1664 if (_elm_config->longpress_timeout < 0.0)
1665 _elm_config->longpress_timeout = 0.0;
1667 s = getenv("ELM_EFFECT_ENABLE");
1668 if (s) _elm_config->effect_enable = !!atoi(s);
1670 s = getenv("ELM_DESKTOP_ENTRY");
1671 if (s) _elm_config->desktop_entry = !!atoi(s);
1675 * Get the system mirrored mode. This determines the default mirrored mode
1678 * @return EINA_TRUE if mirrored is set, EINA_FALSE otherwise
1681 elm_mirrored_get(void)
1683 return _elm_config->is_mirrored;
1687 * Set the system mirrored mode. This determines the default mirrored mode
1690 * @param mirrored EINA_TRUE to set mirrored mode, EINA_FALSE to unset it.
1693 elm_mirrored_set(Eina_Bool mirrored)
1695 _elm_config->is_mirrored = mirrored;
1700 _elm_config_init(void)
1703 _profile_fetch_from_conf();
1705 // NOTE: Do not merge upstream code. Just leave it.
1708 // _elm_config_font_overlay_apply();
1713 _elm_config_sub_init(void)
1715 // NOTE: Do not merge upstream code. Just leave it.
1718 _elm_config_font_overlay_apply();
1721 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1722 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1723 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
1724 ENGINE_COMPARE(ELM_XRENDER_X11) ||
1725 ENGINE_COMPARE(ELM_OPENGL_X11))
1726 #undef ENGINE_COMPARE
1728 #ifdef HAVE_ELEMENTARY_X
1729 unsigned int val = 1000;
1731 if (!ecore_x_init(NULL))
1733 ERR("Cannot connect to X11 display. check $DISPLAY variable");
1736 _root_1st = ecore_x_window_root_first_get();
1738 if (!ecore_x_screen_is_composited(0))
1739 _elm_config->compositing = 0;
1741 ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
1742 ecore_x_event_mask_set(_root_1st,
1743 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1744 _prop_change_handler = ecore_event_handler_add
1745 (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
1746 if (!getenv("ELM_SCALE"))
1748 if (ecore_x_window_prop_card32_get(_root_1st,
1749 _atom[ATOM_E_SCALE],
1754 _elm_config->scale = (double)val / 1000.0;
1755 // FIXME: hack until e export finger size too
1756 if (!getenv("ELM_FINGER_SIZE"))
1758 _elm_config->finger_size = 40.0 * _elm_config->scale;
1760 edje_scale_set(_elm_config->scale);
1764 if (!getenv("ELM_FINGER_SIZE"))
1766 if (ecore_x_window_prop_card32_get(_root_1st,
1767 _atom[ATOM_E_FINGER_SIZE],
1772 _elm_config->finger_size = val;
1776 if (!getenv("ELM_THEME"))
1780 s = ecore_x_window_prop_string_get(_root_1st,
1781 _atom[ATOM_E_THEME]);
1784 eina_stringshare_replace(&_elm_config->theme, s);
1785 _elm_theme_parse(NULL, s);
1789 if (!getenv("ELM_PROFILE"))
1793 s = ecore_x_window_prop_string_get(_root_1st,
1794 _atom[ATOM_E_PROFILE]);
1801 if (strcmp(_elm_profile, s)) changed = 1;
1805 if (changed) _prop_config_get();
1810 _config_sub_apply();
1814 _elm_config_reload(void)
1819 _elm_config_font_overlay_apply();
1825 _elm_config_engine_set(const char *engine)
1827 if (_elm_config->engine && strcmp(_elm_config->engine, engine))
1828 eina_stringshare_del(_elm_config->engine);
1830 _elm_config->engine = eina_stringshare_add(engine);
1834 _elm_config_profile_set(const char *profile)
1836 Eina_Bool changed = EINA_FALSE;
1840 if (strcmp(_elm_profile, profile))
1845 _elm_profile = strdup(profile);
1852 _elm_config_font_overlay_apply();
1859 _elm_config_shutdown(void)
1861 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1862 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1863 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
1864 ENGINE_COMPARE(ELM_XRENDER_X11) ||
1865 ENGINE_COMPARE(ELM_OPENGL_X11))
1866 #undef ENGINE_COMPARE
1868 #ifdef HAVE_ELEMENTARY_X
1869 ecore_event_handler_del(_prop_change_handler);
1870 _prop_change_handler = NULL;
1877 _elm_profile = NULL;