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;
20 const char *_elm_preferred_engine = NULL;
21 >>>>>>> remotes/origin/upstream
23 static Ecore_Poller *_elm_cache_flush_poller = NULL;
25 const char *_elm_engines[] = {
34 "software_16_wince_gdi",
47 /* whenever you want to add a new text class support into Elementary,
48 declare it both here and in the (default) theme */
49 static const Elm_Text_Class _elm_text_classes[] = {
50 {"button", "Button Labels"},
51 {"label", "Text Labels"},
52 {"entry", "Text Entries"},
53 {"title_bar", "Title Bar"},
54 {"list_item", "List Items"},
55 {"grid_item", "Grid Items"},
56 {"toolbar_item", "Toolbar Items"},
57 {"menu_item", "Menu Items"},
61 static void _desc_init(void);
62 static void _desc_shutdown(void);
63 static void _profile_fetch_from_conf(void);
64 static void _config_free(void);
65 static void _config_apply(void);
66 static Elm_Config *_config_user_load(void);
67 static Elm_Config *_config_system_load(void);
68 static void _config_load(void);
69 static void _config_update(void);
70 static void _env_get(void);
71 static size_t _elm_data_dir_snprintf(char *dst,
75 static size_t _elm_user_dir_snprintf(char *dst,
80 #define ELM_CONFIG_VAL(edd, type, member, dtype) \
81 EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
82 #define ELM_CONFIG_LIST(edd, type, member, eddtype) \
83 EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype)
85 #ifdef HAVE_ELEMENTARY_X
86 static Ecore_Event_Handler *_prop_change_handler = NULL;
87 static Ecore_Timer *_prop_all_update_timer = NULL;
88 static Ecore_Timer *_prop_change_delay_timer = NULL;
89 static Ecore_X_Window _root_1st = 0;
91 static Ecore_X_Atom _atom[ATOM_COUNT];
92 static Ecore_X_Atom _atom_config = 0;
93 static const char *_atom_names[ATOM_COUNT] =
98 #define ATOM_E_PROFILE 0
99 #define ATOM_E_CONFIG 1
101 static Eina_Bool _prop_all_update_cb(void *data __UNUSED__);
102 static Eina_Bool _prop_config_get(void);
103 static void _prop_config_set(void);
104 static Eina_Bool _prop_change(void *data __UNUSED__,
105 int ev_type __UNUSED__,
109 _prop_all_update_cb(void *data __UNUSED__)
112 ecore_x_window_prop_string_set(_root_1st, _atom[ATOM_E_PROFILE],
114 _prop_all_update_timer = NULL;
119 _prop_config_get(void)
124 unsigned char *data = NULL;
125 Elm_Config *config_data;
127 snprintf(buf, sizeof(buf), "ELM_CONFIG_%s", _elm_profile);
128 atom = ecore_x_atom_get(buf);
130 if (!ecore_x_window_prop_property_get(_root_1st,
131 atom, _atom[ATOM_E_CONFIG],
134 if (!ecore_x_window_prop_property_get(_root_1st,
135 _atom[ATOM_E_CONFIG],
136 _atom[ATOM_E_CONFIG],
140 _atom_config = _atom[ATOM_E_CONFIG];
149 config_data = eet_data_descriptor_decode(_config_edd, data, size);
151 if (!config_data) return EINA_FALSE;
153 /* What do we do on version mismatch when someone changes the
154 * config in the rootwindow? */
155 /* Most obvious case, new version and we are still linked to
156 * whatever was there before, we just ignore until user restarts us */
157 if (config_data->config_version > ELM_CONFIG_VERSION)
159 /* What in the case the version is older? Do we even support those
160 * cases or we only check for equality above? */
163 _elm_config = config_data;
165 _elm_config_font_overlay_apply();
168 ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
173 _prop_config_set(void)
175 unsigned char *config_data = NULL;
178 config_data = eet_data_descriptor_encode(_config_edd, _elm_config, &size);
184 snprintf(buf, sizeof(buf), "ELM_CONFIG_%s", _elm_profile);
185 atom = ecore_x_atom_get(buf);
188 ecore_x_window_prop_property_set(_root_1st, _atom_config,
189 _atom[ATOM_E_CONFIG], 8,
196 _prop_change_delay_cb(void *data __UNUSED__)
200 s = ecore_x_window_prop_string_get(_root_1st, _atom[ATOM_E_PROFILE]);
203 if (_elm_profile) free(_elm_profile);
207 _prop_change_delay_timer = NULL;
212 _prop_change(void *data __UNUSED__,
213 int ev_type __UNUSED__,
216 Ecore_X_Event_Window_Property *event = ev;
218 if (event->win == _root_1st)
220 if (event->atom == _atom[ATOM_E_PROFILE])
222 if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
223 _prop_change_delay_timer = ecore_timer_add(0.1, _prop_change_delay_cb, NULL);
225 else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
226 (event->atom == _atom[ATOM_E_CONFIG]))
228 if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
229 _prop_change_delay_timer = ecore_timer_add(0.1, _prop_change_delay_cb, NULL);
232 return ECORE_CALLBACK_PASS_ON;
240 Eet_Data_Descriptor_Class eddc;
242 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config);
243 eddc.func.str_direct_alloc = NULL;
244 eddc.func.str_direct_free = NULL;
246 _config_edd = eet_data_descriptor_file_new(&eddc);
249 printf("EEEK! eet_data_descriptor_file_new() failed\n");
253 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
254 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Font_Overlay);
255 eddc.func.str_direct_alloc = NULL;
256 eddc.func.str_direct_free = NULL;
258 _config_font_overlay_edd = eet_data_descriptor_stream_new(&eddc);
259 if (!_config_font_overlay_edd)
261 printf("EEEK! eet_data_descriptor_stream_new() failed\n");
262 eet_data_descriptor_free(_config_edd);
265 #define T_INT EET_T_INT
266 #define T_DOUBLE EET_T_DOUBLE
267 #define T_STRING EET_T_STRING
268 #define T_UCHAR EET_T_UCHAR
270 #define T Elm_Font_Overlay
271 #define D _config_font_overlay_edd
272 ELM_CONFIG_VAL(D, T, text_class, EET_T_STRING);
273 ELM_CONFIG_VAL(D, T, font, EET_T_STRING);
274 ELM_CONFIG_VAL(D, T, size, EET_T_INT);
279 #define D _config_edd
280 ELM_CONFIG_VAL(D, T, config_version, T_INT);
281 ELM_CONFIG_VAL(D, T, engine, T_STRING);
282 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
283 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
284 ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
285 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
286 ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
287 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
288 ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
289 ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
290 ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
291 ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
292 ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
293 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
295 ELM_CONFIG_VAL(D, T, scroll_smooth_time_interval, T_DOUBLE);
297 >>>>>>> remotes/origin/upstream
298 ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
299 ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
300 ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE);
301 ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
302 ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
303 ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
304 ELM_CONFIG_VAL(D, T, compositing, T_INT);
305 /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
306 ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd);
307 ELM_CONFIG_VAL(D, T, font_hinting, T_INT);
308 ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT);
309 ELM_CONFIG_VAL(D, T, cache_flush_enable, T_UCHAR);
310 ELM_CONFIG_VAL(D, T, image_cache, T_INT);
311 ELM_CONFIG_VAL(D, T, font_cache, T_INT);
312 ELM_CONFIG_VAL(D, T, edje_cache, T_INT);
313 ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT);
314 ELM_CONFIG_VAL(D, T, finger_size, T_INT);
315 ELM_CONFIG_VAL(D, T, fps, T_DOUBLE);
316 ELM_CONFIG_VAL(D, T, theme, T_STRING);
317 ELM_CONFIG_VAL(D, T, modules, T_STRING);
318 ELM_CONFIG_VAL(D, T, tooltip_delay, T_DOUBLE);
319 ELM_CONFIG_VAL(D, T, cursor_engine_only, T_UCHAR);
320 ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR);
321 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
322 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
323 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
324 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR);
325 ELM_CONFIG_VAL(D, T, icon_size, T_INT);
326 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
327 ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR);
328 ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR);
329 ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR);
330 ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE);
331 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_enable, T_UCHAR);
332 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_factor, T_DOUBLE);
333 ELM_CONFIG_VAL(D, T, glayer_zoom_wheel_factor, T_DOUBLE);
334 ELM_CONFIG_VAL(D, T, glayer_zoom_distance_tolerance, T_DOUBLE);
335 ELM_CONFIG_VAL(D, T, glayer_rotate_finger_enable, T_UCHAR);
336 ELM_CONFIG_VAL(D, T, glayer_rotate_angular_tolerance, T_DOUBLE);
337 ELM_CONFIG_VAL(D, T, glayer_line_min_length, T_DOUBLE);
338 ELM_CONFIG_VAL(D, T, glayer_line_distance_tolerance, T_DOUBLE);
339 ELM_CONFIG_VAL(D, T, glayer_line_angular_tolerance, T_DOUBLE);
340 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
341 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
342 ELM_CONFIG_VAL(D, T, access_mode, T_INT);
343 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
346 ELM_CONFIG_VAL(D, T, week_start, T_INT);
347 ELM_CONFIG_VAL(D, T, weekend_start, T_INT);
348 ELM_CONFIG_VAL(D, T, weekend_len, T_INT);
349 >>>>>>> remotes/origin/upstream
363 eet_data_descriptor_free(_config_edd);
367 if (_config_font_overlay_edd)
369 eet_data_descriptor_free(_config_font_overlay_edd);
370 _config_font_overlay_edd = NULL;
375 _sort_files_cb(const void *f1,
378 return strcmp(f1, f2);
382 _elm_config_current_profile_get(void)
388 _elm_data_dir_snprintf(char *dst,
393 size_t data_dir_len, off;
396 data_dir_len = eina_strlcpy(dst, _elm_data_dir, size);
398 off = data_dir_len + 1;
403 dst[data_dir_len] = '/';
405 off = off + vsnprintf(dst + off, size - off, fmt, ap);
413 _elm_user_dir_snprintf(char *dst,
419 size_t user_dir_len, off;
423 home = evil_homedir_get();
425 home = getenv("HOME");
430 user_dir_len = eina_str_join_len(dst, size, '/', home, strlen(home),
431 ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
433 off = user_dir_len + 1;
438 dst[user_dir_len] = '/';
440 off = off + vsnprintf(dst + off, size - off, fmt, ap);
448 _elm_config_profile_dir_get(const char *prof,
456 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof);
458 if (ecore_file_is_dir(buf))
464 snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof);
466 if (ecore_file_is_dir(buf))
473 _elm_config_font_overlays_list(void)
475 return _elm_config->font_overlays;
479 _elm_config_font_overlay_set(const char *text_class,
483 Elm_Font_Overlay *efd;
486 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
488 if (strcmp(efd->text_class, text_class))
491 if (efd->font) eina_stringshare_del(efd->font);
492 efd->font = eina_stringshare_add(font);
494 _elm_config->font_overlays =
495 eina_list_promote_list(_elm_config->font_overlays, l);
499 /* the text class doesn't exist */
500 efd = calloc(1, sizeof(Elm_Font_Overlay));
501 efd->text_class = eina_stringshare_add(text_class);
502 efd->font = eina_stringshare_add(font);
505 _elm_config->font_overlays = eina_list_prepend(_elm_config->font_overlays,
510 _elm_config_font_overlay_remove(const char *text_class)
512 Elm_Font_Overlay *efd;
515 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
517 if (strcmp(efd->text_class, text_class))
520 _elm_config->font_overlays =
521 eina_list_remove_list(_elm_config->font_overlays, l);
522 if (efd->text_class) eina_stringshare_del(efd->text_class);
523 if (efd->font) eina_stringshare_del(efd->font);
531 _elm_config_font_overlay_apply(void)
533 Elm_Font_Overlay *efd;
537 for (i = 0; _elm_text_classes[i].desc; i++)
538 edje_text_class_del(_elm_text_classes[i].name);
540 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
541 edje_text_class_set(efd->text_class, efd->font, efd->size);
545 _elm_config_text_classes_get(void)
547 Eina_List *ret = NULL;
550 for (i = 0; _elm_text_classes[i].desc; i++)
553 tc = malloc(sizeof(*tc));
557 >>>>>>> remotes/origin/upstream
559 *tc = _elm_text_classes[i];
561 ret = eina_list_append(ret, tc);
568 _elm_config_text_classes_free(Eina_List *l)
572 EINA_LIST_FREE(l, tc)
577 _elm_config_profiles_list(void)
580 const Eina_File_Direct_Info *info;
582 Eina_File_Direct_Info *info;
583 >>>>>>> remotes/origin/upstream
584 Eina_List *flist = NULL;
585 Eina_Iterator *file_it;
590 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config");
592 file_it = eina_file_direct_ls(buf);
599 len = sizeof(buf) - len;
601 EINA_ITERATOR_FOREACH(file_it, info)
607 if (eina_file_statat(eina_iterator_container_get(file_it), info, &st))
612 >>>>>>> remotes/origin/upstream
613 if (info->name_length >= len)
616 if (info->type == EINA_FILE_DIR)
619 eina_list_sorted_insert(flist, _sort_files_cb,
620 eina_stringshare_add(info->path +
625 eina_iterator_free(file_it);
628 len = eina_str_join_len(buf, sizeof(buf), '/', _elm_data_dir,
629 strlen(_elm_data_dir), "config",
630 sizeof("config") - 1);
632 file_it = eina_file_direct_ls(buf);
639 len = sizeof(buf) - len;
640 EINA_ITERATOR_FOREACH(file_it, info)
642 if (info->name_length >= len)
652 EINA_LIST_FOREACH(flist, l, tmp)
653 if (!strcmp(info->path + info->name_start, tmp))
658 eina_list_sorted_insert(flist, _sort_files_cb,
659 eina_stringshare_add(info->path +
668 eina_iterator_free(file_it);
672 EINA_LIST_FREE(flist, dir)
673 eina_stringshare_del(dir);
679 _profile_fetch_from_conf(void)
681 char buf[PATH_MAX], *p, *s;
685 _elm_profile = strdup("default");
687 // if env var - use profile without question
688 s = getenv("ELM_PROFILE");
692 _elm_profile = strdup(s);
697 _elm_user_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;
716 _elm_data_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
717 ef = eet_open(buf, EET_FILE_MODE_READ);
720 p = eet_read(ef, "config", &len);
724 _elm_profile = malloc(len + 1);
725 memcpy(_elm_profile, p, len);
726 _elm_profile[len] = 0;
736 Elm_Font_Overlay *fo;
739 if (!_elm_config) return;
740 EINA_LIST_FREE(_elm_config->font_dirs, fontdir)
742 eina_stringshare_del(fontdir);
744 if (_elm_config->engine) eina_stringshare_del(_elm_config->engine);
745 EINA_LIST_FREE(_elm_config->font_overlays, fo)
747 if (fo->text_class) eina_stringshare_del(fo->text_class);
748 if (fo->font) eina_stringshare_del(fo->font);
751 if (_elm_config->theme) eina_stringshare_del(_elm_config->theme);
752 if (_elm_config->modules) eina_stringshare_del(_elm_config->modules);
760 _elm_theme_parse(NULL, _elm_config->theme);
761 ecore_animator_frametime_set(1.0 / _elm_config->fps);
765 _config_sub_apply(void)
767 edje_frametime_set(1.0 / _elm_config->fps);
768 edje_scale_set(_elm_config->scale);
769 edje_password_show_last_set(_elm_config->password_show_last);
770 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
771 if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
775 _elm_cache_flush_cb(void *data __UNUSED__)
780 elm_cache_all_flush();
781 >>>>>>> remotes/origin/upstream
782 return ECORE_CALLBACK_RENEW;
785 /* kind of abusing this call right now -- shared between all of those
786 * properties -- but they are not meant to be called that periodically
797 elm_cache_all_flush();
798 >>>>>>> remotes/origin/upstream
800 EINA_LIST_FOREACH(_elm_win_list, l, win)
802 Evas *e = evas_object_evas_get(win);
803 evas_image_cache_set(e, _elm_config->image_cache * 1024);
804 evas_font_cache_set(e, _elm_config->font_cache * 1024);
806 edje_file_cache_set(_elm_config->edje_cache);
807 edje_collection_cache_set(_elm_config->edje_collection_cache);
809 if (_elm_cache_flush_poller)
811 ecore_poller_del(_elm_cache_flush_poller);
812 _elm_cache_flush_poller = NULL;
814 if (_elm_config->cache_flush_enable)
816 if (_elm_config->cache_flush_poll_interval > 0)
818 _elm_cache_flush_poller =
819 ecore_poller_add(ECORE_POLLER_CORE,
820 _elm_config->cache_flush_poll_interval,
821 _elm_cache_flush_cb, NULL);
827 _config_user_load(void)
829 Elm_Config *cfg = NULL;
833 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
836 ef = eet_open(buf, EET_FILE_MODE_READ);
839 cfg = eet_data_read(ef, _config_edd, "config");
846 _config_system_load(void)
848 Elm_Config *cfg = NULL;
852 _elm_data_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
855 ef = eet_open(buf, EET_FILE_MODE_READ);
858 cfg = eet_data_read(ef, _config_edd, "config");
867 _elm_config = _config_user_load();
870 if (_elm_config->config_version < ELM_CONFIG_VERSION)
875 /* no user config, fallback for system. No need to check version for
876 * this one, if it's not the right one, someone screwed up at the time
877 * of installing it */
878 _elm_config = _config_system_load();
879 if (_elm_config) return;
880 /* FIXME: config load could have failed because of a non-existent
881 * profile. Fallback to default before moving on */
883 // config load fail - defaults
885 /* XXX: do these make sense? Only if it's valid to install the lib
886 * without the config, but do we want that? */
888 // why are these here? well if they are, it means you can make a gui
889 // config recovery app i guess...
890 >>>>>>> remotes/origin/upstream
891 _elm_config = ELM_NEW(Elm_Config);
892 _elm_config->config_version = ELM_CONFIG_VERSION;
893 _elm_config->engine = eina_stringshare_add("software_x11");
894 _elm_config->vsync = 0;
895 _elm_config->thumbscroll_enable = EINA_TRUE;
896 _elm_config->thumbscroll_threshold = 24;
897 _elm_config->thumbscroll_momentum_threshold = 100.0;
898 _elm_config->thumbscroll_friction = 1.0;
899 _elm_config->thumbscroll_bounce_friction = 0.5;
900 _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
901 _elm_config->page_scroll_friction = 0.5;
902 _elm_config->bring_in_scroll_friction = 0.5;
903 _elm_config->zoom_friction = 0.5;
904 _elm_config->thumbscroll_border_friction = 0.5;
905 _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
907 _elm_config->scroll_smooth_time_interval = 0.008;
909 >>>>>>> remotes/origin/upstream
910 _elm_config->scroll_smooth_amount = 1.0;
911 _elm_config->scroll_smooth_history_weight = 0.3;
912 _elm_config->scroll_smooth_future_time = 0.0;
913 _elm_config->scroll_smooth_time_window = 0.2;
914 _elm_config->scale = 1.0;
915 _elm_config->bgpixmap = 0;
916 _elm_config->compositing = 1;
917 _elm_config->font_hinting = 2;
918 _elm_config->cache_flush_poll_interval = 512;
919 _elm_config->cache_flush_enable = EINA_TRUE;
920 _elm_config->font_dirs = NULL;
921 _elm_config->image_cache = 4096;
922 _elm_config->font_cache = 512;
923 _elm_config->edje_cache = 32;
924 _elm_config->edje_collection_cache = 64;
925 _elm_config->finger_size = 40;
926 _elm_config->fps = 60.0;
927 _elm_config->theme = eina_stringshare_add("default");
928 _elm_config->modules = NULL;
929 _elm_config->tooltip_delay = 1.0;
930 _elm_config->cursor_engine_only = EINA_TRUE;
931 _elm_config->focus_highlight_enable = EINA_FALSE;
932 _elm_config->focus_highlight_animate = EINA_TRUE;
933 _elm_config->toolbar_shrink_mode = 2;
934 _elm_config->fileselector_expand_enable = EINA_FALSE;
935 _elm_config->inwin_dialogs_enable = EINA_FALSE;
936 _elm_config->icon_size = 32;
937 _elm_config->longpress_timeout = 1.0;
938 _elm_config->effect_enable = EINA_TRUE;
939 _elm_config->desktop_entry = EINA_FALSE;
940 _elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
941 _elm_config->password_show_last = EINA_FALSE;
942 _elm_config->password_show_last_timeout = 2.0;
943 _elm_config->glayer_zoom_finger_enable = EINA_TRUE;
944 _elm_config->glayer_zoom_finger_factor = 1.0;
945 _elm_config->glayer_zoom_wheel_factor = 0.05;
946 _elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_finger_size_get() */
947 _elm_config->glayer_rotate_finger_enable = EINA_TRUE;
948 _elm_config->glayer_rotate_angular_tolerance = 2.0; /* 2 DEG */
949 _elm_config->glayer_line_min_length = 1.0; /* 1 times elm_finger_size_get() */
950 _elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_finger_size_get() */
951 _elm_config->glayer_line_angular_tolerance = 20.0; /* 20 DEG */
952 _elm_config->glayer_flick_time_limit_ms = 120; /* ms to finish flick */
953 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
954 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
957 _elm_config->week_start = 1; /* monday */
958 _elm_config->weekend_start = 6; /* saturday */
959 _elm_config->weekend_len = 2;
960 >>>>>>> remotes/origin/upstream
964 _elm_config_eet_close_error_get(Eet_File *ef,
968 const char *erstr = NULL;
973 case EET_ERROR_WRITE_ERROR:
974 erstr = "An error occurred while saving Elementary's "
975 "settings to disk. The error could not be "
976 "deterimined. The file where the error occurred was: "
977 "%s. This file has been deleted to avoid corrupt data.";
980 case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG:
981 erstr = "Elementary's settings files are too big "
982 "for the file system they are being saved to. "
983 "This error is very strange as the files should "
984 "be extremely small. Please check the settings "
985 "for your home directory. "
986 "The file where the error occurred was: %s ."
987 "This file has been deleted to avoid corrupt data.";
990 case EET_ERROR_WRITE_ERROR_IO_ERROR:
991 erstr = "An output error occurred when writing the settings "
992 "files for Elementary. Your disk is having troubles "
993 "and possibly needs replacement. "
994 "The file where the error occurred was: %s ."
995 "This file has been deleted to avoid corrupt data.";
998 case EET_ERROR_WRITE_ERROR_OUT_OF_SPACE:
999 erstr = "Elementary cannot write its settings file "
1000 "because it ran out of space to write the file. "
1001 "You have either run out of disk space or have "
1002 "gone over your quota limit. "
1003 "The file where the error occurred was: %s ."
1004 "This file has been deleted to avoid corrupt data.";
1007 case EET_ERROR_WRITE_ERROR_FILE_CLOSED:
1008 erstr = "Elementary unexpectedly had the settings file "
1009 "it was writing closed on it. This is very unusual. "
1010 "The file where the error occurred was: %s "
1011 "This file has been deleted to avoid corrupt data.";
1019 /* delete any partially-written file */
1020 ecore_file_unlink(file);
1021 return strdup(erstr);
1028 _elm_config_profile_save(void)
1030 char buf[4096], buf2[4096];
1036 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
1037 if (len + 1 >= sizeof(buf))
1040 len = _elm_user_dir_snprintf(buf2, sizeof(buf2), "config/profile.cfg.tmp");
1041 if (len + 1 >= sizeof(buf2))
1044 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1048 ok = eet_write(ef, "config", _elm_profile, strlen(_elm_profile), 0);
1052 err = _elm_config_eet_close_error_get(ef, buf2);
1060 ret = ecore_file_mv(buf2, buf);
1063 ERR("Error saving Elementary's configuration file");
1067 ecore_file_unlink(buf2);
1071 ecore_file_unlink(buf2);
1076 _elm_config_save(void)
1078 char buf[4096], buf2[4096];
1084 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", _elm_profile);
1085 if (len + 1 >= sizeof(buf))
1088 ok = ecore_file_mkpath(buf);
1092 ERR("Problem acessing Elementary's user configuration directory: %s",
1094 ERR("Problem accessing Elementary's user configuration directory: %s",
1095 >>>>>>> remotes/origin/upstream
1100 if (!_elm_config_profile_save())
1106 if (len + sizeof("base.cfg") >= sizeof(buf) - len)
1109 memcpy(buf + len, "base.cfg", sizeof("base.cfg"));
1110 len += sizeof("base.cfg") - 1;
1112 if (len + sizeof(".tmp") >= sizeof(buf))
1115 memcpy(buf2, buf, len);
1116 memcpy(buf2 + len, ".tmp", sizeof(".tmp"));
1118 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1122 ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1);
1126 err = _elm_config_eet_close_error_get(ef, buf2);
1134 ret = ecore_file_mv(buf2, buf);
1137 ERR("Error saving Elementary's configuration file");
1141 ecore_file_unlink(buf2);
1145 ecore_file_unlink(buf2);
1150 _config_update(void)
1154 tcfg = _config_system_load();
1157 /* weird profile or something? We should probably fill
1158 * with hardcoded defaults, or get from default previx */
1161 #define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) {
1162 #define IFCFGELSE } else {
1164 #define COPYVAL(x) do {_elm_config->x = tcfg->x; } while(0)
1165 #define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while(0)
1166 #define COPYSTR(x) COPYPTR(x)
1168 /* we also need to update for property changes in the root window
1169 * if needed, but that will be dependent on new properties added
1170 * with each version */
1173 COPYVAL(longpress_timeout);
1183 /* after updating user config, we must save */
1192 s = getenv("ELM_ENGINE");
1195 if ((!strcasecmp(s, "x11")) ||
1196 (!strcasecmp(s, "x")) ||
1197 (!strcasecmp(s, "software-x11")) ||
1198 (!strcasecmp(s, "software_x11")))
1199 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_X11);
1200 else if ((!strcasecmp(s, "opengl")) ||
1201 (!strcasecmp(s, "gl")) ||
1202 (!strcasecmp(s, "opengl-x11")) ||
1203 (!strcasecmp(s, "opengl_x11")))
1204 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_X11);
1205 else if ((!strcasecmp(s, "x11-8")) ||
1206 (!strcasecmp(s, "x8")) ||
1207 (!strcasecmp(s, "software-8-x11")) ||
1208 (!strcasecmp(s, "software_8_x11")))
1209 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_8_X11);
1210 else if ((!strcasecmp(s, "x11-16")) ||
1211 (!strcasecmp(s, "x16")) ||
1212 (!strcasecmp(s, "software-16-x11")) ||
1213 (!strcasecmp(s, "software_16_x11")))
1214 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_X11);
1216 else if ((!strcasecmp(s, "xrender")) ||
1217 (!strcasecmp(s, "xr")) ||
1218 (!strcasecmp(s, "xrender-x11")) ||
1219 (!strcasecmp(s, "xrender_x11")))
1220 eina_stringshare_replace(&_elm_config->engine, ELM_XRENDER_X11);
1222 else if ((!strcasecmp(s, "fb")) ||
1223 (!strcasecmp(s, "software-fb")) ||
1224 (!strcasecmp(s, "software_fb")))
1225 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB);
1226 else if ((!strcasecmp(s, "directfb")) ||
1227 (!strcasecmp(s, "dfb")))
1228 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_DIRECTFB);
1229 else if ((!strcasecmp(s, "psl1ght")))
1230 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_PSL1GHT);
1231 else if ((!strcasecmp(s, "sdl")) ||
1232 (!strcasecmp(s, "software-sdl")) ||
1233 (!strcasecmp(s, "software_sdl")))
1234 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_SDL);
1235 else if ((!strcasecmp(s, "sdl-16")) ||
1236 (!strcasecmp(s, "software-16-sdl")) ||
1237 (!strcasecmp(s, "software_16_sdl")))
1238 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_SDL);
1239 else if ((!strcasecmp(s, "opengl-sdl")) ||
1240 (!strcasecmp(s, "opengl_sdl")) ||
1241 (!strcasecmp(s, "gl-sdl")) ||
1242 (!strcasecmp(s, "gl_sdl")))
1243 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL);
1244 else if ((!strcasecmp(s, "opengl-cocoa")) ||
1245 (!strcasecmp(s, "opengl_cocoa")) ||
1246 (!strcasecmp(s, "gl-cocoa")) ||
1247 (!strcasecmp(s, "gl_cocoa")))
1248 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_COCOA);
1249 else if ((!strcasecmp(s, "gdi")) ||
1250 (!strcasecmp(s, "software-gdi")) ||
1251 (!strcasecmp(s, "software_gdi")))
1252 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_WIN32);
1253 else if ((!strcasecmp(s, "wince-gdi")) ||
1254 (!strcasecmp(s, "software-16-wince-gdi")) ||
1255 (!strcasecmp(s, "software_16_wince_gdi")))
1256 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_WINCE);
1257 else if (!strcasecmp(s, "buffer"))
1258 eina_stringshare_replace(&_elm_config->engine, ELM_BUFFER);
1259 else if ((!strncmp(s, "shot:", 5)))
1260 eina_stringshare_replace(&_elm_config->engine, s);
1261 else if ((!strcasecmp(s, "ews")))
1262 eina_stringshare_replace(&_elm_config->engine, ELM_EWS);
1263 else if ((!strcasecmp(s, "wayland_shm")))
1264 eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_SHM);
1265 else if ((!strcasecmp(s, "wayland_egl")))
1266 eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_EGL);
1268 ERR("Unknown engine '%s'.", s);
1271 s = getenv("ELM_VSYNC");
1272 if (s) _elm_config->vsync = !!atoi(s);
1274 s = getenv("ELM_THUMBSCROLL_ENABLE");
1275 if (s) _elm_config->thumbscroll_enable = !!atoi(s);
1276 s = getenv("ELM_THUMBSCROLL_THRESHOLD");
1277 if (s) _elm_config->thumbscroll_threshold = atoi(s);
1278 // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
1279 s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
1280 if (s) _elm_config->thumbscroll_momentum_threshold = atof(s);
1281 s = getenv("ELM_THUMBSCROLL_FRICTION");
1282 if (s) _elm_config->thumbscroll_friction = atof(s);
1283 s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
1284 if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
1285 s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
1286 if (s) _elm_config->thumbscroll_bounce_friction = atof(s);
1287 s = getenv("ELM_PAGE_SCROLL_FRICTION");
1288 if (s) _elm_config->page_scroll_friction = atof(s);
1289 s = getenv("ELM_BRING_IN_SCROLL_FRICTION");
1290 if (s) _elm_config->bring_in_scroll_friction = atof(s);
1291 s = getenv("ELM_ZOOM_FRICTION");
1292 if (s) _elm_config->zoom_friction = atof(s);
1293 s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
1303 _elm_config->thumbscroll_border_friction = friction;
1305 s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION");
1315 _elm_config->thumbscroll_sensitivity_friction = friction;
1318 s = getenv("ELM_SCROLL_SMOOTH_TIME_INTERVAL");
1319 if (s) _elm_config->scroll_smooth_time_interval = atof(s);
1321 >>>>>>> remotes/origin/upstream
1322 s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
1323 if (s) _elm_config->scroll_smooth_amount = atof(s);
1324 s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT");
1325 if (s) _elm_config->scroll_smooth_history_weight = atof(s);
1326 s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
1327 if (s) _elm_config->scroll_smooth_future_time = atof(s);
1328 s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
1329 if (s) _elm_config->scroll_smooth_time_window = atof(s);
1330 s = getenv("ELM_THEME");
1331 if (s) eina_stringshare_replace(&_elm_config->theme, s);
1333 s = getenv("ELM_FONT_HINTING");
1336 if (!strcasecmp(s, "none")) _elm_config->font_hinting = 0;
1337 else if (!strcasecmp(s, "auto"))
1338 _elm_config->font_hinting = 1;
1339 else if (!strcasecmp(s, "bytecode"))
1340 _elm_config->font_hinting = 2;
1343 s = getenv("ELM_FONT_PATH");
1349 EINA_LIST_FREE(_elm_config->font_dirs, p)
1351 eina_stringshare_del(p);
1354 buf2 = alloca(strlen(s) + 1);
1359 if ((*p == ':') || (*p == 0))
1364 strncpy(buf2, pp, len);
1366 _elm_config->font_dirs =
1367 eina_list_append(_elm_config->font_dirs,
1368 eina_stringshare_add(buf2));
1381 s = getenv("ELM_IMAGE_CACHE");
1382 if (s) _elm_config->image_cache = atoi(s);
1384 s = getenv("ELM_FONT_CACHE");
1385 if (s) _elm_config->font_cache = atoi(s);
1387 s = getenv("ELM_SCALE");
1388 if (s) _elm_config->scale = atof(s);
1390 s = getenv("ELM_FINGER_SIZE");
1391 if (s) _elm_config->finger_size = atoi(s);
1393 s = getenv("ELM_PASSWORD_SHOW_LAST");
1394 if (s) _elm_config->password_show_last = !!atoi(s);
1396 s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT");
1399 double pw_show_last_timeout = atof(s);
1400 if (pw_show_last_timeout >= 0.0)
1401 _elm_config->password_show_last_timeout = pw_show_last_timeout;
1404 s = getenv("ELM_FPS");
1405 if (s) _elm_config->fps = atof(s);
1406 if (_elm_config->fps < 1.0) _elm_config->fps = 1.0;
1408 s = getenv("ELM_MODULES");
1409 if (s) eina_stringshare_replace(&_elm_config->modules, s);
1411 /* Get RTL orientation from system */
1412 setlocale(LC_ALL, "");
1413 bindtextdomain(PACKAGE, LOCALE_DIR);
1414 _elm_config->is_mirrored = !strcmp(E_("default:LTR"), "default:RTL");
1416 s = getenv("ELM_TOOLTIP_DELAY");
1419 double delay = atof(s);
1421 _elm_config->tooltip_delay = delay;
1424 s = getenv("ELM_CURSOR_ENGINE_ONLY");
1425 if (s) _elm_config->cursor_engine_only = !!atoi(s);
1427 s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE");
1428 if (s) _elm_config->focus_highlight_enable = !!atoi(s);
1430 s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE");
1431 if (s) _elm_config->focus_highlight_animate = !!atoi(s);
1433 s = getenv("ELM_TOOLBAR_SHRINK_MODE");
1434 if (s) _elm_config->toolbar_shrink_mode = atoi(s);
1436 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE");
1437 if (s) _elm_config->fileselector_expand_enable = !!atoi(s);
1439 s = getenv("ELM_INWIN_DIALOGS_ENABLE");
1440 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s);
1442 s = getenv("ELM_ICON_SIZE");
1443 if (s) _elm_config->icon_size = atoi(s);
1445 s = getenv("ELM_LONGPRESS_TIMEOUT");
1446 if (s) _elm_config->longpress_timeout = atof(s);
1447 if (_elm_config->longpress_timeout < 0.0)
1448 _elm_config->longpress_timeout = 0.0;
1450 s = getenv("ELM_EFFECT_ENABLE");
1451 if (s) _elm_config->effect_enable = !!atoi(s);
1453 s = getenv("ELM_DESKTOP_ENTRY");
1454 if (s) _elm_config->desktop_entry = !!atoi(s);
1455 s = getenv("ELM_ACCESS_MODE");
1456 if (s) _elm_config->access_mode = ELM_ACCESS_MODE_ON;
1461 elm_mirrored_get(void)
1463 elm_config_mirrored_get(void)
1464 >>>>>>> remotes/origin/upstream
1466 return _elm_config->is_mirrored;
1471 elm_mirrored_set(Eina_Bool mirrored)
1473 elm_config_mirrored_set(Eina_Bool mirrored)
1474 >>>>>>> remotes/origin/upstream
1476 _elm_config->is_mirrored = mirrored;
1483 elm_config_cursor_engine_only_get(void)
1485 return _elm_config->cursor_engine_only;
1489 elm_config_cursor_engine_only_set(Eina_Bool engine_only)
1491 engine_only = !!engine_only;
1492 _elm_config->cursor_engine_only = engine_only;
1495 EINA_DEPRECATED EAPI double
1496 elm_tooltip_delay_get(void)
1498 return elm_config_tooltip_delay_get();
1501 EINA_DEPRECATED EAPI Eina_Bool
1502 elm_tooltip_delay_set(double delay)
1504 elm_config_tooltip_delay_set(delay);
1509 elm_config_tooltip_delay_get(void)
1511 return _elm_config->tooltip_delay;
1515 elm_config_tooltip_delay_set(double delay)
1517 if (delay < 0.0) return;
1518 _elm_config->tooltip_delay = delay;
1522 elm_config_scale_get(void)
1524 return _elm_config->scale;
1528 elm_config_scale_set(double scale)
1530 if (_elm_config->scale == scale) return;
1531 _elm_config->scale = scale;
1536 elm_config_password_show_last_get(void)
1538 return _elm_config->password_show_last;
1542 elm_config_password_show_last_set(Eina_Bool password_show_last)
1544 if (_elm_config->password_show_last == password_show_last) return;
1545 _elm_config->password_show_last = password_show_last;
1546 edje_password_show_last_set(_elm_config->password_show_last);
1550 elm_config_password_show_last_timeout_get(void)
1552 return _elm_config->password_show_last_timeout;
1556 elm_config_password_show_last_timeout_set(double password_show_last_timeout)
1558 if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
1559 _elm_config->password_show_last_timeout = password_show_last_timeout;
1560 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1564 elm_config_save(void)
1566 return _elm_config_save();
1570 elm_config_reload(void)
1572 _elm_config_reload();
1576 elm_config_profile_get(void)
1578 return _elm_config_current_profile_get();
1582 elm_config_profile_dir_get(const char *profile,
1585 return _elm_config_profile_dir_get(profile, is_user);
1589 elm_config_profile_dir_free(const char *p_dir)
1591 free((void *)p_dir);
1595 elm_config_profile_list_get(void)
1597 return _elm_config_profiles_list();
1601 elm_config_profile_list_free(Eina_List *l)
1605 EINA_LIST_FREE(l, dir)
1606 eina_stringshare_del(dir);
1610 elm_config_profile_set(const char *profile)
1612 EINA_SAFETY_ON_NULL_RETURN(profile);
1613 _elm_config_profile_set(profile);
1617 elm_config_engine_get(void)
1619 return _elm_config->engine;
1623 elm_config_engine_set(const char *engine)
1625 EINA_SAFETY_ON_NULL_RETURN(engine);
1627 _elm_config_engine_set(engine);
1631 elm_config_text_classes_list_get(void)
1633 return _elm_config_text_classes_get();
1637 elm_config_text_classes_list_free(Eina_List *list)
1639 _elm_config_text_classes_free(list);
1642 EAPI const Eina_List *
1643 elm_config_font_overlay_list_get(void)
1645 return _elm_config_font_overlays_list();
1649 elm_config_font_overlay_set(const char *text_class,
1651 Evas_Font_Size size)
1653 EINA_SAFETY_ON_NULL_RETURN(text_class);
1654 _elm_config_font_overlay_set(text_class, font, size);
1658 elm_config_font_overlay_unset(const char *text_class)
1660 EINA_SAFETY_ON_NULL_RETURN(text_class);
1661 _elm_config_font_overlay_remove(text_class);
1665 elm_config_font_overlay_apply(void)
1667 _elm_config_font_overlay_apply();
1671 elm_config_finger_size_get(void)
1673 return _elm_config->finger_size;
1677 elm_config_finger_size_set(Evas_Coord size)
1679 if (_elm_config->finger_size == size) return;
1680 _elm_config->finger_size = size;
1685 elm_config_cache_flush_interval_get(void)
1687 return _elm_config->cache_flush_poll_interval;
1691 elm_config_cache_flush_interval_set(int size)
1693 if (_elm_config->cache_flush_poll_interval == size) return;
1694 _elm_config->cache_flush_poll_interval = size;
1700 elm_config_cache_flush_enabled_get(void)
1702 return _elm_config->cache_flush_enable;
1706 elm_config_cache_flush_enabled_set(Eina_Bool enabled)
1708 enabled = !!enabled;
1709 if (_elm_config->cache_flush_enable == enabled) return;
1710 _elm_config->cache_flush_enable = enabled;
1715 EINA_DEPRECATED EAPI int
1716 elm_font_cache_get(void)
1718 return elm_config_cache_font_cache_size_get();
1722 elm_config_cache_font_cache_size_get(void)
1724 return _elm_config->font_cache;
1727 EINA_DEPRECATED EAPI void
1728 elm_font_cache_set(int size)
1730 elm_config_cache_font_cache_size_set(size);
1734 elm_config_cache_font_cache_size_set(int size)
1736 if (_elm_config->font_cache == size) return;
1737 _elm_config->font_cache = size;
1742 EINA_DEPRECATED EAPI int
1743 elm_image_cache_get(void)
1745 return elm_config_cache_image_cache_size_get();
1749 elm_config_cache_image_cache_size_get(void)
1751 return _elm_config->image_cache;
1754 EINA_DEPRECATED EAPI void
1755 elm_image_cache_set(int size)
1757 elm_config_cache_image_cache_size_set(size);
1761 elm_config_cache_image_cache_size_set(int size)
1763 if (_elm_config->image_cache == size) return;
1764 _elm_config->image_cache = size;
1769 EINA_DEPRECATED EAPI int
1770 elm_edje_file_cache_get(void)
1772 return elm_config_cache_edje_file_cache_size_get();
1776 elm_config_cache_edje_file_cache_size_get()
1778 return _elm_config->edje_cache;
1781 EINA_DEPRECATED EAPI void
1782 elm_edje_file_cache_set(int size)
1784 elm_config_cache_edje_file_cache_size_set(size);
1788 elm_config_cache_edje_file_cache_size_set(int size)
1790 if (_elm_config->edje_cache == size) return;
1791 _elm_config->edje_cache = size;
1796 EINA_DEPRECATED EAPI int
1797 elm_edje_collection_cache_get(void)
1799 return elm_config_cache_edje_collection_cache_size_get();
1803 elm_config_cache_edje_collection_cache_size_get(void)
1805 return _elm_config->edje_collection_cache;
1808 EINA_DEPRECATED EAPI void
1809 elm_edje_collection_cache_set(int size)
1811 elm_config_cache_edje_collection_cache_size_set(size);
1815 elm_config_cache_edje_collection_cache_size_set(int size)
1817 if (_elm_config->edje_collection_cache == size) return;
1818 _elm_config->edje_collection_cache = size;
1824 elm_config_focus_highlight_enabled_get(void)
1826 return _elm_config->focus_highlight_enable;
1830 elm_config_focus_highlight_enabled_set(Eina_Bool enable)
1832 _elm_config->focus_highlight_enable = !!enable;
1836 elm_config_focus_highlight_animate_get(void)
1838 return _elm_config->focus_highlight_animate;
1842 elm_config_focus_highlight_animate_set(Eina_Bool animate)
1844 _elm_config->focus_highlight_animate = !!animate;
1848 elm_config_scroll_bounce_enabled_get(void)
1850 return _elm_config->thumbscroll_bounce_enable;
1854 elm_config_scroll_bounce_enabled_set(Eina_Bool enabled)
1856 _elm_config->thumbscroll_bounce_enable = enabled;
1860 elm_config_scroll_bounce_friction_get(void)
1862 return _elm_config->thumbscroll_bounce_friction;
1866 elm_config_scroll_bounce_friction_set(double friction)
1868 _elm_config->thumbscroll_bounce_friction = friction;
1872 elm_config_scroll_page_scroll_friction_get(void)
1874 return _elm_config->page_scroll_friction;
1878 elm_config_scroll_page_scroll_friction_set(double friction)
1880 _elm_config->page_scroll_friction = friction;
1884 elm_config_scroll_bring_in_scroll_friction_get(void)
1886 return _elm_config->bring_in_scroll_friction;
1890 elm_config_scroll_bring_in_scroll_friction_set(double friction)
1892 _elm_config->bring_in_scroll_friction = friction;
1896 elm_config_scroll_zoom_friction_get(void)
1898 return _elm_config->zoom_friction;
1902 elm_config_scroll_zoom_friction_set(double friction)
1904 _elm_config->zoom_friction = friction;
1908 elm_config_scroll_thumbscroll_enabled_get(void)
1910 return _elm_config->thumbscroll_enable;
1914 elm_config_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
1916 _elm_config->thumbscroll_enable = enabled;
1920 elm_config_scroll_thumbscroll_threshold_get(void)
1922 return _elm_config->thumbscroll_threshold;
1926 elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold)
1928 _elm_config->thumbscroll_threshold = threshold;
1932 elm_config_scroll_thumbscroll_momentum_threshold_get(void)
1934 return _elm_config->thumbscroll_momentum_threshold;
1938 elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold)
1940 _elm_config->thumbscroll_momentum_threshold = threshold;
1944 elm_config_scroll_thumbscroll_friction_get(void)
1946 return _elm_config->thumbscroll_friction;
1950 elm_config_scroll_thumbscroll_friction_set(double friction)
1952 _elm_config->thumbscroll_friction = friction;
1956 elm_config_scroll_thumbscroll_border_friction_get(void)
1958 return _elm_config->thumbscroll_border_friction;
1962 elm_config_scroll_thumbscroll_border_friction_set(double friction)
1964 if (friction < 0.0) friction = 0.0;
1965 if (friction > 1.0) friction = 1.0;
1966 _elm_config->thumbscroll_friction = friction;
1970 elm_config_scroll_thumbscroll_sensitivity_friction_get(void)
1972 return _elm_config->thumbscroll_sensitivity_friction;
1976 elm_config_scroll_thumbscroll_sensitivity_friction_set(double friction)
1978 if (friction < 0.1) friction = 0.1;
1979 if (friction > 1.0) friction = 1.0;
1980 _elm_config->thumbscroll_friction = friction;
1984 elm_config_longpress_timeout_set(double longpress_timeout)
1986 _elm_config->longpress_timeout = longpress_timeout;
1990 elm_config_longpress_timeout_get(void)
1992 return _elm_config->longpress_timeout;
1996 elm_config_all_flush(void)
1998 #ifdef HAVE_ELEMENTARY_X
1999 if (_prop_all_update_timer) ecore_timer_del(_prop_all_update_timer);
2000 _prop_all_update_timer = ecore_timer_add(0.1, _prop_all_update_cb, NULL);
2004 >>>>>>> remotes/origin/upstream
2009 const char *cur_dom = textdomain(NULL);
2010 const char *trans_comment = gettext("");
2011 const char *msg_locale = setlocale(LC_MESSAGES, NULL);
2013 /* Same concept as what glib does:
2014 * We shouldn't translate if there are no translations for the
2015 * application in the current locale + domain. (Unless locale is
2016 * en_/C where translating only parts of the interface make some
2019 _elm_config->translate = !(strcmp (cur_dom, "messages") &&
2020 !*trans_comment && strncmp (msg_locale, "en_", 3) &&
2021 strcmp (msg_locale, "C"));
2026 _elm_config_init(void)
2028 if (!ELM_EVENT_CONFIG_ALL_CHANGED)
2029 ELM_EVENT_CONFIG_ALL_CHANGED = ecore_event_type_new();
2031 _profile_fetch_from_conf();
2035 if (_elm_preferred_engine) eina_stringshare_del(_elm_preferred_engine);
2036 if (_elm_config->engine)
2037 _elm_preferred_engine = eina_stringshare_add(_elm_config->engine);
2039 _elm_preferred_engine = NULL;
2040 >>>>>>> remotes/origin/upstream
2041 _translation_init();
2044 _elm_config_font_overlay_apply();
2049 _elm_config_sub_shutdown(void)
2051 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2052 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2053 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2054 ENGINE_COMPARE(ELM_XRENDER_X11) ||
2055 ENGINE_COMPARE(ELM_OPENGL_X11) ||
2056 ENGINE_COMPARE(ELM_OPENGL_COCOA))
2057 #undef ENGINE_COMPARE
2059 #ifdef HAVE_ELEMENTARY_X
2060 ecore_x_disconnect();
2066 _elm_config_sub_init(void)
2068 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2069 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2070 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2071 ENGINE_COMPARE(ELM_XRENDER_X11) ||
2072 ENGINE_COMPARE(ELM_OPENGL_X11) ||
2073 ENGINE_COMPARE(ELM_OPENGL_COCOA))
2074 #undef ENGINE_COMPARE
2076 #ifdef HAVE_ELEMENTARY_X
2077 if (!ecore_x_init(NULL))
2079 ERR("Cannot connect to X11 display. check $DISPLAY variable");
2082 _root_1st = ecore_x_window_root_first_get();
2084 if (!ecore_x_screen_is_composited(0))
2085 _elm_config->compositing = 0;
2087 ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
2088 ecore_x_event_mask_set(_root_1st,
2089 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
2090 _prop_change_handler = ecore_event_handler_add
2091 (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
2092 if (!getenv("ELM_PROFILE"))
2096 s = ecore_x_window_prop_string_get(_root_1st,
2097 _atom[ATOM_E_PROFILE]);
2104 if (strcmp(_elm_profile, s)) changed = 1;
2108 if (changed) _prop_config_get();
2113 _config_sub_apply();
2117 _elm_config_reload(void)
2122 _elm_config_font_overlay_apply();
2128 _elm_config_engine_set(const char *engine)
2130 if (_elm_config->engine && strcmp(_elm_config->engine, engine))
2131 eina_stringshare_del(_elm_config->engine);
2133 _elm_config->engine = eina_stringshare_add(engine);
2138 _elm_config_all_update(void)
2140 #ifdef HAVE_ELEMENTARY_X
2141 if (_prop_all_update_timer) ecore_timer_del(_prop_all_update_timer);
2142 _prop_all_update_timer = ecore_timer_add(0.1, _prop_all_update_cb, NULL);
2144 ecore_x_window_prop_string_set(_root_1st, _atom[ATOM_E_PROFILE],
2149 elm_config_preferred_engine_get(void)
2151 return _elm_preferred_engine;
2155 elm_config_preferred_engine_set(const char *engine)
2158 eina_stringshare_replace(&(_elm_preferred_engine), engine);
2161 if (_elm_preferred_engine) eina_stringshare_del(_elm_preferred_engine);
2162 _elm_preferred_engine = eina_stringshare_add(_elm_config->engine);
2164 >>>>>>> remotes/origin/upstream
2168 _elm_config_profile_set(const char *profile)
2170 Eina_Bool changed = EINA_FALSE;
2174 if (strcmp(_elm_profile, profile))
2179 _elm_profile = strdup(profile);
2186 _elm_config_font_overlay_apply();
2193 _elm_config_shutdown(void)
2195 #ifdef HAVE_ELEMENTARY_X
2196 if (_prop_all_update_timer)
2198 ecore_timer_del(_prop_all_update_timer);
2200 _prop_all_update_cb(NULL);
2202 _prop_all_update_timer = NULL;
2204 _prop_all_update_timer = NULL;
2205 _prop_all_update_cb(NULL);
2207 >>>>>>> remotes/origin/upstream
2208 if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
2209 _prop_change_delay_timer = NULL;
2212 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2213 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2214 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2215 ENGINE_COMPARE(ELM_XRENDER_X11) ||
2216 ENGINE_COMPARE(ELM_OPENGL_X11))
2217 #undef ENGINE_COMPARE
2219 #ifdef HAVE_ELEMENTARY_X
2220 ecore_event_handler_del(_prop_change_handler);
2221 _prop_change_handler = NULL;
2227 if (_elm_preferred_engine)
2229 eina_stringshare_del(_elm_preferred_engine);
2230 _elm_preferred_engine = NULL;
2232 >>>>>>> remotes/origin/upstream
2236 _elm_profile = NULL;