2 # include "elementary_config.h"
9 #include <Elementary.h>
12 EAPI int ELM_EVENT_CONFIG_ALL_CHANGED = 0;
14 Elm_Config *_elm_config = NULL;
15 char *_elm_profile = NULL;
16 static Eet_Data_Descriptor *_config_edd = NULL;
17 static Eet_Data_Descriptor *_config_font_overlay_edd = NULL;
18 const char *_elm_preferred_engine = NULL;
20 static Ecore_Poller *_elm_cache_flush_poller = NULL;
22 const char *_elm_engines[] = {
31 "software_16_wince_gdi",
44 /* whenever you want to add a new text class support into Elementary,
45 declare it both here and in the (default) theme */
46 static const Elm_Text_Class _elm_text_classes[] = {
47 {"button", "Button Labels"},
48 {"label", "Text Labels"},
49 {"entry", "Text Entries"},
50 {"title_bar", "Title Bar"},
51 {"list_item", "List Items"},
52 {"grid_item", "Grid Items"},
53 {"toolbar_item", "Toolbar Items"},
54 {"menu_item", "Menu Items"},
58 static void _desc_init(void);
59 static void _desc_shutdown(void);
60 static void _profile_fetch_from_conf(void);
61 static void _config_free(void);
62 static void _config_apply(void);
63 static Elm_Config *_config_user_load(void);
64 static Elm_Config *_config_system_load(void);
65 static void _config_load(void);
66 static void _config_update(void);
67 static void _env_get(void);
68 static size_t _elm_data_dir_snprintf(char *dst,
72 static size_t _elm_user_dir_snprintf(char *dst,
77 #define ELM_CONFIG_VAL(edd, type, member, dtype) \
78 EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
79 #define ELM_CONFIG_LIST(edd, type, member, eddtype) \
80 EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype)
82 #ifdef HAVE_ELEMENTARY_X
83 static Ecore_Event_Handler *_prop_change_handler = NULL;
84 static Ecore_Timer *_prop_all_update_timer = NULL;
85 static Ecore_Timer *_prop_change_delay_timer = NULL;
86 static Ecore_X_Window _root_1st = 0;
88 static Ecore_X_Atom _atom[ATOM_COUNT];
89 static Ecore_X_Atom _atom_config = 0;
90 static const char *_atom_names[ATOM_COUNT] =
95 #define ATOM_E_PROFILE 0
96 #define ATOM_E_CONFIG 1
98 static Eina_Bool _prop_all_update_cb(void *data __UNUSED__);
99 static Eina_Bool _prop_config_get(void);
100 static void _prop_config_set(void);
101 static Eina_Bool _prop_change(void *data __UNUSED__,
102 int ev_type __UNUSED__,
106 _prop_all_update_cb(void *data __UNUSED__)
109 ecore_x_window_prop_string_set(_root_1st, _atom[ATOM_E_PROFILE],
111 _prop_all_update_timer = NULL;
116 _prop_config_get(void)
121 unsigned char *data = NULL;
122 Elm_Config *config_data;
124 snprintf(buf, sizeof(buf), "ELM_CONFIG_%s", _elm_profile);
125 atom = ecore_x_atom_get(buf);
127 if (!ecore_x_window_prop_property_get(_root_1st,
128 atom, _atom[ATOM_E_CONFIG],
131 if (!ecore_x_window_prop_property_get(_root_1st,
132 _atom[ATOM_E_CONFIG],
133 _atom[ATOM_E_CONFIG],
137 _atom_config = _atom[ATOM_E_CONFIG];
146 config_data = eet_data_descriptor_decode(_config_edd, data, size);
148 if (!config_data) return EINA_FALSE;
150 /* What do we do on version mismatch when someone changes the
151 * config in the rootwindow? */
152 /* Most obvious case, new version and we are still linked to
153 * whatever was there before, we just ignore until user restarts us */
154 if (config_data->config_version > ELM_CONFIG_VERSION)
156 /* What in the case the version is older? Do we even support those
157 * cases or we only check for equality above? */
160 _elm_config = config_data;
162 _elm_config_font_overlay_apply();
165 ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
170 _prop_config_set(void)
172 unsigned char *config_data = NULL;
175 config_data = eet_data_descriptor_encode(_config_edd, _elm_config, &size);
181 snprintf(buf, sizeof(buf), "ELM_CONFIG_%s", _elm_profile);
182 atom = ecore_x_atom_get(buf);
185 ecore_x_window_prop_property_set(_root_1st, _atom_config,
186 _atom[ATOM_E_CONFIG], 8,
193 _prop_change_delay_cb(void *data __UNUSED__)
197 s = ecore_x_window_prop_string_get(_root_1st, _atom[ATOM_E_PROFILE]);
200 if (_elm_profile) free(_elm_profile);
204 _prop_change_delay_timer = NULL;
209 _prop_change(void *data __UNUSED__,
210 int ev_type __UNUSED__,
213 Ecore_X_Event_Window_Property *event = ev;
215 if (event->win == _root_1st)
217 if (event->atom == _atom[ATOM_E_PROFILE])
219 if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
220 _prop_change_delay_timer = ecore_timer_add(0.1, _prop_change_delay_cb, NULL);
222 else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
223 (event->atom == _atom[ATOM_E_CONFIG]))
225 if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
226 _prop_change_delay_timer = ecore_timer_add(0.1, _prop_change_delay_cb, NULL);
229 return ECORE_CALLBACK_PASS_ON;
237 Eet_Data_Descriptor_Class eddc;
239 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config);
240 eddc.func.str_direct_alloc = NULL;
241 eddc.func.str_direct_free = NULL;
243 _config_edd = eet_data_descriptor_file_new(&eddc);
246 printf("EEEK! eet_data_descriptor_file_new() failed\n");
250 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
251 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Font_Overlay);
252 eddc.func.str_direct_alloc = NULL;
253 eddc.func.str_direct_free = NULL;
255 _config_font_overlay_edd = eet_data_descriptor_stream_new(&eddc);
256 if (!_config_font_overlay_edd)
258 printf("EEEK! eet_data_descriptor_stream_new() failed\n");
259 eet_data_descriptor_free(_config_edd);
262 #define T_INT EET_T_INT
263 #define T_DOUBLE EET_T_DOUBLE
264 #define T_STRING EET_T_STRING
265 #define T_UCHAR EET_T_UCHAR
267 #define T Elm_Font_Overlay
268 #define D _config_font_overlay_edd
269 ELM_CONFIG_VAL(D, T, text_class, EET_T_STRING);
270 ELM_CONFIG_VAL(D, T, font, EET_T_STRING);
271 ELM_CONFIG_VAL(D, T, size, EET_T_INT);
276 #define D _config_edd
277 ELM_CONFIG_VAL(D, T, config_version, T_INT);
278 ELM_CONFIG_VAL(D, T, engine, T_STRING);
279 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
280 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
281 ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
282 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
283 ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
284 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
285 ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
286 ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
287 ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
288 ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
289 ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
290 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
291 ELM_CONFIG_VAL(D, T, scroll_smooth_time_interval, T_DOUBLE);
292 ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
293 ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
294 ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE);
295 ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
296 ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
297 ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
298 ELM_CONFIG_VAL(D, T, compositing, T_INT);
299 /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
300 ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd);
301 ELM_CONFIG_VAL(D, T, font_hinting, T_INT);
302 ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT);
303 ELM_CONFIG_VAL(D, T, cache_flush_enable, T_UCHAR);
304 ELM_CONFIG_VAL(D, T, image_cache, T_INT);
305 ELM_CONFIG_VAL(D, T, font_cache, T_INT);
306 ELM_CONFIG_VAL(D, T, edje_cache, T_INT);
307 ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT);
308 ELM_CONFIG_VAL(D, T, finger_size, T_INT);
309 ELM_CONFIG_VAL(D, T, fps, T_DOUBLE);
310 ELM_CONFIG_VAL(D, T, theme, T_STRING);
311 ELM_CONFIG_VAL(D, T, modules, T_STRING);
312 ELM_CONFIG_VAL(D, T, tooltip_delay, T_DOUBLE);
313 ELM_CONFIG_VAL(D, T, cursor_engine_only, T_UCHAR);
314 ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR);
315 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
316 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
317 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
318 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR);
319 ELM_CONFIG_VAL(D, T, icon_size, T_INT);
320 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
321 ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR);
322 ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR);
323 ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR);
324 ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE);
325 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_enable, T_UCHAR);
326 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_factor, T_DOUBLE);
327 ELM_CONFIG_VAL(D, T, glayer_zoom_wheel_factor, T_DOUBLE);
328 ELM_CONFIG_VAL(D, T, glayer_zoom_distance_tolerance, T_DOUBLE);
329 ELM_CONFIG_VAL(D, T, glayer_rotate_finger_enable, T_UCHAR);
330 ELM_CONFIG_VAL(D, T, glayer_rotate_angular_tolerance, T_DOUBLE);
331 ELM_CONFIG_VAL(D, T, glayer_line_min_length, T_DOUBLE);
332 ELM_CONFIG_VAL(D, T, glayer_line_distance_tolerance, T_DOUBLE);
333 ELM_CONFIG_VAL(D, T, glayer_line_angular_tolerance, T_DOUBLE);
334 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
335 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
336 ELM_CONFIG_VAL(D, T, access_mode, T_INT);
337 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
338 ELM_CONFIG_VAL(D, T, week_start, T_INT);
339 ELM_CONFIG_VAL(D, T, weekend_start, T_INT);
340 ELM_CONFIG_VAL(D, T, weekend_len, T_INT);
354 eet_data_descriptor_free(_config_edd);
358 if (_config_font_overlay_edd)
360 eet_data_descriptor_free(_config_font_overlay_edd);
361 _config_font_overlay_edd = NULL;
366 _sort_files_cb(const void *f1,
369 return strcmp(f1, f2);
373 _elm_config_current_profile_get(void)
379 _elm_data_dir_snprintf(char *dst,
384 size_t data_dir_len, off;
387 data_dir_len = eina_strlcpy(dst, _elm_data_dir, size);
389 off = data_dir_len + 1;
394 dst[data_dir_len] = '/';
396 off = off + vsnprintf(dst + off, size - off, fmt, ap);
404 _elm_user_dir_snprintf(char *dst,
410 size_t user_dir_len, off;
414 home = evil_homedir_get();
416 home = getenv("HOME");
421 user_dir_len = eina_str_join_len(dst, size, '/', home, strlen(home),
422 ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
424 off = user_dir_len + 1;
429 dst[user_dir_len] = '/';
431 off = off + vsnprintf(dst + off, size - off, fmt, ap);
439 _elm_config_profile_dir_get(const char *prof,
447 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof);
449 if (ecore_file_is_dir(buf))
455 snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof);
457 if (ecore_file_is_dir(buf))
464 _elm_config_font_overlays_list(void)
466 return _elm_config->font_overlays;
470 _elm_config_font_overlay_set(const char *text_class,
474 Elm_Font_Overlay *efd;
477 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
479 if (strcmp(efd->text_class, text_class))
482 if (efd->font) eina_stringshare_del(efd->font);
483 efd->font = eina_stringshare_add(font);
485 _elm_config->font_overlays =
486 eina_list_promote_list(_elm_config->font_overlays, l);
490 /* the text class doesn't exist */
491 efd = calloc(1, sizeof(Elm_Font_Overlay));
492 efd->text_class = eina_stringshare_add(text_class);
493 efd->font = eina_stringshare_add(font);
496 _elm_config->font_overlays = eina_list_prepend(_elm_config->font_overlays,
501 _elm_config_font_overlay_remove(const char *text_class)
503 Elm_Font_Overlay *efd;
506 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
508 if (strcmp(efd->text_class, text_class))
511 _elm_config->font_overlays =
512 eina_list_remove_list(_elm_config->font_overlays, l);
513 if (efd->text_class) eina_stringshare_del(efd->text_class);
514 if (efd->font) eina_stringshare_del(efd->font);
522 _elm_config_font_overlay_apply(void)
524 Elm_Font_Overlay *efd;
528 for (i = 0; _elm_text_classes[i].desc; i++)
529 edje_text_class_del(_elm_text_classes[i].name);
531 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
532 edje_text_class_set(efd->text_class, efd->font, efd->size);
536 _elm_config_text_classes_get(void)
538 Eina_List *ret = NULL;
541 for (i = 0; _elm_text_classes[i].desc; i++)
544 tc = malloc(sizeof(*tc));
547 *tc = _elm_text_classes[i];
549 ret = eina_list_append(ret, tc);
556 _elm_config_text_classes_free(Eina_List *l)
560 EINA_LIST_FREE(l, tc)
565 _elm_config_profiles_list(void)
567 Eina_File_Direct_Info *info;
568 Eina_List *flist = NULL;
569 Eina_Iterator *file_it;
574 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config");
576 file_it = eina_file_direct_ls(buf);
583 len = sizeof(buf) - len;
585 EINA_ITERATOR_FOREACH(file_it, info)
589 if (eina_file_statat(eina_iterator_container_get(file_it), info, &st))
594 if (info->name_length >= len)
597 if (info->type == EINA_FILE_DIR)
600 eina_list_sorted_insert(flist, _sort_files_cb,
601 eina_stringshare_add(info->path +
606 eina_iterator_free(file_it);
609 len = eina_str_join_len(buf, sizeof(buf), '/', _elm_data_dir,
610 strlen(_elm_data_dir), "config",
611 sizeof("config") - 1);
613 file_it = eina_file_direct_ls(buf);
620 len = sizeof(buf) - len;
621 EINA_ITERATOR_FOREACH(file_it, info)
623 if (info->name_length >= len)
633 EINA_LIST_FOREACH(flist, l, tmp)
634 if (!strcmp(info->path + info->name_start, tmp))
639 eina_list_sorted_insert(flist, _sort_files_cb,
640 eina_stringshare_add(info->path +
649 eina_iterator_free(file_it);
653 EINA_LIST_FREE(flist, dir)
654 eina_stringshare_del(dir);
660 _profile_fetch_from_conf(void)
662 char buf[PATH_MAX], *p, *s;
666 _elm_profile = strdup("default");
668 // if env var - use profile without question
669 s = getenv("ELM_PROFILE");
673 _elm_profile = strdup(s);
678 _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
679 ef = eet_open(buf, EET_FILE_MODE_READ);
682 p = eet_read(ef, "config", &len);
686 _elm_profile = malloc(len + 1);
687 memcpy(_elm_profile, p, len);
688 _elm_profile[len] = 0;
697 _elm_data_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
698 ef = eet_open(buf, EET_FILE_MODE_READ);
701 p = eet_read(ef, "config", &len);
705 _elm_profile = malloc(len + 1);
706 memcpy(_elm_profile, p, len);
707 _elm_profile[len] = 0;
717 Elm_Font_Overlay *fo;
720 if (!_elm_config) return;
721 EINA_LIST_FREE(_elm_config->font_dirs, fontdir)
723 eina_stringshare_del(fontdir);
725 if (_elm_config->engine) eina_stringshare_del(_elm_config->engine);
726 EINA_LIST_FREE(_elm_config->font_overlays, fo)
728 if (fo->text_class) eina_stringshare_del(fo->text_class);
729 if (fo->font) eina_stringshare_del(fo->font);
732 if (_elm_config->theme) eina_stringshare_del(_elm_config->theme);
733 if (_elm_config->modules) eina_stringshare_del(_elm_config->modules);
741 _elm_theme_parse(NULL, _elm_config->theme);
742 ecore_animator_frametime_set(1.0 / _elm_config->fps);
746 _config_sub_apply(void)
748 edje_frametime_set(1.0 / _elm_config->fps);
749 edje_scale_set(_elm_config->scale);
750 edje_password_show_last_set(_elm_config->password_show_last);
751 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
752 if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
756 _elm_cache_flush_cb(void *data __UNUSED__)
758 elm_cache_all_flush();
759 return ECORE_CALLBACK_RENEW;
762 /* kind of abusing this call right now -- shared between all of those
763 * properties -- but they are not meant to be called that periodically
771 elm_cache_all_flush();
773 EINA_LIST_FOREACH(_elm_win_list, l, win)
775 Evas *e = evas_object_evas_get(win);
776 evas_image_cache_set(e, _elm_config->image_cache * 1024);
777 evas_font_cache_set(e, _elm_config->font_cache * 1024);
779 edje_file_cache_set(_elm_config->edje_cache);
780 edje_collection_cache_set(_elm_config->edje_collection_cache);
782 if (_elm_cache_flush_poller)
784 ecore_poller_del(_elm_cache_flush_poller);
785 _elm_cache_flush_poller = NULL;
787 if (_elm_config->cache_flush_enable)
789 if (_elm_config->cache_flush_poll_interval > 0)
791 _elm_cache_flush_poller =
792 ecore_poller_add(ECORE_POLLER_CORE,
793 _elm_config->cache_flush_poll_interval,
794 _elm_cache_flush_cb, NULL);
800 _config_user_load(void)
802 Elm_Config *cfg = NULL;
806 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
809 ef = eet_open(buf, EET_FILE_MODE_READ);
812 cfg = eet_data_read(ef, _config_edd, "config");
819 _config_system_load(void)
821 Elm_Config *cfg = NULL;
825 _elm_data_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
828 ef = eet_open(buf, EET_FILE_MODE_READ);
831 cfg = eet_data_read(ef, _config_edd, "config");
840 _elm_config = _config_user_load();
843 if (_elm_config->config_version < ELM_CONFIG_VERSION)
848 /* no user config, fallback for system. No need to check version for
849 * this one, if it's not the right one, someone screwed up at the time
850 * of installing it */
851 _elm_config = _config_system_load();
852 if (_elm_config) return;
853 /* FIXME: config load could have failed because of a non-existent
854 * profile. Fallback to default before moving on */
856 // config load fail - defaults
857 // why are these here? well if they are, it means you can make a gui
858 // config recovery app i guess...
859 _elm_config = ELM_NEW(Elm_Config);
860 _elm_config->config_version = ELM_CONFIG_VERSION;
861 _elm_config->engine = eina_stringshare_add("software_x11");
862 _elm_config->vsync = 0;
863 _elm_config->thumbscroll_enable = EINA_TRUE;
864 _elm_config->thumbscroll_threshold = 24;
865 _elm_config->thumbscroll_momentum_threshold = 100.0;
866 _elm_config->thumbscroll_friction = 1.0;
867 _elm_config->thumbscroll_bounce_friction = 0.5;
868 _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
869 _elm_config->page_scroll_friction = 0.5;
870 _elm_config->bring_in_scroll_friction = 0.5;
871 _elm_config->zoom_friction = 0.5;
872 _elm_config->thumbscroll_border_friction = 0.5;
873 _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
874 _elm_config->scroll_smooth_time_interval = 0.008;
875 _elm_config->scroll_smooth_amount = 1.0;
876 _elm_config->scroll_smooth_history_weight = 0.3;
877 _elm_config->scroll_smooth_future_time = 0.0;
878 _elm_config->scroll_smooth_time_window = 0.2;
879 _elm_config->scale = 1.0;
880 _elm_config->bgpixmap = 0;
881 _elm_config->compositing = 1;
882 _elm_config->font_hinting = 2;
883 _elm_config->cache_flush_poll_interval = 512;
884 _elm_config->cache_flush_enable = EINA_TRUE;
885 _elm_config->font_dirs = NULL;
886 _elm_config->image_cache = 4096;
887 _elm_config->font_cache = 512;
888 _elm_config->edje_cache = 32;
889 _elm_config->edje_collection_cache = 64;
890 _elm_config->finger_size = 40;
891 _elm_config->fps = 60.0;
892 _elm_config->theme = eina_stringshare_add("default");
893 _elm_config->modules = NULL;
894 _elm_config->tooltip_delay = 1.0;
895 _elm_config->cursor_engine_only = EINA_TRUE;
896 _elm_config->focus_highlight_enable = EINA_FALSE;
897 _elm_config->focus_highlight_animate = EINA_TRUE;
898 _elm_config->toolbar_shrink_mode = 2;
899 _elm_config->fileselector_expand_enable = EINA_FALSE;
900 _elm_config->inwin_dialogs_enable = EINA_FALSE;
901 _elm_config->icon_size = 32;
902 _elm_config->longpress_timeout = 1.0;
903 _elm_config->effect_enable = EINA_TRUE;
904 _elm_config->desktop_entry = EINA_FALSE;
905 _elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
906 _elm_config->password_show_last = EINA_FALSE;
907 _elm_config->password_show_last_timeout = 2.0;
908 _elm_config->glayer_zoom_finger_enable = EINA_TRUE;
909 _elm_config->glayer_zoom_finger_factor = 1.0;
910 _elm_config->glayer_zoom_wheel_factor = 0.05;
911 _elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_finger_size_get() */
912 _elm_config->glayer_rotate_finger_enable = EINA_TRUE;
913 _elm_config->glayer_rotate_angular_tolerance = 2.0; /* 2 DEG */
914 _elm_config->glayer_line_min_length = 1.0; /* 1 times elm_finger_size_get() */
915 _elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_finger_size_get() */
916 _elm_config->glayer_line_angular_tolerance = 20.0; /* 20 DEG */
917 _elm_config->glayer_flick_time_limit_ms = 120; /* ms to finish flick */
918 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
919 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
920 _elm_config->week_start = 1; /* monday */
921 _elm_config->weekend_start = 6; /* saturday */
922 _elm_config->weekend_len = 2;
926 _elm_config_eet_close_error_get(Eet_File *ef,
930 const char *erstr = NULL;
935 case EET_ERROR_WRITE_ERROR:
936 erstr = "An error occurred while saving Elementary's "
937 "settings to disk. The error could not be "
938 "deterimined. The file where the error occurred was: "
939 "%s. This file has been deleted to avoid corrupt data.";
942 case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG:
943 erstr = "Elementary's settings files are too big "
944 "for the file system they are being saved to. "
945 "This error is very strange as the files should "
946 "be extremely small. Please check the settings "
947 "for your home directory. "
948 "The file where the error occurred was: %s ."
949 "This file has been deleted to avoid corrupt data.";
952 case EET_ERROR_WRITE_ERROR_IO_ERROR:
953 erstr = "An output error occurred when writing the settings "
954 "files for Elementary. Your disk is having troubles "
955 "and possibly needs replacement. "
956 "The file where the error occurred was: %s ."
957 "This file has been deleted to avoid corrupt data.";
960 case EET_ERROR_WRITE_ERROR_OUT_OF_SPACE:
961 erstr = "Elementary cannot write its settings file "
962 "because it ran out of space to write the file. "
963 "You have either run out of disk space or have "
964 "gone over your quota limit. "
965 "The file where the error occurred was: %s ."
966 "This file has been deleted to avoid corrupt data.";
969 case EET_ERROR_WRITE_ERROR_FILE_CLOSED:
970 erstr = "Elementary unexpectedly had the settings file "
971 "it was writing closed on it. This is very unusual. "
972 "The file where the error occurred was: %s "
973 "This file has been deleted to avoid corrupt data.";
981 /* delete any partially-written file */
982 ecore_file_unlink(file);
983 return strdup(erstr);
990 _elm_config_profile_save(void)
992 char buf[4096], buf2[4096];
998 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
999 if (len + 1 >= sizeof(buf))
1002 len = _elm_user_dir_snprintf(buf2, sizeof(buf2), "config/profile.cfg.tmp");
1003 if (len + 1 >= sizeof(buf2))
1006 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1010 ok = eet_write(ef, "config", _elm_profile, strlen(_elm_profile), 0);
1014 err = _elm_config_eet_close_error_get(ef, buf2);
1022 ret = ecore_file_mv(buf2, buf);
1025 ERR("Error saving Elementary's configuration file");
1029 ecore_file_unlink(buf2);
1033 ecore_file_unlink(buf2);
1038 _elm_config_save(void)
1040 char buf[4096], buf2[4096];
1046 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", _elm_profile);
1047 if (len + 1 >= sizeof(buf))
1050 ok = ecore_file_mkpath(buf);
1053 ERR("Problem accessing Elementary's user configuration directory: %s",
1058 if (!_elm_config_profile_save())
1064 if (len + sizeof("base.cfg") >= sizeof(buf) - len)
1067 memcpy(buf + len, "base.cfg", sizeof("base.cfg"));
1068 len += sizeof("base.cfg") - 1;
1070 if (len + sizeof(".tmp") >= sizeof(buf))
1073 memcpy(buf2, buf, len);
1074 memcpy(buf2 + len, ".tmp", sizeof(".tmp"));
1076 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1080 ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1);
1084 err = _elm_config_eet_close_error_get(ef, buf2);
1092 ret = ecore_file_mv(buf2, buf);
1095 ERR("Error saving Elementary's configuration file");
1099 ecore_file_unlink(buf2);
1103 ecore_file_unlink(buf2);
1108 _config_update(void)
1112 tcfg = _config_system_load();
1115 /* weird profile or something? We should probably fill
1116 * with hardcoded defaults, or get from default previx */
1119 #define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) {
1120 #define IFCFGELSE } else {
1122 #define COPYVAL(x) do {_elm_config->x = tcfg->x; } while(0)
1123 #define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while(0)
1124 #define COPYSTR(x) COPYPTR(x)
1126 /* we also need to update for property changes in the root window
1127 * if needed, but that will be dependent on new properties added
1128 * with each version */
1131 COPYVAL(longpress_timeout);
1141 /* after updating user config, we must save */
1150 s = getenv("ELM_ENGINE");
1153 if ((!strcasecmp(s, "x11")) ||
1154 (!strcasecmp(s, "x")) ||
1155 (!strcasecmp(s, "software-x11")) ||
1156 (!strcasecmp(s, "software_x11")))
1157 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_X11);
1158 else if ((!strcasecmp(s, "opengl")) ||
1159 (!strcasecmp(s, "gl")) ||
1160 (!strcasecmp(s, "opengl-x11")) ||
1161 (!strcasecmp(s, "opengl_x11")))
1162 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_X11);
1163 else if ((!strcasecmp(s, "x11-8")) ||
1164 (!strcasecmp(s, "x8")) ||
1165 (!strcasecmp(s, "software-8-x11")) ||
1166 (!strcasecmp(s, "software_8_x11")))
1167 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_8_X11);
1168 else if ((!strcasecmp(s, "x11-16")) ||
1169 (!strcasecmp(s, "x16")) ||
1170 (!strcasecmp(s, "software-16-x11")) ||
1171 (!strcasecmp(s, "software_16_x11")))
1172 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_X11);
1174 else if ((!strcasecmp(s, "xrender")) ||
1175 (!strcasecmp(s, "xr")) ||
1176 (!strcasecmp(s, "xrender-x11")) ||
1177 (!strcasecmp(s, "xrender_x11")))
1178 eina_stringshare_replace(&_elm_config->engine, ELM_XRENDER_X11);
1180 else if ((!strcasecmp(s, "fb")) ||
1181 (!strcasecmp(s, "software-fb")) ||
1182 (!strcasecmp(s, "software_fb")))
1183 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB);
1184 else if ((!strcasecmp(s, "directfb")) ||
1185 (!strcasecmp(s, "dfb")))
1186 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_DIRECTFB);
1187 else if ((!strcasecmp(s, "psl1ght")))
1188 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_PSL1GHT);
1189 else if ((!strcasecmp(s, "sdl")) ||
1190 (!strcasecmp(s, "software-sdl")) ||
1191 (!strcasecmp(s, "software_sdl")))
1192 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_SDL);
1193 else if ((!strcasecmp(s, "sdl-16")) ||
1194 (!strcasecmp(s, "software-16-sdl")) ||
1195 (!strcasecmp(s, "software_16_sdl")))
1196 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_SDL);
1197 else if ((!strcasecmp(s, "opengl-sdl")) ||
1198 (!strcasecmp(s, "opengl_sdl")) ||
1199 (!strcasecmp(s, "gl-sdl")) ||
1200 (!strcasecmp(s, "gl_sdl")))
1201 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL);
1202 else if ((!strcasecmp(s, "opengl-cocoa")) ||
1203 (!strcasecmp(s, "opengl_cocoa")) ||
1204 (!strcasecmp(s, "gl-cocoa")) ||
1205 (!strcasecmp(s, "gl_cocoa")))
1206 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_COCOA);
1207 else if ((!strcasecmp(s, "gdi")) ||
1208 (!strcasecmp(s, "software-gdi")) ||
1209 (!strcasecmp(s, "software_gdi")))
1210 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_WIN32);
1211 else if ((!strcasecmp(s, "wince-gdi")) ||
1212 (!strcasecmp(s, "software-16-wince-gdi")) ||
1213 (!strcasecmp(s, "software_16_wince_gdi")))
1214 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_WINCE);
1215 else if (!strcasecmp(s, "buffer"))
1216 eina_stringshare_replace(&_elm_config->engine, ELM_BUFFER);
1217 else if ((!strncmp(s, "shot:", 5)))
1218 eina_stringshare_replace(&_elm_config->engine, s);
1219 else if ((!strcasecmp(s, "ews")))
1220 eina_stringshare_replace(&_elm_config->engine, ELM_EWS);
1221 else if ((!strcasecmp(s, "wayland_shm")))
1222 eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_SHM);
1223 else if ((!strcasecmp(s, "wayland_egl")))
1224 eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_EGL);
1226 ERR("Unknown engine '%s'.", s);
1229 s = getenv("ELM_VSYNC");
1230 if (s) _elm_config->vsync = !!atoi(s);
1232 s = getenv("ELM_THUMBSCROLL_ENABLE");
1233 if (s) _elm_config->thumbscroll_enable = !!atoi(s);
1234 s = getenv("ELM_THUMBSCROLL_THRESHOLD");
1235 if (s) _elm_config->thumbscroll_threshold = atoi(s);
1236 // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
1237 s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
1238 if (s) _elm_config->thumbscroll_momentum_threshold = atof(s);
1239 s = getenv("ELM_THUMBSCROLL_FRICTION");
1240 if (s) _elm_config->thumbscroll_friction = atof(s);
1241 s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
1242 if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
1243 s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
1244 if (s) _elm_config->thumbscroll_bounce_friction = atof(s);
1245 s = getenv("ELM_PAGE_SCROLL_FRICTION");
1246 if (s) _elm_config->page_scroll_friction = atof(s);
1247 s = getenv("ELM_BRING_IN_SCROLL_FRICTION");
1248 if (s) _elm_config->bring_in_scroll_friction = atof(s);
1249 s = getenv("ELM_ZOOM_FRICTION");
1250 if (s) _elm_config->zoom_friction = atof(s);
1251 s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
1261 _elm_config->thumbscroll_border_friction = friction;
1263 s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION");
1273 _elm_config->thumbscroll_sensitivity_friction = friction;
1275 s = getenv("ELM_SCROLL_SMOOTH_TIME_INTERVAL");
1276 if (s) _elm_config->scroll_smooth_time_interval = atof(s);
1277 s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
1278 if (s) _elm_config->scroll_smooth_amount = atof(s);
1279 s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT");
1280 if (s) _elm_config->scroll_smooth_history_weight = atof(s);
1281 s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
1282 if (s) _elm_config->scroll_smooth_future_time = atof(s);
1283 s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
1284 if (s) _elm_config->scroll_smooth_time_window = atof(s);
1285 s = getenv("ELM_THEME");
1286 if (s) eina_stringshare_replace(&_elm_config->theme, s);
1288 s = getenv("ELM_FONT_HINTING");
1291 if (!strcasecmp(s, "none")) _elm_config->font_hinting = 0;
1292 else if (!strcasecmp(s, "auto"))
1293 _elm_config->font_hinting = 1;
1294 else if (!strcasecmp(s, "bytecode"))
1295 _elm_config->font_hinting = 2;
1298 s = getenv("ELM_FONT_PATH");
1304 EINA_LIST_FREE(_elm_config->font_dirs, p)
1306 eina_stringshare_del(p);
1309 buf2 = alloca(strlen(s) + 1);
1314 if ((*p == ':') || (*p == 0))
1319 strncpy(buf2, pp, len);
1321 _elm_config->font_dirs =
1322 eina_list_append(_elm_config->font_dirs,
1323 eina_stringshare_add(buf2));
1336 s = getenv("ELM_IMAGE_CACHE");
1337 if (s) _elm_config->image_cache = atoi(s);
1339 s = getenv("ELM_FONT_CACHE");
1340 if (s) _elm_config->font_cache = atoi(s);
1342 s = getenv("ELM_SCALE");
1343 if (s) _elm_config->scale = atof(s);
1345 s = getenv("ELM_FINGER_SIZE");
1346 if (s) _elm_config->finger_size = atoi(s);
1348 s = getenv("ELM_PASSWORD_SHOW_LAST");
1349 if (s) _elm_config->password_show_last = !!atoi(s);
1351 s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT");
1354 double pw_show_last_timeout = atof(s);
1355 if (pw_show_last_timeout >= 0.0)
1356 _elm_config->password_show_last_timeout = pw_show_last_timeout;
1359 s = getenv("ELM_FPS");
1360 if (s) _elm_config->fps = atof(s);
1361 if (_elm_config->fps < 1.0) _elm_config->fps = 1.0;
1363 s = getenv("ELM_MODULES");
1364 if (s) eina_stringshare_replace(&_elm_config->modules, s);
1366 /* Get RTL orientation from system */
1367 setlocale(LC_ALL, "");
1368 bindtextdomain(PACKAGE, LOCALE_DIR);
1369 _elm_config->is_mirrored = !strcmp(E_("default:LTR"), "default:RTL");
1371 s = getenv("ELM_TOOLTIP_DELAY");
1374 double delay = atof(s);
1376 _elm_config->tooltip_delay = delay;
1379 s = getenv("ELM_CURSOR_ENGINE_ONLY");
1380 if (s) _elm_config->cursor_engine_only = !!atoi(s);
1382 s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE");
1383 if (s) _elm_config->focus_highlight_enable = !!atoi(s);
1385 s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE");
1386 if (s) _elm_config->focus_highlight_animate = !!atoi(s);
1388 s = getenv("ELM_TOOLBAR_SHRINK_MODE");
1389 if (s) _elm_config->toolbar_shrink_mode = atoi(s);
1391 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE");
1392 if (s) _elm_config->fileselector_expand_enable = !!atoi(s);
1394 s = getenv("ELM_INWIN_DIALOGS_ENABLE");
1395 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s);
1397 s = getenv("ELM_ICON_SIZE");
1398 if (s) _elm_config->icon_size = atoi(s);
1400 s = getenv("ELM_LONGPRESS_TIMEOUT");
1401 if (s) _elm_config->longpress_timeout = atof(s);
1402 if (_elm_config->longpress_timeout < 0.0)
1403 _elm_config->longpress_timeout = 0.0;
1405 s = getenv("ELM_EFFECT_ENABLE");
1406 if (s) _elm_config->effect_enable = !!atoi(s);
1408 s = getenv("ELM_DESKTOP_ENTRY");
1409 if (s) _elm_config->desktop_entry = !!atoi(s);
1410 s = getenv("ELM_ACCESS_MODE");
1411 if (s) _elm_config->access_mode = ELM_ACCESS_MODE_ON;
1415 elm_config_mirrored_get(void)
1417 return _elm_config->is_mirrored;
1421 elm_config_mirrored_set(Eina_Bool mirrored)
1423 _elm_config->is_mirrored = mirrored;
1428 elm_config_cursor_engine_only_get(void)
1430 return _elm_config->cursor_engine_only;
1434 elm_config_cursor_engine_only_set(Eina_Bool engine_only)
1436 engine_only = !!engine_only;
1437 _elm_config->cursor_engine_only = engine_only;
1440 EINA_DEPRECATED EAPI double
1441 elm_tooltip_delay_get(void)
1443 return elm_config_tooltip_delay_get();
1446 EINA_DEPRECATED EAPI Eina_Bool
1447 elm_tooltip_delay_set(double delay)
1449 elm_config_tooltip_delay_set(delay);
1454 elm_config_tooltip_delay_get(void)
1456 return _elm_config->tooltip_delay;
1460 elm_config_tooltip_delay_set(double delay)
1462 if (delay < 0.0) return;
1463 _elm_config->tooltip_delay = delay;
1469 return elm_config_scale_get();
1473 elm_config_scale_get(void)
1475 return _elm_config->scale;
1479 elm_scale_set(double scale)
1481 elm_config_scale_set(scale);
1485 elm_config_scale_set(double scale)
1487 if (_elm_config->scale == scale) return;
1488 _elm_config->scale = scale;
1493 elm_config_password_show_last_get(void)
1495 return _elm_config->password_show_last;
1499 elm_config_password_show_last_set(Eina_Bool password_show_last)
1501 if (_elm_config->password_show_last == password_show_last) return;
1502 _elm_config->password_show_last = password_show_last;
1503 edje_password_show_last_set(_elm_config->password_show_last);
1507 elm_config_password_show_last_timeout_get(void)
1509 return _elm_config->password_show_last_timeout;
1513 elm_config_password_show_last_timeout_set(double password_show_last_timeout)
1515 if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
1516 _elm_config->password_show_last_timeout = password_show_last_timeout;
1517 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1521 elm_config_save(void)
1523 return _elm_config_save();
1527 elm_config_reload(void)
1529 _elm_config_reload();
1533 elm_config_profile_get(void)
1535 return _elm_config_current_profile_get();
1539 elm_config_profile_dir_get(const char *profile,
1542 return _elm_config_profile_dir_get(profile, is_user);
1546 elm_config_profile_dir_free(const char *p_dir)
1548 free((void *)p_dir);
1552 elm_config_profile_list_get(void)
1554 return _elm_config_profiles_list();
1558 elm_config_profile_list_free(Eina_List *l)
1562 EINA_LIST_FREE(l, dir)
1563 eina_stringshare_del(dir);
1567 elm_config_profile_set(const char *profile)
1569 EINA_SAFETY_ON_NULL_RETURN(profile);
1570 _elm_config_profile_set(profile);
1574 elm_config_engine_get(void)
1576 return _elm_config->engine;
1580 elm_config_engine_set(const char *engine)
1582 EINA_SAFETY_ON_NULL_RETURN(engine);
1584 _elm_config_engine_set(engine);
1588 elm_config_text_classes_list_get(void)
1590 return _elm_config_text_classes_get();
1594 elm_config_text_classes_list_free(Eina_List *list)
1596 _elm_config_text_classes_free(list);
1599 EAPI const Eina_List *
1600 elm_config_font_overlay_list_get(void)
1602 return _elm_config_font_overlays_list();
1606 elm_config_font_overlay_set(const char *text_class,
1608 Evas_Font_Size size)
1610 EINA_SAFETY_ON_NULL_RETURN(text_class);
1611 _elm_config_font_overlay_set(text_class, font, size);
1615 elm_config_font_overlay_unset(const char *text_class)
1617 EINA_SAFETY_ON_NULL_RETURN(text_class);
1618 _elm_config_font_overlay_remove(text_class);
1622 elm_config_font_overlay_apply(void)
1624 _elm_config_font_overlay_apply();
1626 // WRAPPER:: will be removed soon.
1628 elm_finger_size_get(void)
1630 return elm_config_finger_size_get();
1634 elm_config_finger_size_get(void)
1636 return _elm_config->finger_size;
1639 // WRAPPER:: will be removed soon.
1641 elm_finger_size_set(Evas_Coord size)
1643 elm_config_finger_size_set(size);
1647 elm_config_finger_size_set(Evas_Coord size)
1649 if (_elm_config->finger_size == size) return;
1650 _elm_config->finger_size = size;
1655 elm_config_cache_flush_interval_get(void)
1657 return _elm_config->cache_flush_poll_interval;
1661 elm_config_cache_flush_interval_set(int size)
1663 if (_elm_config->cache_flush_poll_interval == size) return;
1664 _elm_config->cache_flush_poll_interval = size;
1670 elm_config_cache_flush_enabled_get(void)
1672 return _elm_config->cache_flush_enable;
1676 elm_config_cache_flush_enabled_set(Eina_Bool enabled)
1678 enabled = !!enabled;
1679 if (_elm_config->cache_flush_enable == enabled) return;
1680 _elm_config->cache_flush_enable = enabled;
1685 EINA_DEPRECATED EAPI int
1686 elm_font_cache_get(void)
1688 return elm_config_cache_font_cache_size_get();
1692 elm_config_cache_font_cache_size_get(void)
1694 return _elm_config->font_cache;
1697 EINA_DEPRECATED EAPI void
1698 elm_font_cache_set(int size)
1700 elm_config_cache_font_cache_size_set(size);
1704 elm_config_cache_font_cache_size_set(int size)
1706 if (_elm_config->font_cache == size) return;
1707 _elm_config->font_cache = size;
1712 EINA_DEPRECATED EAPI int
1713 elm_image_cache_get(void)
1715 return elm_config_cache_image_cache_size_get();
1719 elm_config_cache_image_cache_size_get(void)
1721 return _elm_config->image_cache;
1724 EINA_DEPRECATED EAPI void
1725 elm_image_cache_set(int size)
1727 elm_config_cache_image_cache_size_set(size);
1731 elm_config_cache_image_cache_size_set(int size)
1733 if (_elm_config->image_cache == size) return;
1734 _elm_config->image_cache = size;
1739 EINA_DEPRECATED EAPI int
1740 elm_edje_file_cache_get(void)
1742 return elm_config_cache_edje_file_cache_size_get();
1746 elm_config_cache_edje_file_cache_size_get()
1748 return _elm_config->edje_cache;
1751 EINA_DEPRECATED EAPI void
1752 elm_edje_file_cache_set(int size)
1754 elm_config_cache_edje_file_cache_size_set(size);
1758 elm_config_cache_edje_file_cache_size_set(int size)
1760 if (_elm_config->edje_cache == size) return;
1761 _elm_config->edje_cache = size;
1766 EINA_DEPRECATED EAPI int
1767 elm_edje_collection_cache_get(void)
1769 return elm_config_cache_edje_collection_cache_size_get();
1773 elm_config_cache_edje_collection_cache_size_get(void)
1775 return _elm_config->edje_collection_cache;
1778 EINA_DEPRECATED EAPI void
1779 elm_edje_collection_cache_set(int size)
1781 elm_config_cache_edje_collection_cache_size_set(size);
1785 elm_config_cache_edje_collection_cache_size_set(int size)
1787 if (_elm_config->edje_collection_cache == size) return;
1788 _elm_config->edje_collection_cache = size;
1794 elm_config_focus_highlight_enabled_get(void)
1796 return _elm_config->focus_highlight_enable;
1800 elm_config_focus_highlight_enabled_set(Eina_Bool enable)
1802 _elm_config->focus_highlight_enable = !!enable;
1806 elm_config_focus_highlight_animate_get(void)
1808 return _elm_config->focus_highlight_animate;
1812 elm_config_focus_highlight_animate_set(Eina_Bool animate)
1814 _elm_config->focus_highlight_animate = !!animate;
1818 elm_config_scroll_bounce_enabled_get(void)
1820 return _elm_config->thumbscroll_bounce_enable;
1824 elm_config_scroll_bounce_enabled_set(Eina_Bool enabled)
1826 _elm_config->thumbscroll_bounce_enable = enabled;
1830 elm_config_scroll_bounce_friction_get(void)
1832 return _elm_config->thumbscroll_bounce_friction;
1836 elm_config_scroll_bounce_friction_set(double friction)
1838 _elm_config->thumbscroll_bounce_friction = friction;
1842 elm_config_scroll_page_scroll_friction_get(void)
1844 return _elm_config->page_scroll_friction;
1848 elm_config_scroll_page_scroll_friction_set(double friction)
1850 _elm_config->page_scroll_friction = friction;
1854 elm_config_scroll_bring_in_scroll_friction_get(void)
1856 return _elm_config->bring_in_scroll_friction;
1860 elm_config_scroll_bring_in_scroll_friction_set(double friction)
1862 _elm_config->bring_in_scroll_friction = friction;
1866 elm_config_scroll_zoom_friction_get(void)
1868 return _elm_config->zoom_friction;
1872 elm_config_scroll_zoom_friction_set(double friction)
1874 _elm_config->zoom_friction = friction;
1878 elm_config_scroll_thumbscroll_enabled_get(void)
1880 return _elm_config->thumbscroll_enable;
1884 elm_config_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
1886 _elm_config->thumbscroll_enable = enabled;
1890 elm_config_scroll_thumbscroll_threshold_get(void)
1892 return _elm_config->thumbscroll_threshold;
1896 elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold)
1898 _elm_config->thumbscroll_threshold = threshold;
1902 elm_config_scroll_thumbscroll_momentum_threshold_get(void)
1904 return _elm_config->thumbscroll_momentum_threshold;
1908 elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold)
1910 _elm_config->thumbscroll_momentum_threshold = threshold;
1914 elm_config_scroll_thumbscroll_friction_get(void)
1916 return _elm_config->thumbscroll_friction;
1920 elm_config_scroll_thumbscroll_friction_set(double friction)
1922 _elm_config->thumbscroll_friction = friction;
1926 elm_config_scroll_thumbscroll_border_friction_get(void)
1928 return _elm_config->thumbscroll_border_friction;
1932 elm_config_scroll_thumbscroll_border_friction_set(double friction)
1934 if (friction < 0.0) friction = 0.0;
1935 if (friction > 1.0) friction = 1.0;
1936 _elm_config->thumbscroll_friction = friction;
1940 elm_config_scroll_thumbscroll_sensitivity_friction_get(void)
1942 return _elm_config->thumbscroll_sensitivity_friction;
1946 elm_config_scroll_thumbscroll_sensitivity_friction_set(double friction)
1948 if (friction < 0.1) friction = 0.1;
1949 if (friction > 1.0) friction = 1.0;
1950 _elm_config->thumbscroll_friction = friction;
1954 elm_config_longpress_timeout_set(double longpress_timeout)
1956 _elm_config->longpress_timeout = longpress_timeout;
1960 elm_config_longpress_timeout_get(void)
1962 return _elm_config->longpress_timeout;
1966 elm_config_all_flush(void)
1968 #ifdef HAVE_ELEMENTARY_X
1969 if (_prop_all_update_timer) ecore_timer_del(_prop_all_update_timer);
1970 _prop_all_update_timer = ecore_timer_add(0.1, _prop_all_update_cb, NULL);
1978 const char *cur_dom = textdomain(NULL);
1979 const char *trans_comment = gettext("");
1980 const char *msg_locale = setlocale(LC_MESSAGES, NULL);
1982 /* Same concept as what glib does:
1983 * We shouldn't translate if there are no translations for the
1984 * application in the current locale + domain. (Unless locale is
1985 * en_/C where translating only parts of the interface make some
1988 _elm_config->translate = !(strcmp (cur_dom, "messages") &&
1989 !*trans_comment && strncmp (msg_locale, "en_", 3) &&
1990 strcmp (msg_locale, "C"));
1995 _elm_config_init(void)
1997 if (!ELM_EVENT_CONFIG_ALL_CHANGED)
1998 ELM_EVENT_CONFIG_ALL_CHANGED = ecore_event_type_new();
2000 _profile_fetch_from_conf();
2002 if (_elm_preferred_engine) eina_stringshare_del(_elm_preferred_engine);
2003 if (_elm_config->engine)
2004 _elm_preferred_engine = eina_stringshare_add(_elm_config->engine);
2006 _elm_preferred_engine = NULL;
2007 _translation_init();
2010 _elm_config_font_overlay_apply();
2015 _elm_config_sub_shutdown(void)
2017 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2018 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2019 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2020 ENGINE_COMPARE(ELM_XRENDER_X11) ||
2021 ENGINE_COMPARE(ELM_OPENGL_X11) ||
2022 ENGINE_COMPARE(ELM_OPENGL_COCOA))
2023 #undef ENGINE_COMPARE
2025 #ifdef HAVE_ELEMENTARY_X
2026 ecore_x_disconnect();
2032 _elm_config_sub_init(void)
2034 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2035 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2036 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2037 ENGINE_COMPARE(ELM_XRENDER_X11) ||
2038 ENGINE_COMPARE(ELM_OPENGL_X11) ||
2039 ENGINE_COMPARE(ELM_OPENGL_COCOA))
2040 #undef ENGINE_COMPARE
2042 #ifdef HAVE_ELEMENTARY_X
2043 if (!ecore_x_init(NULL))
2045 ERR("Cannot connect to X11 display. check $DISPLAY variable");
2048 _root_1st = ecore_x_window_root_first_get();
2050 if (!ecore_x_screen_is_composited(0))
2051 _elm_config->compositing = 0;
2053 ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
2054 ecore_x_event_mask_set(_root_1st,
2055 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
2056 _prop_change_handler = ecore_event_handler_add
2057 (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
2058 if (!getenv("ELM_PROFILE"))
2062 s = ecore_x_window_prop_string_get(_root_1st,
2063 _atom[ATOM_E_PROFILE]);
2070 if (strcmp(_elm_profile, s)) changed = 1;
2074 if (changed) _prop_config_get();
2079 _config_sub_apply();
2083 _elm_config_reload(void)
2088 _elm_config_font_overlay_apply();
2094 _elm_config_engine_set(const char *engine)
2096 if (_elm_config->engine && strcmp(_elm_config->engine, engine))
2097 eina_stringshare_del(_elm_config->engine);
2099 _elm_config->engine = eina_stringshare_add(engine);
2103 elm_config_preferred_engine_get(void)
2105 return _elm_preferred_engine;
2109 elm_config_preferred_engine_set(const char *engine)
2112 eina_stringshare_replace(&(_elm_preferred_engine), engine);
2115 if (_elm_preferred_engine) eina_stringshare_del(_elm_preferred_engine);
2116 _elm_preferred_engine = eina_stringshare_add(_elm_config->engine);
2121 _elm_config_profile_set(const char *profile)
2123 Eina_Bool changed = EINA_FALSE;
2127 if (strcmp(_elm_profile, profile))
2132 _elm_profile = strdup(profile);
2139 _elm_config_font_overlay_apply();
2146 _elm_config_shutdown(void)
2148 #ifdef HAVE_ELEMENTARY_X
2149 if (_prop_all_update_timer)
2151 ecore_timer_del(_prop_all_update_timer);
2152 _prop_all_update_timer = NULL;
2153 _prop_all_update_cb(NULL);
2155 if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
2156 _prop_change_delay_timer = NULL;
2159 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2160 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2161 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2162 ENGINE_COMPARE(ELM_XRENDER_X11) ||
2163 ENGINE_COMPARE(ELM_OPENGL_X11))
2164 #undef ENGINE_COMPARE
2166 #ifdef HAVE_ELEMENTARY_X
2167 ecore_event_handler_del(_prop_change_handler);
2168 _prop_change_handler = NULL;
2172 if (_elm_preferred_engine)
2174 eina_stringshare_del(_elm_preferred_engine);
2175 _elm_preferred_engine = NULL;
2180 _elm_profile = NULL;