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_amount, T_DOUBLE);
292 ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
293 ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE);
294 ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
295 ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
296 ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
297 ELM_CONFIG_VAL(D, T, compositing, T_INT);
298 /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
299 ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd);
300 ELM_CONFIG_VAL(D, T, font_hinting, T_INT);
301 ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT);
302 ELM_CONFIG_VAL(D, T, cache_flush_enable, T_UCHAR);
303 ELM_CONFIG_VAL(D, T, image_cache, T_INT);
304 ELM_CONFIG_VAL(D, T, font_cache, T_INT);
305 ELM_CONFIG_VAL(D, T, edje_cache, T_INT);
306 ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT);
307 ELM_CONFIG_VAL(D, T, finger_size, T_INT);
308 ELM_CONFIG_VAL(D, T, fps, T_DOUBLE);
309 ELM_CONFIG_VAL(D, T, theme, T_STRING);
310 ELM_CONFIG_VAL(D, T, modules, T_STRING);
311 ELM_CONFIG_VAL(D, T, tooltip_delay, T_DOUBLE);
312 ELM_CONFIG_VAL(D, T, cursor_engine_only, T_UCHAR);
313 ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR);
314 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
315 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
316 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
317 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR);
318 ELM_CONFIG_VAL(D, T, icon_size, T_INT);
319 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
320 ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR);
321 ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR);
322 ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR);
323 ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE);
324 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_enable, T_UCHAR);
325 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_factor, T_DOUBLE);
326 ELM_CONFIG_VAL(D, T, glayer_zoom_wheel_factor, T_DOUBLE);
327 ELM_CONFIG_VAL(D, T, glayer_zoom_distance_tolerance, T_DOUBLE);
328 ELM_CONFIG_VAL(D, T, glayer_rotate_finger_enable, T_UCHAR);
329 ELM_CONFIG_VAL(D, T, glayer_rotate_angular_tolerance, T_DOUBLE);
330 ELM_CONFIG_VAL(D, T, glayer_line_min_length, T_DOUBLE);
331 ELM_CONFIG_VAL(D, T, glayer_line_distance_tolerance, T_DOUBLE);
332 ELM_CONFIG_VAL(D, T, glayer_line_angular_tolerance, T_DOUBLE);
333 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
334 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
335 ELM_CONFIG_VAL(D, T, access_mode, T_INT);
336 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
337 ELM_CONFIG_VAL(D, T, week_start, T_INT);
338 ELM_CONFIG_VAL(D, T, weekend_start, T_INT);
339 ELM_CONFIG_VAL(D, T, weekend_len, T_INT);
353 eet_data_descriptor_free(_config_edd);
357 if (_config_font_overlay_edd)
359 eet_data_descriptor_free(_config_font_overlay_edd);
360 _config_font_overlay_edd = NULL;
365 _sort_files_cb(const void *f1,
368 return strcmp(f1, f2);
372 _elm_config_current_profile_get(void)
378 _elm_data_dir_snprintf(char *dst,
383 size_t data_dir_len, off;
386 data_dir_len = eina_strlcpy(dst, _elm_data_dir, size);
388 off = data_dir_len + 1;
393 dst[data_dir_len] = '/';
395 off = off + vsnprintf(dst + off, size - off, fmt, ap);
403 _elm_user_dir_snprintf(char *dst,
409 size_t user_dir_len, off;
413 home = evil_homedir_get();
415 home = getenv("HOME");
420 user_dir_len = eina_str_join_len(dst, size, '/', home, strlen(home),
421 ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
423 off = user_dir_len + 1;
428 dst[user_dir_len] = '/';
430 off = off + vsnprintf(dst + off, size - off, fmt, ap);
438 _elm_config_profile_dir_get(const char *prof,
446 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof);
448 if (ecore_file_is_dir(buf))
454 snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof);
456 if (ecore_file_is_dir(buf))
463 _elm_config_font_overlays_list(void)
465 return _elm_config->font_overlays;
469 _elm_config_font_overlay_set(const char *text_class,
473 Elm_Font_Overlay *efd;
476 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
478 if (strcmp(efd->text_class, text_class))
481 if (efd->font) eina_stringshare_del(efd->font);
482 efd->font = eina_stringshare_add(font);
484 _elm_config->font_overlays =
485 eina_list_promote_list(_elm_config->font_overlays, l);
489 /* the text class doesn't exist */
490 efd = calloc(1, sizeof(Elm_Font_Overlay));
491 efd->text_class = eina_stringshare_add(text_class);
492 efd->font = eina_stringshare_add(font);
495 _elm_config->font_overlays = eina_list_prepend(_elm_config->font_overlays,
500 _elm_config_font_overlay_remove(const char *text_class)
502 Elm_Font_Overlay *efd;
505 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
507 if (strcmp(efd->text_class, text_class))
510 _elm_config->font_overlays =
511 eina_list_remove_list(_elm_config->font_overlays, l);
512 if (efd->text_class) eina_stringshare_del(efd->text_class);
513 if (efd->font) eina_stringshare_del(efd->font);
521 _elm_config_font_overlay_apply(void)
523 Elm_Font_Overlay *efd;
527 for (i = 0; _elm_text_classes[i].desc; i++)
528 edje_text_class_del(_elm_text_classes[i].name);
530 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
531 edje_text_class_set(efd->text_class, efd->font, efd->size);
535 _elm_config_text_classes_get(void)
537 Eina_List *ret = NULL;
540 for (i = 0; _elm_text_classes[i].desc; i++)
543 tc = malloc(sizeof(*tc));
546 *tc = _elm_text_classes[i];
548 ret = eina_list_append(ret, tc);
555 _elm_config_text_classes_free(Eina_List *l)
559 EINA_LIST_FREE(l, tc)
564 _elm_config_profiles_list(void)
566 const Eina_File_Direct_Info *info;
567 Eina_List *flist = NULL;
568 Eina_Iterator *file_it;
573 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config");
575 file_it = eina_file_direct_ls(buf);
582 len = sizeof(buf) - len;
584 EINA_ITERATOR_FOREACH(file_it, info)
586 if (info->name_length >= len)
589 if (info->type == EINA_FILE_DIR)
592 eina_list_sorted_insert(flist, _sort_files_cb,
593 eina_stringshare_add(info->path +
598 eina_iterator_free(file_it);
601 len = eina_str_join_len(buf, sizeof(buf), '/', _elm_data_dir,
602 strlen(_elm_data_dir), "config",
603 sizeof("config") - 1);
605 file_it = eina_file_direct_ls(buf);
612 len = sizeof(buf) - len;
613 EINA_ITERATOR_FOREACH(file_it, info)
615 if (info->name_length >= len)
625 EINA_LIST_FOREACH(flist, l, tmp)
626 if (!strcmp(info->path + info->name_start, tmp))
631 eina_list_sorted_insert(flist, _sort_files_cb,
632 eina_stringshare_add(info->path +
641 eina_iterator_free(file_it);
645 EINA_LIST_FREE(flist, dir)
646 eina_stringshare_del(dir);
652 _profile_fetch_from_conf(void)
654 char buf[PATH_MAX], *p, *s;
658 _elm_profile = strdup("default");
660 // if env var - use profile without question
661 s = getenv("ELM_PROFILE");
665 _elm_profile = strdup(s);
670 _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
671 ef = eet_open(buf, EET_FILE_MODE_READ);
674 p = eet_read(ef, "config", &len);
678 _elm_profile = malloc(len + 1);
679 memcpy(_elm_profile, p, len);
680 _elm_profile[len] = 0;
689 _elm_data_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
690 ef = eet_open(buf, EET_FILE_MODE_READ);
693 p = eet_read(ef, "config", &len);
697 _elm_profile = malloc(len + 1);
698 memcpy(_elm_profile, p, len);
699 _elm_profile[len] = 0;
709 Elm_Font_Overlay *fo;
712 if (!_elm_config) return;
713 EINA_LIST_FREE(_elm_config->font_dirs, fontdir)
715 eina_stringshare_del(fontdir);
717 if (_elm_config->engine) eina_stringshare_del(_elm_config->engine);
718 EINA_LIST_FREE(_elm_config->font_overlays, fo)
720 if (fo->text_class) eina_stringshare_del(fo->text_class);
721 if (fo->font) eina_stringshare_del(fo->font);
724 if (_elm_config->theme) eina_stringshare_del(_elm_config->theme);
725 if (_elm_config->modules) eina_stringshare_del(_elm_config->modules);
733 _elm_theme_parse(NULL, _elm_config->theme);
734 ecore_animator_frametime_set(1.0 / _elm_config->fps);
738 _config_sub_apply(void)
740 edje_frametime_set(1.0 / _elm_config->fps);
741 edje_scale_set(_elm_config->scale);
742 edje_password_show_last_set(_elm_config->password_show_last);
743 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
744 if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
748 _elm_cache_flush_cb(void *data __UNUSED__)
750 elm_cache_all_flush();
751 return ECORE_CALLBACK_RENEW;
754 /* kind of abusing this call right now -- shared between all of those
755 * properties -- but they are not meant to be called that periodically
763 elm_cache_all_flush();
765 EINA_LIST_FOREACH(_elm_win_list, l, win)
767 Evas *e = evas_object_evas_get(win);
768 evas_image_cache_set(e, _elm_config->image_cache * 1024);
769 evas_font_cache_set(e, _elm_config->font_cache * 1024);
771 edje_file_cache_set(_elm_config->edje_cache);
772 edje_collection_cache_set(_elm_config->edje_collection_cache);
774 if (_elm_cache_flush_poller)
776 ecore_poller_del(_elm_cache_flush_poller);
777 _elm_cache_flush_poller = NULL;
779 if (_elm_config->cache_flush_enable)
781 if (_elm_config->cache_flush_poll_interval > 0)
783 _elm_cache_flush_poller =
784 ecore_poller_add(ECORE_POLLER_CORE,
785 _elm_config->cache_flush_poll_interval,
786 _elm_cache_flush_cb, NULL);
792 _config_user_load(void)
794 Elm_Config *cfg = NULL;
798 _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
801 ef = eet_open(buf, EET_FILE_MODE_READ);
804 cfg = eet_data_read(ef, _config_edd, "config");
811 _config_system_load(void)
813 Elm_Config *cfg = NULL;
817 _elm_data_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
820 ef = eet_open(buf, EET_FILE_MODE_READ);
823 cfg = eet_data_read(ef, _config_edd, "config");
832 _elm_config = _config_user_load();
835 if (_elm_config->config_version < ELM_CONFIG_VERSION)
840 /* no user config, fallback for system. No need to check version for
841 * this one, if it's not the right one, someone screwed up at the time
842 * of installing it */
843 _elm_config = _config_system_load();
844 if (_elm_config) return;
845 /* FIXME: config load could have failed because of a non-existent
846 * profile. Fallback to default before moving on */
848 // config load fail - defaults
849 // why are these here? well if they are, it means you can make a gui
850 // config recovery app i guess...
851 _elm_config = ELM_NEW(Elm_Config);
852 _elm_config->config_version = ELM_CONFIG_VERSION;
853 _elm_config->engine = eina_stringshare_add("software_x11");
854 _elm_config->vsync = 0;
855 _elm_config->thumbscroll_enable = EINA_TRUE;
856 _elm_config->thumbscroll_threshold = 24;
857 _elm_config->thumbscroll_momentum_threshold = 100.0;
858 _elm_config->thumbscroll_friction = 1.0;
859 _elm_config->thumbscroll_bounce_friction = 0.5;
860 _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
861 _elm_config->page_scroll_friction = 0.5;
862 _elm_config->bring_in_scroll_friction = 0.5;
863 _elm_config->zoom_friction = 0.5;
864 _elm_config->thumbscroll_border_friction = 0.5;
865 _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
866 _elm_config->scroll_smooth_amount = 1.0;
867 _elm_config->scroll_smooth_history_weight = 0.3;
868 _elm_config->scroll_smooth_future_time = 0.0;
869 _elm_config->scroll_smooth_time_window = 0.2;
870 _elm_config->scale = 1.0;
871 _elm_config->bgpixmap = 0;
872 _elm_config->compositing = 1;
873 _elm_config->font_hinting = 2;
874 _elm_config->cache_flush_poll_interval = 512;
875 _elm_config->cache_flush_enable = EINA_TRUE;
876 _elm_config->font_dirs = NULL;
877 _elm_config->image_cache = 4096;
878 _elm_config->font_cache = 512;
879 _elm_config->edje_cache = 32;
880 _elm_config->edje_collection_cache = 64;
881 _elm_config->finger_size = 40;
882 _elm_config->fps = 60.0;
883 _elm_config->theme = eina_stringshare_add("default");
884 _elm_config->modules = NULL;
885 _elm_config->tooltip_delay = 1.0;
886 _elm_config->cursor_engine_only = EINA_TRUE;
887 _elm_config->focus_highlight_enable = EINA_FALSE;
888 _elm_config->focus_highlight_animate = EINA_TRUE;
889 _elm_config->toolbar_shrink_mode = 2;
890 _elm_config->fileselector_expand_enable = EINA_FALSE;
891 _elm_config->inwin_dialogs_enable = EINA_FALSE;
892 _elm_config->icon_size = 32;
893 _elm_config->longpress_timeout = 1.0;
894 _elm_config->effect_enable = EINA_TRUE;
895 _elm_config->desktop_entry = EINA_FALSE;
896 _elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
897 _elm_config->password_show_last = EINA_FALSE;
898 _elm_config->password_show_last_timeout = 2.0;
899 _elm_config->glayer_zoom_finger_enable = EINA_TRUE;
900 _elm_config->glayer_zoom_finger_factor = 1.0;
901 _elm_config->glayer_zoom_wheel_factor = 0.05;
902 _elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_finger_size_get() */
903 _elm_config->glayer_rotate_finger_enable = EINA_TRUE;
904 _elm_config->glayer_rotate_angular_tolerance = 2.0; /* 2 DEG */
905 _elm_config->glayer_line_min_length = 1.0; /* 1 times elm_finger_size_get() */
906 _elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_finger_size_get() */
907 _elm_config->glayer_line_angular_tolerance = 20.0; /* 20 DEG */
908 _elm_config->glayer_flick_time_limit_ms = 120; /* ms to finish flick */
909 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
910 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
911 _elm_config->week_start = 1; /* monday */
912 _elm_config->weekend_start = 6; /* saturday */
913 _elm_config->weekend_len = 2;
917 _elm_config_eet_close_error_get(Eet_File *ef,
921 const char *erstr = NULL;
926 case EET_ERROR_WRITE_ERROR:
927 erstr = "An error occurred while saving Elementary's "
928 "settings to disk. The error could not be "
929 "deterimined. The file where the error occurred was: "
930 "%s. This file has been deleted to avoid corrupt data.";
933 case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG:
934 erstr = "Elementary's settings files are too big "
935 "for the file system they are being saved to. "
936 "This error is very strange as the files should "
937 "be extremely small. Please check the settings "
938 "for your home directory. "
939 "The file where the error occurred was: %s ."
940 "This file has been deleted to avoid corrupt data.";
943 case EET_ERROR_WRITE_ERROR_IO_ERROR:
944 erstr = "An output error occurred when writing the settings "
945 "files for Elementary. Your disk is having troubles "
946 "and possibly needs replacement. "
947 "The file where the error occurred was: %s ."
948 "This file has been deleted to avoid corrupt data.";
951 case EET_ERROR_WRITE_ERROR_OUT_OF_SPACE:
952 erstr = "Elementary cannot write its settings file "
953 "because it ran out of space to write the file. "
954 "You have either run out of disk space or have "
955 "gone over your quota limit. "
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_FILE_CLOSED:
961 erstr = "Elementary unexpectedly had the settings file "
962 "it was writing closed on it. This is very unusual. "
963 "The file where the error occurred was: %s "
964 "This file has been deleted to avoid corrupt data.";
972 /* delete any partially-written file */
973 ecore_file_unlink(file);
974 return strdup(erstr);
981 _elm_config_profile_save(void)
983 char buf[4096], buf2[4096];
989 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
990 if (len + 1 >= sizeof(buf))
993 len = _elm_user_dir_snprintf(buf2, sizeof(buf2), "config/profile.cfg.tmp");
994 if (len + 1 >= sizeof(buf2))
997 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1001 ok = eet_write(ef, "config", _elm_profile, strlen(_elm_profile), 0);
1005 err = _elm_config_eet_close_error_get(ef, buf2);
1013 ret = ecore_file_mv(buf2, buf);
1016 ERR("Error saving Elementary's configuration file");
1020 ecore_file_unlink(buf2);
1024 ecore_file_unlink(buf2);
1029 _elm_config_save(void)
1031 char buf[4096], buf2[4096];
1037 len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", _elm_profile);
1038 if (len + 1 >= sizeof(buf))
1041 ok = ecore_file_mkpath(buf);
1044 ERR("Problem accessing Elementary's user configuration directory: %s",
1049 if (!_elm_config_profile_save())
1055 if (len + sizeof("base.cfg") >= sizeof(buf) - len)
1058 memcpy(buf + len, "base.cfg", sizeof("base.cfg"));
1059 len += sizeof("base.cfg") - 1;
1061 if (len + sizeof(".tmp") >= sizeof(buf))
1064 memcpy(buf2, buf, len);
1065 memcpy(buf2 + len, ".tmp", sizeof(".tmp"));
1067 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1071 ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1);
1075 err = _elm_config_eet_close_error_get(ef, buf2);
1083 ret = ecore_file_mv(buf2, buf);
1086 ERR("Error saving Elementary's configuration file");
1090 ecore_file_unlink(buf2);
1094 ecore_file_unlink(buf2);
1099 _config_update(void)
1103 tcfg = _config_system_load();
1106 /* weird profile or something? We should probably fill
1107 * with hardcoded defaults, or get from default previx */
1110 #define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) {
1111 #define IFCFGELSE } else {
1113 #define COPYVAL(x) do {_elm_config->x = tcfg->x; } while(0)
1114 #define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while(0)
1115 #define COPYSTR(x) COPYPTR(x)
1117 /* we also need to update for property changes in the root window
1118 * if needed, but that will be dependent on new properties added
1119 * with each version */
1122 COPYVAL(longpress_timeout);
1132 /* after updating user config, we must save */
1141 s = getenv("ELM_ENGINE");
1144 if ((!strcasecmp(s, "x11")) ||
1145 (!strcasecmp(s, "x")) ||
1146 (!strcasecmp(s, "software-x11")) ||
1147 (!strcasecmp(s, "software_x11")))
1148 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_X11);
1149 else if ((!strcasecmp(s, "opengl")) ||
1150 (!strcasecmp(s, "gl")) ||
1151 (!strcasecmp(s, "opengl-x11")) ||
1152 (!strcasecmp(s, "opengl_x11")))
1153 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_X11);
1154 else if ((!strcasecmp(s, "x11-8")) ||
1155 (!strcasecmp(s, "x8")) ||
1156 (!strcasecmp(s, "software-8-x11")) ||
1157 (!strcasecmp(s, "software_8_x11")))
1158 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_8_X11);
1159 else if ((!strcasecmp(s, "x11-16")) ||
1160 (!strcasecmp(s, "x16")) ||
1161 (!strcasecmp(s, "software-16-x11")) ||
1162 (!strcasecmp(s, "software_16_x11")))
1163 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_X11);
1165 else if ((!strcasecmp(s, "xrender")) ||
1166 (!strcasecmp(s, "xr")) ||
1167 (!strcasecmp(s, "xrender-x11")) ||
1168 (!strcasecmp(s, "xrender_x11")))
1169 eina_stringshare_replace(&_elm_config->engine, ELM_XRENDER_X11);
1171 else if ((!strcasecmp(s, "fb")) ||
1172 (!strcasecmp(s, "software-fb")) ||
1173 (!strcasecmp(s, "software_fb")))
1174 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB);
1175 else if ((!strcasecmp(s, "directfb")) ||
1176 (!strcasecmp(s, "dfb")))
1177 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_DIRECTFB);
1178 else if ((!strcasecmp(s, "psl1ght")))
1179 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_PSL1GHT);
1180 else if ((!strcasecmp(s, "sdl")) ||
1181 (!strcasecmp(s, "software-sdl")) ||
1182 (!strcasecmp(s, "software_sdl")))
1183 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_SDL);
1184 else if ((!strcasecmp(s, "sdl-16")) ||
1185 (!strcasecmp(s, "software-16-sdl")) ||
1186 (!strcasecmp(s, "software_16_sdl")))
1187 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_SDL);
1188 else if ((!strcasecmp(s, "opengl-sdl")) ||
1189 (!strcasecmp(s, "opengl_sdl")) ||
1190 (!strcasecmp(s, "gl-sdl")) ||
1191 (!strcasecmp(s, "gl_sdl")))
1192 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL);
1193 else if ((!strcasecmp(s, "opengl-cocoa")) ||
1194 (!strcasecmp(s, "opengl_cocoa")) ||
1195 (!strcasecmp(s, "gl-cocoa")) ||
1196 (!strcasecmp(s, "gl_cocoa")))
1197 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_COCOA);
1198 else if ((!strcasecmp(s, "gdi")) ||
1199 (!strcasecmp(s, "software-gdi")) ||
1200 (!strcasecmp(s, "software_gdi")))
1201 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_WIN32);
1202 else if ((!strcasecmp(s, "wince-gdi")) ||
1203 (!strcasecmp(s, "software-16-wince-gdi")) ||
1204 (!strcasecmp(s, "software_16_wince_gdi")))
1205 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_WINCE);
1206 else if (!strcasecmp(s, "buffer"))
1207 eina_stringshare_replace(&_elm_config->engine, ELM_BUFFER);
1208 else if ((!strncmp(s, "shot:", 5)))
1209 eina_stringshare_replace(&_elm_config->engine, s);
1210 else if ((!strcasecmp(s, "ews")))
1211 eina_stringshare_replace(&_elm_config->engine, ELM_EWS);
1212 else if ((!strcasecmp(s, "wayland_shm")))
1213 eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_SHM);
1214 else if ((!strcasecmp(s, "wayland_egl")))
1215 eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_EGL);
1217 ERR("Unknown engine '%s'.", s);
1220 s = getenv("ELM_VSYNC");
1221 if (s) _elm_config->vsync = !!atoi(s);
1223 s = getenv("ELM_THUMBSCROLL_ENABLE");
1224 if (s) _elm_config->thumbscroll_enable = !!atoi(s);
1225 s = getenv("ELM_THUMBSCROLL_THRESHOLD");
1226 if (s) _elm_config->thumbscroll_threshold = atoi(s);
1227 // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
1228 s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
1229 if (s) _elm_config->thumbscroll_momentum_threshold = atof(s);
1230 s = getenv("ELM_THUMBSCROLL_FRICTION");
1231 if (s) _elm_config->thumbscroll_friction = atof(s);
1232 s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
1233 if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
1234 s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
1235 if (s) _elm_config->thumbscroll_bounce_friction = atof(s);
1236 s = getenv("ELM_PAGE_SCROLL_FRICTION");
1237 if (s) _elm_config->page_scroll_friction = atof(s);
1238 s = getenv("ELM_BRING_IN_SCROLL_FRICTION");
1239 if (s) _elm_config->bring_in_scroll_friction = atof(s);
1240 s = getenv("ELM_ZOOM_FRICTION");
1241 if (s) _elm_config->zoom_friction = atof(s);
1242 s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
1252 _elm_config->thumbscroll_border_friction = friction;
1254 s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION");
1264 _elm_config->thumbscroll_sensitivity_friction = friction;
1266 s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
1267 if (s) _elm_config->scroll_smooth_amount = atof(s);
1268 s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT");
1269 if (s) _elm_config->scroll_smooth_history_weight = atof(s);
1270 s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
1271 if (s) _elm_config->scroll_smooth_future_time = atof(s);
1272 s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
1273 if (s) _elm_config->scroll_smooth_time_window = atof(s);
1274 s = getenv("ELM_THEME");
1275 if (s) eina_stringshare_replace(&_elm_config->theme, s);
1277 s = getenv("ELM_FONT_HINTING");
1280 if (!strcasecmp(s, "none")) _elm_config->font_hinting = 0;
1281 else if (!strcasecmp(s, "auto"))
1282 _elm_config->font_hinting = 1;
1283 else if (!strcasecmp(s, "bytecode"))
1284 _elm_config->font_hinting = 2;
1287 s = getenv("ELM_FONT_PATH");
1293 EINA_LIST_FREE(_elm_config->font_dirs, p)
1295 eina_stringshare_del(p);
1298 buf2 = alloca(strlen(s) + 1);
1303 if ((*p == ':') || (*p == 0))
1308 strncpy(buf2, pp, len);
1310 _elm_config->font_dirs =
1311 eina_list_append(_elm_config->font_dirs,
1312 eina_stringshare_add(buf2));
1325 s = getenv("ELM_IMAGE_CACHE");
1326 if (s) _elm_config->image_cache = atoi(s);
1328 s = getenv("ELM_FONT_CACHE");
1329 if (s) _elm_config->font_cache = atoi(s);
1331 s = getenv("ELM_SCALE");
1332 if (s) _elm_config->scale = atof(s);
1334 s = getenv("ELM_FINGER_SIZE");
1335 if (s) _elm_config->finger_size = atoi(s);
1337 s = getenv("ELM_PASSWORD_SHOW_LAST");
1338 if (s) _elm_config->password_show_last = !!atoi(s);
1340 s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT");
1343 double pw_show_last_timeout = atof(s);
1344 if (pw_show_last_timeout >= 0.0)
1345 _elm_config->password_show_last_timeout = pw_show_last_timeout;
1348 s = getenv("ELM_FPS");
1349 if (s) _elm_config->fps = atof(s);
1350 if (_elm_config->fps < 1.0) _elm_config->fps = 1.0;
1352 s = getenv("ELM_MODULES");
1353 if (s) eina_stringshare_replace(&_elm_config->modules, s);
1355 /* Get RTL orientation from system */
1356 setlocale(LC_ALL, "");
1357 bindtextdomain(PACKAGE, LOCALE_DIR);
1358 _elm_config->is_mirrored = !strcmp(E_("default:LTR"), "default:RTL");
1360 s = getenv("ELM_TOOLTIP_DELAY");
1363 double delay = atof(s);
1365 _elm_config->tooltip_delay = delay;
1368 s = getenv("ELM_CURSOR_ENGINE_ONLY");
1369 if (s) _elm_config->cursor_engine_only = !!atoi(s);
1371 s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE");
1372 if (s) _elm_config->focus_highlight_enable = !!atoi(s);
1374 s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE");
1375 if (s) _elm_config->focus_highlight_animate = !!atoi(s);
1377 s = getenv("ELM_TOOLBAR_SHRINK_MODE");
1378 if (s) _elm_config->toolbar_shrink_mode = atoi(s);
1380 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE");
1381 if (s) _elm_config->fileselector_expand_enable = !!atoi(s);
1383 s = getenv("ELM_INWIN_DIALOGS_ENABLE");
1384 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s);
1386 s = getenv("ELM_ICON_SIZE");
1387 if (s) _elm_config->icon_size = atoi(s);
1389 s = getenv("ELM_LONGPRESS_TIMEOUT");
1390 if (s) _elm_config->longpress_timeout = atof(s);
1391 if (_elm_config->longpress_timeout < 0.0)
1392 _elm_config->longpress_timeout = 0.0;
1394 s = getenv("ELM_EFFECT_ENABLE");
1395 if (s) _elm_config->effect_enable = !!atoi(s);
1397 s = getenv("ELM_DESKTOP_ENTRY");
1398 if (s) _elm_config->desktop_entry = !!atoi(s);
1399 s = getenv("ELM_ACCESS_MODE");
1400 if (s) _elm_config->access_mode = ELM_ACCESS_MODE_ON;
1404 elm_config_mirrored_get(void)
1406 return _elm_config->is_mirrored;
1410 elm_config_mirrored_set(Eina_Bool mirrored)
1412 _elm_config->is_mirrored = mirrored;
1417 elm_config_cursor_engine_only_get(void)
1419 return _elm_config->cursor_engine_only;
1423 elm_config_cursor_engine_only_set(Eina_Bool engine_only)
1425 engine_only = !!engine_only;
1426 _elm_config->cursor_engine_only = engine_only;
1429 EINA_DEPRECATED EAPI double
1430 elm_tooltip_delay_get(void)
1432 return elm_config_tooltip_delay_get();
1435 EINA_DEPRECATED EAPI Eina_Bool
1436 elm_tooltip_delay_set(double delay)
1438 elm_config_tooltip_delay_set(delay);
1443 elm_config_tooltip_delay_get(void)
1445 return _elm_config->tooltip_delay;
1449 elm_config_tooltip_delay_set(double delay)
1451 if (delay < 0.0) return;
1452 _elm_config->tooltip_delay = delay;
1456 elm_config_scale_get(void)
1458 return _elm_config->scale;
1462 elm_config_scale_set(double scale)
1464 if (_elm_config->scale == scale) return;
1465 _elm_config->scale = scale;
1470 elm_config_password_show_last_get(void)
1472 return _elm_config->password_show_last;
1476 elm_config_password_show_last_set(Eina_Bool password_show_last)
1478 if (_elm_config->password_show_last == password_show_last) return;
1479 _elm_config->password_show_last = password_show_last;
1480 edje_password_show_last_set(_elm_config->password_show_last);
1484 elm_config_password_show_last_timeout_get(void)
1486 return _elm_config->password_show_last_timeout;
1490 elm_config_password_show_last_timeout_set(double password_show_last_timeout)
1492 if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
1493 _elm_config->password_show_last_timeout = password_show_last_timeout;
1494 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1498 elm_config_save(void)
1500 return _elm_config_save();
1504 elm_config_reload(void)
1506 _elm_config_reload();
1510 elm_config_profile_get(void)
1512 return _elm_config_current_profile_get();
1516 elm_config_profile_dir_get(const char *profile,
1519 return _elm_config_profile_dir_get(profile, is_user);
1523 elm_config_profile_dir_free(const char *p_dir)
1525 free((void *)p_dir);
1529 elm_config_profile_list_get(void)
1531 return _elm_config_profiles_list();
1535 elm_config_profile_list_free(Eina_List *l)
1539 EINA_LIST_FREE(l, dir)
1540 eina_stringshare_del(dir);
1544 elm_config_profile_set(const char *profile)
1546 EINA_SAFETY_ON_NULL_RETURN(profile);
1547 _elm_config_profile_set(profile);
1551 elm_config_engine_get(void)
1553 return _elm_config->engine;
1557 elm_config_engine_set(const char *engine)
1559 EINA_SAFETY_ON_NULL_RETURN(engine);
1561 _elm_config_engine_set(engine);
1565 elm_config_text_classes_list_get(void)
1567 return _elm_config_text_classes_get();
1571 elm_config_text_classes_list_free(Eina_List *list)
1573 _elm_config_text_classes_free(list);
1576 EAPI const Eina_List *
1577 elm_config_font_overlay_list_get(void)
1579 return _elm_config_font_overlays_list();
1583 elm_config_font_overlay_set(const char *text_class,
1585 Evas_Font_Size size)
1587 EINA_SAFETY_ON_NULL_RETURN(text_class);
1588 _elm_config_font_overlay_set(text_class, font, size);
1592 elm_config_font_overlay_unset(const char *text_class)
1594 EINA_SAFETY_ON_NULL_RETURN(text_class);
1595 _elm_config_font_overlay_remove(text_class);
1599 elm_config_font_overlay_apply(void)
1601 _elm_config_font_overlay_apply();
1605 elm_config_finger_size_get(void)
1607 return _elm_config->finger_size;
1611 elm_config_finger_size_set(Evas_Coord size)
1613 if (_elm_config->finger_size == size) return;
1614 _elm_config->finger_size = size;
1619 elm_config_cache_flush_interval_get(void)
1621 return _elm_config->cache_flush_poll_interval;
1625 elm_config_cache_flush_interval_set(int size)
1627 if (_elm_config->cache_flush_poll_interval == size) return;
1628 _elm_config->cache_flush_poll_interval = size;
1634 elm_config_cache_flush_enabled_get(void)
1636 return _elm_config->cache_flush_enable;
1640 elm_config_cache_flush_enabled_set(Eina_Bool enabled)
1642 enabled = !!enabled;
1643 if (_elm_config->cache_flush_enable == enabled) return;
1644 _elm_config->cache_flush_enable = enabled;
1649 EINA_DEPRECATED EAPI int
1650 elm_font_cache_get(void)
1652 return elm_config_cache_font_cache_size_get();
1656 elm_config_cache_font_cache_size_get(void)
1658 return _elm_config->font_cache;
1661 EINA_DEPRECATED EAPI void
1662 elm_font_cache_set(int size)
1664 elm_config_cache_font_cache_size_set(size);
1668 elm_config_cache_font_cache_size_set(int size)
1670 if (_elm_config->font_cache == size) return;
1671 _elm_config->font_cache = size;
1676 EINA_DEPRECATED EAPI int
1677 elm_image_cache_get(void)
1679 return elm_config_cache_image_cache_size_get();
1683 elm_config_cache_image_cache_size_get(void)
1685 return _elm_config->image_cache;
1688 EINA_DEPRECATED EAPI void
1689 elm_image_cache_set(int size)
1691 elm_config_cache_image_cache_size_set(size);
1695 elm_config_cache_image_cache_size_set(int size)
1697 if (_elm_config->image_cache == size) return;
1698 _elm_config->image_cache = size;
1703 EINA_DEPRECATED EAPI int
1704 elm_edje_file_cache_get(void)
1706 return elm_config_cache_edje_file_cache_size_get();
1710 elm_config_cache_edje_file_cache_size_get()
1712 return _elm_config->edje_cache;
1715 EINA_DEPRECATED EAPI void
1716 elm_edje_file_cache_set(int size)
1718 elm_config_cache_edje_file_cache_size_set(size);
1722 elm_config_cache_edje_file_cache_size_set(int size)
1724 if (_elm_config->edje_cache == size) return;
1725 _elm_config->edje_cache = size;
1730 EINA_DEPRECATED EAPI int
1731 elm_edje_collection_cache_get(void)
1733 return elm_config_cache_edje_collection_cache_size_get();
1737 elm_config_cache_edje_collection_cache_size_get(void)
1739 return _elm_config->edje_collection_cache;
1742 EINA_DEPRECATED EAPI void
1743 elm_edje_collection_cache_set(int size)
1745 elm_config_cache_edje_collection_cache_size_set(size);
1749 elm_config_cache_edje_collection_cache_size_set(int size)
1751 if (_elm_config->edje_collection_cache == size) return;
1752 _elm_config->edje_collection_cache = size;
1758 elm_config_focus_highlight_enabled_get(void)
1760 return _elm_config->focus_highlight_enable;
1764 elm_config_focus_highlight_enabled_set(Eina_Bool enable)
1766 _elm_config->focus_highlight_enable = !!enable;
1770 elm_config_focus_highlight_animate_get(void)
1772 return _elm_config->focus_highlight_animate;
1776 elm_config_focus_highlight_animate_set(Eina_Bool animate)
1778 _elm_config->focus_highlight_animate = !!animate;
1782 elm_config_scroll_bounce_enabled_get(void)
1784 return _elm_config->thumbscroll_bounce_enable;
1788 elm_config_scroll_bounce_enabled_set(Eina_Bool enabled)
1790 _elm_config->thumbscroll_bounce_enable = enabled;
1794 elm_config_scroll_bounce_friction_get(void)
1796 return _elm_config->thumbscroll_bounce_friction;
1800 elm_config_scroll_bounce_friction_set(double friction)
1802 _elm_config->thumbscroll_bounce_friction = friction;
1806 elm_config_scroll_page_scroll_friction_get(void)
1808 return _elm_config->page_scroll_friction;
1812 elm_config_scroll_page_scroll_friction_set(double friction)
1814 _elm_config->page_scroll_friction = friction;
1818 elm_config_scroll_bring_in_scroll_friction_get(void)
1820 return _elm_config->bring_in_scroll_friction;
1824 elm_config_scroll_bring_in_scroll_friction_set(double friction)
1826 _elm_config->bring_in_scroll_friction = friction;
1830 elm_config_scroll_zoom_friction_get(void)
1832 return _elm_config->zoom_friction;
1836 elm_config_scroll_zoom_friction_set(double friction)
1838 _elm_config->zoom_friction = friction;
1842 elm_config_scroll_thumbscroll_enabled_get(void)
1844 return _elm_config->thumbscroll_enable;
1848 elm_config_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
1850 _elm_config->thumbscroll_enable = enabled;
1854 elm_config_scroll_thumbscroll_threshold_get(void)
1856 return _elm_config->thumbscroll_threshold;
1860 elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold)
1862 _elm_config->thumbscroll_threshold = threshold;
1866 elm_config_scroll_thumbscroll_momentum_threshold_get(void)
1868 return _elm_config->thumbscroll_momentum_threshold;
1872 elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold)
1874 _elm_config->thumbscroll_momentum_threshold = threshold;
1878 elm_config_scroll_thumbscroll_friction_get(void)
1880 return _elm_config->thumbscroll_friction;
1884 elm_config_scroll_thumbscroll_friction_set(double friction)
1886 _elm_config->thumbscroll_friction = friction;
1890 elm_config_scroll_thumbscroll_border_friction_get(void)
1892 return _elm_config->thumbscroll_border_friction;
1896 elm_config_scroll_thumbscroll_border_friction_set(double friction)
1898 if (friction < 0.0) friction = 0.0;
1899 if (friction > 1.0) friction = 1.0;
1900 _elm_config->thumbscroll_friction = friction;
1904 elm_config_scroll_thumbscroll_sensitivity_friction_get(void)
1906 return _elm_config->thumbscroll_sensitivity_friction;
1910 elm_config_scroll_thumbscroll_sensitivity_friction_set(double friction)
1912 if (friction < 0.1) friction = 0.1;
1913 if (friction > 1.0) friction = 1.0;
1914 _elm_config->thumbscroll_friction = friction;
1918 elm_config_longpress_timeout_set(double longpress_timeout)
1920 _elm_config->longpress_timeout = longpress_timeout;
1924 elm_config_longpress_timeout_get(void)
1926 return _elm_config->longpress_timeout;
1930 elm_config_all_flush(void)
1932 #ifdef HAVE_ELEMENTARY_X
1933 if (_prop_all_update_timer) ecore_timer_del(_prop_all_update_timer);
1934 _prop_all_update_timer = ecore_timer_add(0.1, _prop_all_update_cb, NULL);
1942 const char *cur_dom = textdomain(NULL);
1943 const char *trans_comment = gettext("");
1944 const char *msg_locale = setlocale(LC_MESSAGES, NULL);
1946 /* Same concept as what glib does:
1947 * We shouldn't translate if there are no translations for the
1948 * application in the current locale + domain. (Unless locale is
1949 * en_/C where translating only parts of the interface make some
1952 _elm_config->translate = !(strcmp (cur_dom, "messages") &&
1953 !*trans_comment && strncmp (msg_locale, "en_", 3) &&
1954 strcmp (msg_locale, "C"));
1959 _elm_config_init(void)
1961 if (!ELM_EVENT_CONFIG_ALL_CHANGED)
1962 ELM_EVENT_CONFIG_ALL_CHANGED = ecore_event_type_new();
1964 _profile_fetch_from_conf();
1966 if (_elm_preferred_engine) eina_stringshare_del(_elm_preferred_engine);
1967 if (_elm_config->engine)
1968 _elm_preferred_engine = eina_stringshare_add(_elm_config->engine);
1970 _elm_preferred_engine = NULL;
1971 _translation_init();
1974 _elm_config_font_overlay_apply();
1979 _elm_config_sub_shutdown(void)
1981 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1982 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1983 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
1984 ENGINE_COMPARE(ELM_XRENDER_X11) ||
1985 ENGINE_COMPARE(ELM_OPENGL_X11) ||
1986 ENGINE_COMPARE(ELM_OPENGL_COCOA))
1987 #undef ENGINE_COMPARE
1989 #ifdef HAVE_ELEMENTARY_X
1990 ecore_x_disconnect();
1996 _elm_config_sub_init(void)
1998 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1999 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2000 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2001 ENGINE_COMPARE(ELM_XRENDER_X11) ||
2002 ENGINE_COMPARE(ELM_OPENGL_X11) ||
2003 ENGINE_COMPARE(ELM_OPENGL_COCOA))
2004 #undef ENGINE_COMPARE
2006 #ifdef HAVE_ELEMENTARY_X
2007 if (!ecore_x_init(NULL))
2009 ERR("Cannot connect to X11 display. check $DISPLAY variable");
2012 _root_1st = ecore_x_window_root_first_get();
2014 if (!ecore_x_screen_is_composited(0))
2015 _elm_config->compositing = 0;
2017 ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
2018 ecore_x_event_mask_set(_root_1st,
2019 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
2020 _prop_change_handler = ecore_event_handler_add
2021 (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL);
2022 if (!getenv("ELM_PROFILE"))
2026 s = ecore_x_window_prop_string_get(_root_1st,
2027 _atom[ATOM_E_PROFILE]);
2034 if (strcmp(_elm_profile, s)) changed = 1;
2038 if (changed) _prop_config_get();
2043 _config_sub_apply();
2047 _elm_config_reload(void)
2052 _elm_config_font_overlay_apply();
2058 _elm_config_engine_set(const char *engine)
2060 if (_elm_config->engine && strcmp(_elm_config->engine, engine))
2061 eina_stringshare_del(_elm_config->engine);
2063 _elm_config->engine = eina_stringshare_add(engine);
2067 elm_config_preferred_engine_get(void)
2069 return _elm_preferred_engine;
2073 elm_config_preferred_engine_set(const char *engine)
2076 eina_stringshare_replace(&(_elm_preferred_engine), engine);
2079 if (_elm_preferred_engine) eina_stringshare_del(_elm_preferred_engine);
2080 _elm_preferred_engine = eina_stringshare_add(_elm_config->engine);
2085 _elm_config_profile_set(const char *profile)
2087 Eina_Bool changed = EINA_FALSE;
2091 if (strcmp(_elm_profile, profile))
2096 _elm_profile = strdup(profile);
2103 _elm_config_font_overlay_apply();
2110 _elm_config_shutdown(void)
2112 #ifdef HAVE_ELEMENTARY_X
2113 if (_prop_all_update_timer)
2115 ecore_timer_del(_prop_all_update_timer);
2116 _prop_all_update_timer = NULL;
2117 _prop_all_update_cb(NULL);
2119 if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer);
2120 _prop_change_delay_timer = NULL;
2123 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2124 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2125 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2126 ENGINE_COMPARE(ELM_XRENDER_X11) ||
2127 ENGINE_COMPARE(ELM_OPENGL_X11))
2128 #undef ENGINE_COMPARE
2130 #ifdef HAVE_ELEMENTARY_X
2131 ecore_event_handler_del(_prop_change_handler);
2132 _prop_change_handler = NULL;
2136 if (_elm_preferred_engine)
2138 eina_stringshare_del(_elm_preferred_engine);
2139 _elm_preferred_engine = NULL;
2144 _elm_profile = NULL;