2 # include "elementary_config.h"
5 #include <Elementary.h>
9 EAPI int ELM_EVENT_CONFIG_ALL_CHANGED = 0;
11 Elm_Config *_elm_config = NULL;
12 char *_elm_profile = NULL;
13 static Eet_Data_Descriptor *_config_edd = NULL;
14 static Eet_Data_Descriptor *_config_font_overlay_edd = NULL;
15 static Eet_Data_Descriptor *_config_color_edd = NULL;
16 static Eet_Data_Descriptor *_config_color_palette_edd = NULL;
17 static Eet_Data_Descriptor *_config_color_overlay_edd = NULL;
18 static Eet_Data_Descriptor *_config_bindings_widget_edd = NULL;
19 static Eet_Data_Descriptor *_config_binding_key_edd = NULL;
20 static Eet_Data_Descriptor *_config_binding_modifier_edd = NULL;
21 const char *_elm_preferred_engine = NULL;
22 const char *_elm_accel_preference = NULL;
23 const char *_elm_gl_preference = NULL;
24 Eina_List *_font_overlays_del = NULL;
25 Eina_List *_color_overlays_del = NULL;
27 static Ecore_Poller *_elm_cache_flush_poller = NULL;
28 static void _elm_config_key_binding_hash(void);
29 static Ecore_Timer *_config_change_delay_timer = NULL;
30 Eio_Monitor *_eio_monitor = NULL;
32 Eina_Hash *_elm_key_bindings = NULL;
34 const char *_elm_engines[] = {
52 /* whenever you want to add a new text class support into Elementary,
53 declare it both here and in the (default) theme */
54 static const Elm_Text_Class _elm_text_classes[] = {
58 {"title_bar", "Title Bar"},
59 {"list_item", "List Items"},
60 {"grid_item", "Grid Items"},
61 {"toolbar_item", "Toolbar Items"},
62 {"menu_item", "Menu Items"},
66 /* whenever you want to add a new class class support into Elementary,
67 declare it both here and in the (default) theme */
68 static const Elm_Color_Class _elm_color_classes[] = {
69 {"button_text", "Button Text"},
70 {"button_text_disabled", "Button Disabled Text"},
71 {"button_text_anchor", "Anchor Button Text"},
72 {"button_text_anchor_disabled", "Anchor Button Disabled Text"},
73 {"hoversel_item_active", "Hoversel Item Text"},
74 {"hoversel_text_disabled", "Hoversel Item Disabled Text"},
75 {"radio_text", "Radio Text"},
76 {"frame", "Frame Text"},
77 {"entry", "Entry Text"},
78 {"check_text", "Check Text"},
79 {"check_on_text", "Check On Text"},
80 {"check_off_text", "Check Off Text"},
81 {"list_item_base", "List Item Base"},
82 {"list_item_base_odd", "List Odd Item Base"},
83 {"list_item_disabled", "List Item Disabled Base"},
84 {"list_item_selected", "List Item Selected Base"},
85 {"grid_item", "Grid Item Text"},
86 {"grid_item_disabled", "Grid Item Disabled Text"},
87 {"grid_item_selected", "Grid Item Selected Text"},
88 {"toolbar_item", "Toolbar Item Text"},
89 {"toolbar_item_disabled", "Toolbar Item Disabled Text"},
90 {"toolbar_item_selected", "Toolbar Item Selected Text"},
91 {"toolbar_item_active", "Toolbar Item Active Text"},
92 {"slider_text", "Slider Text"},
93 {"slider_text_disabled", "Slider Disabled Text"},
94 {"slider_indicator", "Slider Indicator Text"},
95 {"progressbar_text", "Progressbar Text"},
96 {"progressbar_text_disabled", "Progressbar Disabled Text"},
97 {"progressbar_status", "Progressbar Status Text"},
98 {"bubble_text", "Bubble Text"},
99 {"bubble_info", "Bubble Info Text"},
100 {"menu_item_active", "Menu Item Text"},
101 {"menu_item_disabled", "Menu Item Disabled Text"},
102 {"border_title", "Border Title Text"},
103 {"border_title_active", "Border Title Active Text"},
104 {"datetime_text", "Datetime Text"},
105 {"multibuttonentry_label", "Multibuttonentry Text"},
106 {"spinner", "Spinner Text"},
107 {"spinner_disabled", "Spinner Disabled Text"},
111 static void _config_free(Elm_Config *cfg);
112 static void _config_apply(void);
113 static void _config_sub_apply(void);
114 static void _config_update(void);
115 static void _env_get(void);
116 static void _color_overlays_cancel(void);
118 #define ELM_CONFIG_VAL(edd, type, member, dtype) \
119 EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
120 #define ELM_CONFIG_LIST(edd, type, member, eddtype) \
121 EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype)
124 _elm_font_overlays_del_free(void)
128 EINA_LIST_FOREACH(_font_overlays_del, l, text_class)
129 eina_stringshare_del(text_class);
130 _font_overlays_del = eina_list_free(_font_overlays_del);
134 _elm_config_font_overlays_cancel(void)
136 Elm_Font_Overlay *efd;
138 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
139 edje_text_class_del(efd->text_class);
145 Eet_Data_Descriptor_Class eddc;
147 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config);
148 eddc.func.str_direct_alloc = NULL;
149 eddc.func.str_direct_free = NULL;
151 _config_edd = eet_data_descriptor_file_new(&eddc);
154 ERR("EEEK! eet_data_descriptor_file_new() failed.");
158 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
159 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Font_Overlay);
160 eddc.func.str_direct_alloc = NULL;
161 eddc.func.str_direct_free = NULL;
163 _config_font_overlay_edd = eet_data_descriptor_stream_new(&eddc);
164 if (!_config_font_overlay_edd)
166 ERR("EEEK! eet_data_descriptor_stream_new() failed.");
167 eet_data_descriptor_free(_config_edd);
171 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
172 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Color_RGBA);
173 eddc.func.str_direct_alloc = NULL;
174 eddc.func.str_direct_free = NULL;
176 _config_color_edd = eet_data_descriptor_stream_new(&eddc);
177 if (!_config_color_edd)
179 ERR("EEEK! eet_data_descriptor_stream_new() failed.");
180 eet_data_descriptor_free(_config_edd);
184 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
185 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Custom_Palette);
186 eddc.func.str_direct_alloc = NULL;
187 eddc.func.str_direct_free = NULL;
189 _config_color_palette_edd = eet_data_descriptor_stream_new(&eddc);
190 if (!_config_color_palette_edd)
192 ERR("EEEK! eet_data_descriptor_stream_new() failed.");
193 eet_data_descriptor_free(_config_edd);
197 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
198 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Color_Overlay);
199 eddc.func.str_direct_alloc = NULL;
200 eddc.func.str_direct_free = NULL;
202 _config_color_overlay_edd = eet_data_descriptor_stream_new(&eddc);
203 if (!_config_color_overlay_edd)
205 ERR("EEEK! eet_data_descriptor_stream_new() failed.");
206 eet_data_descriptor_free(_config_edd);
210 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
211 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config_Bindings_Widget);
212 eddc.func.str_direct_alloc = NULL;
213 eddc.func.str_direct_free = NULL;
215 _config_bindings_widget_edd = eet_data_descriptor_stream_new(&eddc);
216 if (!_config_bindings_widget_edd)
218 ERR("EEEK! eet_data_descriptor_stream_new() failed.");
219 eet_data_descriptor_free(_config_edd);
223 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
224 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config_Binding_Key);
225 eddc.func.str_direct_alloc = NULL;
226 eddc.func.str_direct_free = NULL;
228 _config_binding_key_edd = eet_data_descriptor_stream_new(&eddc);
229 if (!_config_binding_key_edd)
231 ERR("EEEK! eet_data_descriptor_stream_new() failed.");
232 eet_data_descriptor_free(_config_edd);
236 memset(&eddc, 0, sizeof(eddc)); /* just in case... */
237 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config_Binding_Modifier);
238 eddc.func.str_direct_alloc = NULL;
239 eddc.func.str_direct_free = NULL;
241 _config_binding_modifier_edd = eet_data_descriptor_stream_new(&eddc);
242 if (!_config_binding_modifier_edd)
244 ERR("EEEK! eet_data_descriptor_stream_new() failed.");
245 eet_data_descriptor_free(_config_edd);
249 #define T_INT EET_T_INT
250 #define T_DOUBLE EET_T_DOUBLE
251 #define T_STRING EET_T_STRING
252 #define T_UCHAR EET_T_UCHAR
254 #define T Elm_Font_Overlay
255 #define D _config_font_overlay_edd
256 ELM_CONFIG_VAL(D, T, text_class, EET_T_STRING);
257 ELM_CONFIG_VAL(D, T, font, EET_T_STRING);
258 ELM_CONFIG_VAL(D, T, size, EET_T_INT);
262 #define T Elm_Color_RGBA
263 #define D _config_color_edd
264 ELM_CONFIG_VAL(D, T, r, EET_T_UINT);
265 ELM_CONFIG_VAL(D, T, g, EET_T_UINT);
266 ELM_CONFIG_VAL(D, T, b, EET_T_UINT);
267 ELM_CONFIG_VAL(D, T, a, EET_T_UINT);
271 #define T Elm_Custom_Palette
272 #define D _config_color_palette_edd
273 ELM_CONFIG_VAL(D, T, palette_name, EET_T_STRING);
274 ELM_CONFIG_LIST(D, T, color_list, _config_color_edd);
278 #define T Elm_Color_Overlay
279 #define D _config_color_overlay_edd
280 ELM_CONFIG_VAL(D, T, color_class, EET_T_STRING);
281 ELM_CONFIG_VAL(D, T, color.r, EET_T_UCHAR);
282 ELM_CONFIG_VAL(D, T, color.g, EET_T_UCHAR);
283 ELM_CONFIG_VAL(D, T, color.b, EET_T_UCHAR);
284 ELM_CONFIG_VAL(D, T, color.a, EET_T_UCHAR);
285 ELM_CONFIG_VAL(D, T, outline.r, EET_T_UCHAR);
286 ELM_CONFIG_VAL(D, T, outline.g, EET_T_UCHAR);
287 ELM_CONFIG_VAL(D, T, outline.b, EET_T_UCHAR);
288 ELM_CONFIG_VAL(D, T, outline.a, EET_T_UCHAR);
289 ELM_CONFIG_VAL(D, T, shadow.r, EET_T_UCHAR);
290 ELM_CONFIG_VAL(D, T, shadow.g, EET_T_UCHAR);
291 ELM_CONFIG_VAL(D, T, shadow.b, EET_T_UCHAR);
292 ELM_CONFIG_VAL(D, T, shadow.a, EET_T_UCHAR);
296 #define T Elm_Config_Bindings_Widget
297 #define D _config_bindings_widget_edd
298 ELM_CONFIG_VAL(D, T, name, EET_T_STRING);
299 ELM_CONFIG_LIST(D, T, key_bindings, _config_binding_key_edd);
303 #define T Elm_Config_Binding_Key
304 #define D _config_binding_key_edd
305 ELM_CONFIG_VAL(D, T, context, EET_T_INT);
306 ELM_CONFIG_VAL(D, T, key, EET_T_STRING);
307 ELM_CONFIG_VAL(D, T, action, EET_T_STRING);
308 ELM_CONFIG_VAL(D, T, params, EET_T_STRING);
309 ELM_CONFIG_LIST(D, T, modifiers, _config_binding_modifier_edd);
313 #define T Elm_Config_Binding_Modifier
314 #define D _config_binding_modifier_edd
315 ELM_CONFIG_VAL(D, T, mod, EET_T_STRING);
316 ELM_CONFIG_VAL(D, T, flag, EET_T_UCHAR);
321 #define D _config_edd
322 ELM_CONFIG_VAL(D, T, config_version, T_INT);
323 ELM_CONFIG_VAL(D, T, engine, T_STRING);
324 ELM_CONFIG_VAL(D, T, accel, T_STRING);
325 ELM_CONFIG_VAL(D, T, accel_override, T_UCHAR);
326 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
327 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
328 ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
329 ELM_CONFIG_VAL(D, T, thumbscroll_hold_threshold, T_INT);
330 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
331 ELM_CONFIG_VAL(D, T, thumbscroll_flick_distance_tolerance, T_INT);
332 ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
333 ELM_CONFIG_VAL(D, T, thumbscroll_min_friction, T_DOUBLE);
334 ELM_CONFIG_VAL(D, T, thumbscroll_friction_standard, T_DOUBLE);
335 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
336 ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
337 ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
338 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_threshold, T_DOUBLE);
339 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_time_limit, T_DOUBLE);
340 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_weight, T_DOUBLE);
341 ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
342 ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
343 ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
344 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
345 ELM_CONFIG_VAL(D, T, scroll_smooth_start_enable, T_UCHAR);
346 // ELM_CONFIG_VAL(D, T, scroll_smooth_time_interval, T_DOUBLE); // not used anymore
347 ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
348 // ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE); // not used anymore
349 // ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE); // not used anymore
350 ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
351 ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
352 ELM_CONFIG_VAL(D, T, win_no_border, T_INT);
353 ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
354 ELM_CONFIG_VAL(D, T, compositing, T_INT);
355 /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
356 ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd);
357 ELM_CONFIG_VAL(D, T, font_hinting, T_INT);
358 ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT);
359 ELM_CONFIG_VAL(D, T, cache_flush_enable, T_UCHAR);
360 ELM_CONFIG_VAL(D, T, image_cache, T_INT);
361 ELM_CONFIG_VAL(D, T, font_cache, T_INT);
362 ELM_CONFIG_VAL(D, T, edje_cache, T_INT);
363 ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT);
364 ELM_CONFIG_VAL(D, T, finger_size, T_INT);
365 ELM_CONFIG_VAL(D, T, fps, T_DOUBLE);
366 ELM_CONFIG_VAL(D, T, theme, T_STRING);
367 ELM_CONFIG_VAL(D, T, modules, T_STRING);
368 ELM_CONFIG_VAL(D, T, tooltip_delay, T_DOUBLE);
369 ELM_CONFIG_VAL(D, T, cursor_engine_only, T_UCHAR);
370 ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR);
371 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
372 ELM_CONFIG_VAL(D, T, focus_highlight_clip_disable, T_UCHAR);
373 ELM_CONFIG_VAL(D, T, focus_move_policy, T_UCHAR);
374 ELM_CONFIG_VAL(D, T, focus_autoscroll_mode, T_UCHAR);
375 ELM_CONFIG_VAL(D, T, slider_indicator_visible_mode, T_INT);
376 ELM_CONFIG_VAL(D, T, item_select_on_focus_disable, T_UCHAR);
377 ELM_CONFIG_VAL(D, T, first_item_focus_on_first_focus_in, T_UCHAR);
378 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
379 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
380 ELM_CONFIG_VAL(D, T, fileselector_double_tap_navigation_enable, T_UCHAR);
381 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR);
382 ELM_CONFIG_VAL(D, T, icon_size, T_INT);
383 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
384 ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR);
385 ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR);
386 ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR);
387 ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE);
388 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_enable, T_UCHAR);
389 ELM_CONFIG_VAL(D, T, glayer_zoom_finger_factor, T_DOUBLE);
390 ELM_CONFIG_VAL(D, T, glayer_zoom_wheel_factor, T_DOUBLE);
391 ELM_CONFIG_VAL(D, T, glayer_zoom_distance_tolerance, T_DOUBLE);
392 ELM_CONFIG_VAL(D, T, glayer_rotate_finger_enable, T_UCHAR);
393 ELM_CONFIG_VAL(D, T, glayer_rotate_angular_tolerance, T_DOUBLE);
394 ELM_CONFIG_VAL(D, T, glayer_line_min_length, T_DOUBLE);
395 ELM_CONFIG_VAL(D, T, glayer_line_distance_tolerance, T_DOUBLE);
396 ELM_CONFIG_VAL(D, T, glayer_line_angular_tolerance, T_DOUBLE);
397 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
398 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
399 ELM_CONFIG_VAL(D, T, glayer_double_tap_timeout, T_DOUBLE);
400 ELM_CONFIG_VAL(D, T, access_mode, T_UCHAR);
401 ELM_CONFIG_VAL(D, T, selection_clear_enable, T_UCHAR);
402 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
403 ELM_CONFIG_VAL(D, T, week_start, T_INT);
404 ELM_CONFIG_VAL(D, T, weekend_start, T_INT);
405 ELM_CONFIG_VAL(D, T, weekend_len, T_INT);
406 ELM_CONFIG_VAL(D, T, year_min, T_INT);
407 ELM_CONFIG_VAL(D, T, year_max, T_INT);
408 ELM_CONFIG_LIST(D, T, color_overlays, _config_color_overlay_edd);
409 ELM_CONFIG_LIST(D, T, color_palette, _config_color_palette_edd);
410 ELM_CONFIG_VAL(D, T, softcursor_mode, T_UCHAR);
411 ELM_CONFIG_VAL(D, T, auto_norender_withdrawn, T_UCHAR);
412 ELM_CONFIG_VAL(D, T, auto_norender_iconified_same_as_withdrawn, T_UCHAR);
413 ELM_CONFIG_VAL(D, T, auto_flush_withdrawn, T_UCHAR);
414 ELM_CONFIG_VAL(D, T, auto_dump_withdrawn, T_UCHAR);
415 ELM_CONFIG_VAL(D, T, auto_throttle, T_UCHAR);
416 ELM_CONFIG_VAL(D, T, auto_throttle_amount, T_DOUBLE);
417 ELM_CONFIG_VAL(D, T, indicator_service_0, T_STRING);
418 ELM_CONFIG_VAL(D, T, indicator_service_90, T_STRING);
419 ELM_CONFIG_VAL(D, T, indicator_service_180, T_STRING);
420 ELM_CONFIG_VAL(D, T, indicator_service_270, T_STRING);
421 ELM_CONFIG_VAL(D, T, disable_external_menu, T_UCHAR);
422 ELM_CONFIG_VAL(D, T, clouseau_enable, T_UCHAR);
423 ELM_CONFIG_VAL(D, T, magnifier_enable, T_UCHAR);
424 ELM_CONFIG_VAL(D, T, magnifier_scale, T_DOUBLE);
425 ELM_CONFIG_VAL(D, T, audio_mute_effect, T_UCHAR);
426 ELM_CONFIG_VAL(D, T, audio_mute_background, T_UCHAR);
427 ELM_CONFIG_VAL(D, T, audio_mute_music, T_UCHAR);
428 ELM_CONFIG_VAL(D, T, audio_mute_foreground, T_UCHAR);
429 ELM_CONFIG_VAL(D, T, audio_mute_interface, T_UCHAR);
430 ELM_CONFIG_VAL(D, T, audio_mute_input, T_UCHAR);
431 ELM_CONFIG_VAL(D, T, audio_mute_alert, T_UCHAR);
432 ELM_CONFIG_VAL(D, T, audio_mute_all, T_UCHAR);
433 ELM_CONFIG_LIST(D, T, bindings, _config_bindings_widget_edd);
434 ELM_CONFIG_VAL(D, T, atspi_mode, T_UCHAR);
435 ELM_CONFIG_VAL(D, T, win_auto_focus_enable, T_UCHAR);
436 ELM_CONFIG_VAL(D, T, win_auto_focus_animate, T_UCHAR);
437 ELM_CONFIG_VAL(D, T, transition_duration_factor, T_DOUBLE);
438 ELM_CONFIG_VAL(D, T, naviframe_prev_btn_auto_pushed, T_UCHAR);
439 ELM_CONFIG_VAL(D, T, popup_horizontal_align, T_DOUBLE);
440 ELM_CONFIG_VAL(D, T, popup_vertical_align, T_DOUBLE);
454 eet_data_descriptor_free(_config_edd);
458 if (_config_font_overlay_edd)
460 eet_data_descriptor_free(_config_font_overlay_edd);
461 _config_font_overlay_edd = NULL;
464 if (_config_color_edd)
466 eet_data_descriptor_free(_config_color_edd);
467 _config_color_edd = NULL;
470 if (_config_color_palette_edd)
472 eet_data_descriptor_free(_config_color_palette_edd);
473 _config_color_palette_edd = NULL;
476 if (_config_color_overlay_edd)
478 eet_data_descriptor_free(_config_color_overlay_edd);
479 _config_color_overlay_edd = NULL;
482 if (_config_bindings_widget_edd)
484 eet_data_descriptor_free(_config_bindings_widget_edd);
485 _config_bindings_widget_edd = NULL;
488 if (_config_binding_key_edd)
490 eet_data_descriptor_free(_config_binding_key_edd);
491 _config_binding_key_edd = NULL;
494 if (_config_binding_modifier_edd)
496 eet_data_descriptor_free(_config_binding_modifier_edd);
497 _config_binding_modifier_edd = NULL;
502 _sort_files_cb(const void *f1,
505 return strcmp(f1, f2);
509 _elm_config_current_profile_get(void)
515 _elm_data_dir_snprintf(char *dst,
520 size_t data_dir_len, off;
523 data_dir_len = eina_strlcpy(dst, _elm_data_dir, size);
525 off = data_dir_len + 1;
530 dst[data_dir_len] = '/';
532 off = off + vsnprintf(dst + off, size - off, fmt, ap);
540 _elm_config_user_dir_snprintf(char *dst,
545 const char *home = NULL;
546 size_t user_dir_len = 0, off = 0;
549 #if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
550 if (getuid() == geteuid())
554 home = getenv("XDG_CONFIG_HOME");
557 user_dir_len = eina_str_join_len
558 (dst, size, '/', home, strlen(home),
559 "elementary", sizeof("elementary") - 1);
564 home = eina_environment_home_get();
565 if (!home) home = "/";
567 user_dir_len = eina_str_join_len
568 (dst, size, '/', home, strlen(home),
569 ".config", sizeof(".config") - 1,
570 "elementary", sizeof("elementary") - 1);
572 user_dir_len = eina_str_join_len
573 (dst, size, '/', home, strlen(home),
574 ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
577 off = user_dir_len + 1;
578 if (off >= size) return off;
579 dst[user_dir_len] = '/';
581 off = off + vsnprintf(dst + off, size - off, fmt, ap);
585 #if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
590 struct passwd *pw = getpwent();
592 if ((!pw) || (!pw->pw_dir)) goto end;
594 user_dir_len = eina_str_join_len
595 (dst, size, '/', pw->pw_dir, strlen(pw->pw_dir),
596 ".config", sizeof(".config") - 1,
597 "elementary", sizeof("elementary") - 1);
599 user_dir_len = eina_str_join_len
600 (dst, size, '/', pw->pw_dir, strlen(pw->pw_dir),
601 ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
603 # endif /* HAVE_GETPWENT */
604 off = user_dir_len + 1;
605 if (off >= size) return off;
606 dst[user_dir_len] = '/';
608 off = off + vsnprintf(dst + off, size - off, fmt, ap);
617 _elm_config_profile_dir_get(const char *prof,
625 _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof);
627 if (ecore_file_is_dir(buf))
633 snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof);
635 if (ecore_file_is_dir(buf))
642 _elm_config_font_overlays_list(void)
644 return _elm_config->font_overlays;
647 Eina_Bool _elm_config_access_get(void)
649 return _elm_config->access_mode;
652 void _elm_config_access_set(Eina_Bool is_access)
654 is_access = !!is_access;
655 if (_elm_config->access_mode == is_access) return;
656 _elm_config->access_mode = is_access;
657 _elm_win_access(is_access);
659 if (!is_access) _elm_access_shutdown();
662 Eina_Bool _elm_config_atspi_mode_get(void)
664 return _elm_config->atspi_mode;
667 void _elm_config_atspi_mode_set(Eina_Bool is_enabled)
669 is_enabled = !!is_enabled;
670 if (_elm_config->atspi_mode == is_enabled) return;
671 _elm_config->atspi_mode = is_enabled;
673 if (!is_enabled) _elm_atspi_bridge_shutdown();
674 else _elm_atspi_bridge_init();
677 Eina_Bool _elm_config_selection_unfocused_clear_get(void)
679 return _elm_config->selection_clear_enable;
682 void _elm_config_selection_unfocused_clear_set(Eina_Bool enabled)
685 if (_elm_config->selection_clear_enable == enabled) return;
686 _elm_config->selection_clear_enable = enabled;
690 _elm_config_font_overlay_set(const char *text_class,
694 Elm_Font_Overlay *efd;
697 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
699 if (strcmp(efd->text_class, text_class))
702 eina_stringshare_del(efd->font);
703 efd->font = eina_stringshare_add(font);
705 _elm_config->font_overlays =
706 eina_list_promote_list(_elm_config->font_overlays, l);
710 /* the text class doesn't exist */
711 efd = calloc(1, sizeof(Elm_Font_Overlay));
712 efd->text_class = eina_stringshare_add(text_class);
713 efd->font = eina_stringshare_add(font);
716 _elm_config->font_overlays = eina_list_prepend(_elm_config->font_overlays,
721 _elm_config_font_overlay_remove(const char *text_class)
723 Elm_Font_Overlay *efd;
726 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
728 if (!efd->text_class) continue;
729 if (strcmp(efd->text_class, text_class)) continue;
732 eina_list_append(_font_overlays_del,
733 eina_stringshare_add(text_class));
734 _elm_config->font_overlays =
735 eina_list_remove_list(_elm_config->font_overlays, l);
736 eina_stringshare_del(efd->text_class);
737 eina_stringshare_del(efd->font);
745 _elm_config_font_overlay_apply(void)
747 Elm_Font_Overlay *efd;
750 EINA_LIST_FOREACH(_font_overlays_del, l, text_class)
752 edje_text_class_del(text_class);
753 eina_stringshare_del(text_class);
755 _font_overlays_del = eina_list_free(_font_overlays_del);
757 EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd)
758 edje_text_class_set(efd->text_class, efd->font, efd->size);
762 _elm_config_text_classes_get(void)
764 Eina_List *ret = NULL;
767 for (i = 0; _elm_text_classes[i].desc; i++)
770 tc = malloc(sizeof(*tc));
773 *tc = _elm_text_classes[i];
775 ret = eina_list_append(ret, tc);
782 _elm_config_text_classes_free(Eina_List *l)
786 EINA_LIST_FREE(l, tc)
791 _elm_config_color_classes_get(void)
793 Eina_List *ret = NULL;
796 for (i = 0; _elm_color_classes[i].desc; i++)
799 cc = malloc(sizeof(*cc));
802 *cc = _elm_color_classes[i];
804 ret = eina_list_append(ret, cc);
811 _elm_config_color_classes_free(Eina_List *l)
815 EINA_LIST_FREE(l, cc)
820 _color_overlays_cancel(void)
822 Elm_Color_Overlay *ecd;
824 EINA_LIST_FOREACH(_elm_config->color_overlays, l, ecd)
825 edje_color_class_del(ecd->color_class);
829 _elm_config_color_overlays_list(void)
831 return _elm_config->color_overlays;
835 _elm_config_color_overlay_set(const char *color_class,
836 int r, int g, int b, int a,
837 int r2, int g2, int b2, int a2,
838 int r3, int g3, int b3, int a3)
840 Elm_Color_Overlay *ecd;
843 #define CHECK_COLOR_VAL(v) v = (v > 255)? 255 : (v < 0)? 0: v
856 #undef CHECK_COLOR_VAL
858 EINA_LIST_FOREACH(_elm_config->color_overlays, l, ecd)
860 if (!eina_streq(ecd->color_class, color_class))
876 _elm_config->color_overlays =
877 eina_list_promote_list(_elm_config->color_overlays, l);
881 /* the color class doesn't exist */
882 ecd = calloc(1, sizeof(Elm_Color_Overlay));
885 ecd->color_class = eina_stringshare_add(color_class);
899 _elm_config->color_overlays =
900 eina_list_prepend(_elm_config->color_overlays, ecd);
904 _elm_config_color_overlay_remove(const char *color_class)
906 Elm_Color_Overlay *ecd;
909 EINA_LIST_FOREACH(_elm_config->color_overlays, l, ecd)
911 if (!ecd->color_class) continue;
912 if (!eina_streq(ecd->color_class, color_class)) continue;
914 _color_overlays_del =
915 eina_list_append(_color_overlays_del,
916 eina_stringshare_add(color_class));
917 _elm_config->color_overlays =
918 eina_list_remove_list(_elm_config->color_overlays, l);
919 eina_stringshare_del(ecd->color_class);
927 _elm_config_color_overlay_apply(void)
929 Elm_Color_Overlay *ecd;
933 EINA_LIST_FREE(_color_overlays_del, color_class)
935 edje_color_class_del(color_class);
936 eina_stringshare_del(color_class);
939 EINA_LIST_FOREACH(_elm_config->color_overlays, l, ecd)
940 edje_color_class_set(ecd->color_class,
941 ecd->color.r, ecd->color.g, ecd->color.b, ecd->color.a,
942 ecd->outline.r, ecd->outline.g, ecd->outline.b, ecd->outline.a,
943 ecd->shadow.r, ecd->shadow.g, ecd->shadow.b, ecd->shadow.a);
947 _elm_config_color_list_get(const char *palette_name)
950 Elm_Custom_Palette *cpalette;
951 EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette)
953 if (strcmp(cpalette->palette_name, palette_name))
955 return cpalette->color_list;
961 _elm_config_color_set(const char *palette_name,
968 Elm_Custom_Palette *cpalette;
969 Elm_Color_RGBA *color;
970 EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette)
972 if (strcmp(cpalette->palette_name, palette_name))
975 color = calloc(1, sizeof(Elm_Color_RGBA));
980 cpalette->color_list = eina_list_prepend(cpalette->color_list,
986 _elm_config_colors_free(const char *palette_name)
989 Elm_Custom_Palette *cpalette;
990 Elm_Color_RGBA *color;
991 EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette)
993 if (strcmp(cpalette->palette_name, palette_name))
996 EINA_LIST_FREE(cpalette->color_list, color)
1004 _elm_config_profiles_list(void)
1006 Eina_File_Direct_Info *info;
1007 Eina_List *flist = NULL;
1008 Eina_Iterator *file_it;
1013 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config");
1015 file_it = eina_file_stat_ls(buf);
1022 len = sizeof(buf) - len;
1024 EINA_ITERATOR_FOREACH(file_it, info)
1026 if (info->name_length >= len)
1029 if (info->type == EINA_FILE_DIR)
1032 eina_list_sorted_insert(flist, _sort_files_cb,
1033 eina_stringshare_add(info->path +
1038 eina_iterator_free(file_it);
1041 len = eina_str_join_len(buf, sizeof(buf), '/', _elm_data_dir,
1042 strlen(_elm_data_dir), "config",
1043 sizeof("config") - 1);
1045 file_it = eina_file_stat_ls(buf);
1052 len = sizeof(buf) - len;
1053 EINA_ITERATOR_FOREACH(file_it, info)
1055 if (info->name_length >= len)
1065 EINA_LIST_FOREACH(flist, l, tmp)
1066 if (!strcmp(info->path + info->name_start, tmp))
1071 eina_list_sorted_insert(flist, _sort_files_cb,
1072 eina_stringshare_add(info->path +
1081 eina_iterator_free(file_it);
1085 EINA_LIST_FREE(flist, dir)
1086 eina_stringshare_del(dir);
1092 _profile_fetch_from_conf(void)
1094 char buf[PATH_MAX], *p, *s;
1095 Eet_File *ef = NULL;
1098 // if env var - use profile without question
1099 s = getenv("ELM_PROFILE");
1102 _elm_profile = strdup(s);
1105 p = strchr(_elm_profile, '/');
1111 for (i = 0; i < 2; i++)
1115 _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
1118 _elm_data_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
1119 ef = eet_open(buf, EET_FILE_MODE_READ);
1122 p = eet_read(ef, "config", &len);
1125 _elm_profile = malloc(len + 1);
1128 memcpy(_elm_profile, p, len);
1129 _elm_profile[len] = 0;
1134 p = strchr(_elm_profile, '/');
1142 _elm_profile = strdup("default");
1146 _config_free(Elm_Config *cfg)
1148 Elm_Font_Overlay *fo;
1149 const char *fontdir;
1150 Elm_Color_Overlay *co;
1151 Elm_Custom_Palette *palette;
1152 Elm_Color_RGBA *color;
1154 Elm_Config_Bindings_Widget *wb;
1155 Elm_Config_Binding_Key *kb;
1156 Elm_Config_Binding_Modifier *mb;
1159 EINA_LIST_FREE(cfg->font_dirs, fontdir)
1161 eina_stringshare_del(fontdir);
1163 eina_stringshare_del(cfg->engine);
1164 eina_stringshare_del(cfg->accel);
1165 EINA_LIST_FREE(cfg->font_overlays, fo)
1167 eina_stringshare_del(fo->text_class);
1168 eina_stringshare_del(fo->font);
1171 EINA_LIST_FREE(_color_overlays_del, color_class)
1172 eina_stringshare_del(color_class);
1173 EINA_LIST_FREE(cfg->color_overlays, co)
1175 if (co->color_class) eina_stringshare_del(co->color_class);
1178 EINA_LIST_FREE(cfg->color_palette, palette)
1180 eina_stringshare_del(palette->palette_name);
1181 EINA_LIST_FREE(palette->color_list, color) free(color);
1184 EINA_LIST_FREE(cfg->bindings, wb)
1186 eina_stringshare_del(wb->name);
1187 EINA_LIST_FREE(wb->key_bindings, kb)
1189 eina_stringshare_del(kb->key);
1190 eina_stringshare_del(kb->action);
1191 eina_stringshare_del(kb->params);
1192 EINA_LIST_FREE(kb->modifiers, mb)
1194 eina_stringshare_del(mb->mod);
1201 eina_stringshare_del(cfg->theme);
1202 eina_stringshare_del(cfg->modules);
1203 eina_stringshare_del(cfg->indicator_service_0);
1204 eina_stringshare_del(cfg->indicator_service_90);
1205 eina_stringshare_del(cfg->indicator_service_180);
1206 eina_stringshare_del(cfg->indicator_service_270);
1213 _elm_theme_parse(NULL, _elm_config->theme);
1214 ecore_animator_frametime_set(1.0 / _elm_config->fps);
1218 _config_sub_apply(void)
1220 edje_frametime_set(1.0 / _elm_config->fps);
1221 edje_scale_set(_elm_config->scale);
1222 edje_password_show_last_set(_elm_config->password_show_last);
1223 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1224 edje_transition_duration_factor_set(_elm_config->transition_duration_factor);
1225 if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
1226 edje_audio_channel_mute_set(EDJE_CHANNEL_EFFECT, _elm_config->audio_mute_effect);
1227 edje_audio_channel_mute_set(EDJE_CHANNEL_BACKGROUND, _elm_config->audio_mute_background);
1228 edje_audio_channel_mute_set(EDJE_CHANNEL_MUSIC, _elm_config->audio_mute_music);
1229 edje_audio_channel_mute_set(EDJE_CHANNEL_FOREGROUND, _elm_config->audio_mute_foreground);
1230 edje_audio_channel_mute_set(EDJE_CHANNEL_INTERFACE, _elm_config->audio_mute_interface);
1231 edje_audio_channel_mute_set(EDJE_CHANNEL_INPUT, _elm_config->audio_mute_input);
1232 edje_audio_channel_mute_set(EDJE_CHANNEL_ALERT, _elm_config->audio_mute_alert);
1233 edje_audio_channel_mute_set(EDJE_CHANNEL_ALL, _elm_config->audio_mute_all);
1237 _elm_cache_flush_cb(void *data EINA_UNUSED)
1239 elm_cache_all_flush();
1240 return ECORE_CALLBACK_RENEW;
1243 /* kind of abusing this call right now -- shared between all of those
1244 * properties -- but they are not meant to be called that periodically
1252 elm_cache_all_flush();
1254 EINA_LIST_FOREACH(_elm_win_list, l, win)
1256 Evas *e = evas_object_evas_get(win);
1257 evas_image_cache_set(e, _elm_config->image_cache * 1024);
1258 evas_font_cache_set(e, _elm_config->font_cache * 1024);
1260 edje_file_cache_set(_elm_config->edje_cache);
1261 edje_collection_cache_set(_elm_config->edje_collection_cache);
1263 ELM_SAFE_FREE(_elm_cache_flush_poller, ecore_poller_del);
1264 if (_elm_config->cache_flush_enable)
1266 if (_elm_config->cache_flush_poll_interval > 0)
1268 _elm_cache_flush_poller =
1269 ecore_poller_add(ECORE_POLLER_CORE,
1270 _elm_config->cache_flush_poll_interval,
1271 _elm_cache_flush_cb, NULL);
1277 _config_user_load(void)
1279 Elm_Config *cfg = NULL;
1283 _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
1286 ef = eet_open(buf, EET_FILE_MODE_READ);
1289 cfg = eet_data_read(ef, _config_edd, "config");
1297 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/");
1298 if (len + 1 < sizeof(buf))
1299 ecore_file_mkpath(buf);
1306 _config_system_load(void)
1308 Elm_Config *cfg = NULL;
1312 _elm_data_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg",
1315 ef = eet_open(buf, EET_FILE_MODE_READ);
1318 cfg = eet_data_read(ef, _config_edd, "config");
1327 _elm_config = _config_user_load();
1330 if ((_elm_config->config_version >> ELM_CONFIG_VERSION_EPOCH_OFFSET) < ELM_CONFIG_EPOCH)
1332 WRN("User's elementary config seems outdated and unusable. Fallback to load system config.");
1333 _config_free(_elm_config);
1338 if (_elm_config->config_version < ELM_CONFIG_VERSION)
1344 /* no user config, fallback for system. No need to check version for
1345 * this one, if it's not the right one, someone screwed up at the time
1346 * of installing it */
1347 _elm_config = _config_system_load();
1348 if (_elm_config) return;
1349 /* FIXME: config load could have failed because of a non-existent
1350 * profile. Fallback to default before moving on */
1352 // config load fail - defaults
1353 // why are these here? well if they are, it means you can make a gui
1354 // config recovery app i guess...
1355 _elm_config = ELM_NEW(Elm_Config);
1356 _elm_config->config_version = ELM_CONFIG_VERSION;
1357 _elm_config->engine = NULL;
1358 _elm_config->accel = NULL;
1359 _elm_config->accel_override = 0;
1360 _elm_config->vsync = 0;
1361 _elm_config->thumbscroll_enable = EINA_TRUE;
1362 _elm_config->thumbscroll_threshold = 24;
1363 _elm_config->thumbscroll_hold_threshold = 24;
1364 _elm_config->thumbscroll_momentum_threshold = 100.0;
1365 _elm_config->thumbscroll_flick_distance_tolerance = 1000;
1366 _elm_config->thumbscroll_friction = 1.0;
1367 _elm_config->thumbscroll_min_friction = 0.5;
1368 _elm_config->thumbscroll_friction_standard = 1000.0;
1369 _elm_config->thumbscroll_bounce_friction = 0.5;
1370 _elm_config->thumbscroll_bounce_enable = EINA_TRUE;
1371 _elm_config->thumbscroll_acceleration_threshold = 500.0;
1372 _elm_config->thumbscroll_acceleration_time_limit = 0.7;
1373 _elm_config->thumbscroll_acceleration_weight = 1.5;
1374 _elm_config->page_scroll_friction = 0.5;
1375 _elm_config->bring_in_scroll_friction = 0.5;
1376 _elm_config->zoom_friction = 0.5;
1377 _elm_config->thumbscroll_border_friction = 0.5;
1378 _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
1379 _elm_config->scroll_smooth_start_enable = EINA_TRUE;
1380 // _elm_config->scroll_smooth_time_interval = 0.008; // not used anymore
1381 _elm_config->scroll_smooth_amount = 1.0;
1382 // _elm_config->scroll_smooth_history_weight = 0.3; // not used anymore
1383 // _elm_config->scroll_smooth_future_time = 0.0; // not used anymore
1384 _elm_config->scroll_smooth_time_window = 0.15;
1385 _elm_config->scale = 1.0;
1386 _elm_config->win_no_border = 0;
1387 _elm_config->bgpixmap = 0;
1388 _elm_config->compositing = 1;
1389 _elm_config->font_hinting = 2;
1390 _elm_config->cache_flush_poll_interval = 512;
1391 _elm_config->cache_flush_enable = EINA_TRUE;
1392 _elm_config->font_dirs = NULL;
1393 _elm_config->image_cache = 4096;
1394 _elm_config->font_cache = 512;
1395 _elm_config->edje_cache = 32;
1396 _elm_config->edje_collection_cache = 64;
1397 _elm_config->finger_size = 10;
1398 _elm_config->fps = 60.0;
1399 _elm_config->theme = eina_stringshare_add("default");
1400 _elm_config->modules = NULL;
1401 _elm_config->tooltip_delay = 1.0;
1402 _elm_config->cursor_engine_only = EINA_TRUE;
1403 _elm_config->focus_highlight_enable = EINA_FALSE;
1404 _elm_config->focus_highlight_animate = EINA_TRUE;
1405 _elm_config->focus_highlight_clip_disable = EINA_FALSE;
1406 _elm_config->focus_move_policy = ELM_FOCUS_MOVE_POLICY_CLICK;
1407 _elm_config->first_item_focus_on_first_focus_in = EINA_FALSE;
1408 _elm_config->item_select_on_focus_disable = EINA_TRUE;
1409 _elm_config->toolbar_shrink_mode = 2;
1410 _elm_config->fileselector_expand_enable = EINA_FALSE;
1411 _elm_config->fileselector_double_tap_navigation_enable = EINA_FALSE;
1412 _elm_config->inwin_dialogs_enable = EINA_FALSE;
1413 _elm_config->icon_size = 32;
1414 _elm_config->longpress_timeout = 1.0;
1415 _elm_config->effect_enable = EINA_TRUE;
1416 _elm_config->desktop_entry = EINA_FALSE;
1417 _elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
1418 _elm_config->password_show_last = EINA_FALSE;
1419 _elm_config->password_show_last_timeout = 2.0;
1420 _elm_config->glayer_zoom_finger_enable = EINA_TRUE;
1421 _elm_config->glayer_zoom_finger_factor = 1.0;
1422 _elm_config->glayer_zoom_wheel_factor = 0.05;
1423 _elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_config_finger_size_get() */
1424 _elm_config->glayer_rotate_finger_enable = EINA_TRUE;
1425 _elm_config->glayer_rotate_angular_tolerance = 2.0; /* 2 DEG */
1426 _elm_config->glayer_line_min_length = 1.0; /* 1 times elm_config_finger_size_get() */
1427 _elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_config_finger_size_get() */
1428 _elm_config->glayer_line_angular_tolerance = 20.0; /* 20 DEG */
1429 _elm_config->glayer_flick_time_limit_ms = 120; /* ms to finish flick */
1430 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
1431 _elm_config->glayer_double_tap_timeout = 0.25; /* 0.25 seconds between 2 mouse downs of a tap. */
1432 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
1433 _elm_config->access_mode = ELM_ACCESS_MODE_OFF;
1434 _elm_config->selection_clear_enable = EINA_FALSE;
1435 _elm_config->week_start = 1; /* monday */
1436 _elm_config->weekend_start = 6; /* saturday */
1437 _elm_config->weekend_len = 2;
1438 _elm_config->year_min = 2;
1439 _elm_config->year_max = 137;
1440 _elm_config->softcursor_mode = 0; /* 0 = auto, 1 = on, 2 = off */
1441 _elm_config->color_palette = NULL;
1442 _elm_config->auto_norender_withdrawn = 0;
1443 _elm_config->auto_norender_iconified_same_as_withdrawn = 1;
1444 _elm_config->auto_flush_withdrawn = 0;
1445 _elm_config->auto_dump_withdrawn = 0;
1446 _elm_config->auto_throttle = 0;
1447 _elm_config->auto_throttle_amount = 0.1;
1448 _elm_config->indicator_service_0 = eina_stringshare_add("elm_indicator_portrait");
1449 _elm_config->indicator_service_90 = eina_stringshare_add("elm_indicator_landscape");
1450 _elm_config->indicator_service_180 = eina_stringshare_add("elm_indicator_portrait");
1451 _elm_config->indicator_service_270 = eina_stringshare_add("elm_indicator_landscape");
1452 _elm_config->disable_external_menu = EINA_FALSE;
1453 _elm_config->magnifier_enable = EINA_TRUE;
1454 _elm_config->magnifier_scale = 1.5;
1455 _elm_config->audio_mute_effect = 0;
1456 _elm_config->audio_mute_background = 0;
1457 _elm_config->audio_mute_music = 0;
1458 _elm_config->audio_mute_foreground = 0;
1459 _elm_config->audio_mute_interface = 0;
1460 _elm_config->audio_mute_input = 0;
1461 _elm_config->audio_mute_alert = 0;
1462 _elm_config->audio_mute_all = 0;
1463 _elm_config->win_auto_focus_enable = 1;
1464 _elm_config->win_auto_focus_animate = 1;
1465 _elm_config->atspi_mode = ELM_ATSPI_MODE_OFF;
1466 _elm_config->gl_depth = 0;
1467 _elm_config->gl_msaa = 0;
1468 _elm_config->gl_stencil = 0;
1469 _elm_config->transition_duration_factor = 1.0;
1470 _elm_config->naviframe_prev_btn_auto_pushed = EINA_TRUE;
1471 _elm_config->popup_horizontal_align = 0.5;
1472 _elm_config->popup_vertical_align = 0.5;
1476 _config_flush_load(void)
1478 Elm_Config *cfg = NULL;
1482 _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/flush.cfg");
1484 ef = eet_open(buf, EET_FILE_MODE_READ);
1487 cfg = eet_data_read(ef, _config_edd, "config");
1495 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/");
1496 if (len + 1 < sizeof(buf))
1497 ecore_file_mkpath(buf);
1501 if ((_elm_config->config_version >> ELM_CONFIG_VERSION_EPOCH_OFFSET) < ELM_CONFIG_EPOCH)
1503 WRN("User's elementary config seems outdated and unusable. Fallback to load system config.");
1504 _config_free(_elm_config);
1509 if (_elm_config->config_version < ELM_CONFIG_VERSION)
1516 _config_flush_get(void)
1518 _elm_config_font_overlays_cancel();
1519 _color_overlays_cancel();
1520 _config_free(_elm_config);
1522 _config_flush_load();
1525 _config_sub_apply();
1527 _elm_config_font_overlay_apply();
1528 _elm_config_color_overlay_apply();
1531 _elm_clouseau_reload();
1532 _elm_config_key_binding_hash();
1533 if (_elm_config) _elm_win_access(_elm_config->access_mode);
1534 ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
1538 _elm_config_eet_close_error_get(Eet_File *ef,
1542 const char *erstr = NULL;
1544 err = eet_close(ef);
1547 case EET_ERROR_WRITE_ERROR:
1548 erstr = "An error occurred while saving Elementary's "
1549 "settings to disk. The error could not be "
1550 "deterimined. The file where the error occurred was: "
1551 "%s. This file has been deleted to avoid corrupt data.";
1554 case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG:
1555 erstr = "Elementary's settings files are too big "
1556 "for the file system they are being saved to. "
1557 "This error is very strange as the files should "
1558 "be extremely small. Please check the settings "
1559 "for your home directory. "
1560 "The file where the error occurred was: %s ."
1561 "This file has been deleted to avoid corrupt data.";
1564 case EET_ERROR_WRITE_ERROR_IO_ERROR:
1565 erstr = "An output error occurred when writing the settings "
1566 "files for Elementary. Your disk is having troubles "
1567 "and possibly needs replacement. "
1568 "The file where the error occurred was: %s ."
1569 "This file has been deleted to avoid corrupt data.";
1572 case EET_ERROR_WRITE_ERROR_OUT_OF_SPACE:
1573 erstr = "Elementary cannot write its settings file "
1574 "because it ran out of space to write the file. "
1575 "You have either run out of disk space or have "
1576 "gone over your quota limit. "
1577 "The file where the error occurred was: %s ."
1578 "This file has been deleted to avoid corrupt data.";
1581 case EET_ERROR_WRITE_ERROR_FILE_CLOSED:
1582 erstr = "Elementary unexpectedly had the settings file "
1583 "it was writing closed on it. This is very unusual. "
1584 "The file where the error occurred was: %s "
1585 "This file has been deleted to avoid corrupt data.";
1593 /* delete any partially-written file */
1594 ecore_file_unlink(file);
1595 return strdup(erstr);
1602 _elm_config_profile_save(void)
1604 char buf[4096], buf2[4096];
1610 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg");
1611 if (len + 1 >= sizeof(buf))
1614 len = _elm_config_user_dir_snprintf(buf2, sizeof(buf2),
1615 "config/profile.cfg.tmp");
1616 if (len + 1 >= sizeof(buf2))
1619 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1623 ok = eet_write(ef, "config", _elm_profile, strlen(_elm_profile), 0);
1627 err = _elm_config_eet_close_error_get(ef, buf2);
1635 ret = ecore_file_mv(buf2, buf);
1638 ERR("Error saving Elementary's configuration profile file");
1642 ecore_file_unlink(buf2);
1646 ecore_file_unlink(buf2);
1651 _elm_config_save(void)
1653 char buf[4096], buf2[4096];
1659 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/");
1660 if (len + 1 >= sizeof(buf))
1663 ok = ecore_file_mkpath(buf);
1666 ERR("Problem accessing Elementary's user configuration directory: %s",
1671 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s",
1673 if (len + 1 >= sizeof(buf))
1676 ok = ecore_file_mkpath(buf);
1679 ERR("Problem accessing Elementary's user configuration directory: %s",
1684 if (!_elm_config_profile_save())
1690 if (len + sizeof("base.cfg") >= sizeof(buf) - len)
1693 memcpy(buf + len, "base.cfg", sizeof("base.cfg"));
1694 len += sizeof("base.cfg") - 1;
1696 if (len + sizeof(".tmp") >= sizeof(buf))
1699 memcpy(buf2, buf, len);
1700 memcpy(buf2 + len, ".tmp", sizeof(".tmp"));
1702 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
1706 ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1);
1710 err = _elm_config_eet_close_error_get(ef, buf2);
1718 ret = ecore_file_mv(buf2, buf);
1721 ERR("Error saving Elementary's configuration file");
1725 ecore_file_unlink(buf2);
1729 ecore_file_unlink(buf2);
1734 _config_update(void)
1737 tcfg = _config_system_load();
1740 /* weird profile or something? We should probably fill
1741 * with hardcoded defaults, or get from default previx */
1744 #define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) {
1745 #define IFCFGELSE } else {
1747 #define COPYVAL(x) do {_elm_config->x = tcfg->x; } while (0)
1748 #define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while (0)
1749 #define COPYSTR(x) COPYPTR(x)
1751 /* we also need to update for property changes in the root window
1752 * if needed, but that will be dependent on new properties added
1753 * with each version */
1755 _elm_config->win_auto_focus_enable = tcfg->win_auto_focus_enable;;
1756 _elm_config->win_auto_focus_animate = tcfg->win_auto_focus_animate;
1760 _elm_config->transition_duration_factor = tcfg->transition_duration_factor;
1764 Elm_Config_Bindings_Widget *wb, *twb = NULL;
1767 EINA_LIST_FOREACH(tcfg->bindings, l, wb)
1769 if (wb->name && !strcmp(wb->name, "Elm_Hoversel"))
1777 EINA_LIST_FOREACH(_elm_config->bindings, l, wb)
1779 if (wb->name && !strcmp(wb->name, "Elm_Hoversel"))
1781 // simply swap bindngs for Elm_Hoversel with system ones
1782 Eina_List *tmp = wb->key_bindings;
1783 wb->key_bindings = twb->key_bindings;
1784 twb->key_bindings = tmp;
1792 _elm_config->naviframe_prev_btn_auto_pushed = tcfg->naviframe_prev_btn_auto_pushed;
1796 _elm_config->cursor_engine_only = 0;
1800 * Fix user config for current ELM_CONFIG_EPOCH here.
1810 _elm_config->config_version = ELM_CONFIG_VERSION;
1811 /* after updating user config, we must save */
1822 s = getenv("ELM_ENGINE");
1825 if ((!strcasecmp(s, "x11")) ||
1826 (!strcasecmp(s, "x")) ||
1827 (!strcasecmp(s, "software-x11")) ||
1828 (!strcasecmp(s, "software_x11")))
1829 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_X11);
1830 else if ((!strcasecmp(s, "opengl")) ||
1831 (!strcasecmp(s, "gl")) ||
1832 (!strcasecmp(s, "opengl-x11")) ||
1833 (!strcasecmp(s, "opengl_x11")))
1834 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_X11);
1835 else if ((!strcasecmp(s, "fb")) ||
1836 (!strcasecmp(s, "software-fb")) ||
1837 (!strcasecmp(s, "software_fb")))
1838 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB);
1839 else if ((!strcasecmp(s, "psl1ght")))
1840 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_PSL1GHT);
1841 else if ((!strcasecmp(s, "sdl")) ||
1842 (!strcasecmp(s, "software-sdl")) ||
1843 (!strcasecmp(s, "software_sdl")))
1844 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_SDL);
1845 else if ((!strcasecmp(s, "opengl-sdl")) ||
1846 (!strcasecmp(s, "opengl_sdl")) ||
1847 (!strcasecmp(s, "gl-sdl")) ||
1848 (!strcasecmp(s, "gl_sdl")))
1849 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL);
1850 else if ((!strcasecmp(s, "opengl-cocoa")) ||
1851 (!strcasecmp(s, "opengl_cocoa")) ||
1852 (!strcasecmp(s, "gl-cocoa")) ||
1853 (!strcasecmp(s, "gl_cocoa")))
1854 eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_COCOA);
1855 else if ((!strcasecmp(s, "gdi")) ||
1856 (!strcasecmp(s, "software-gdi")) ||
1857 (!strcasecmp(s, "software_gdi")))
1858 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_WIN32);
1859 else if (!strcasecmp(s, "buffer"))
1860 eina_stringshare_replace(&_elm_config->engine, ELM_BUFFER);
1861 else if ((!strncmp(s, "shot:", 5)))
1862 eina_stringshare_replace(&_elm_config->engine, s);
1863 else if ((!strcasecmp(s, "ews")))
1864 eina_stringshare_replace(&_elm_config->engine, ELM_EWS);
1865 else if ((!strcasecmp(s, "wayland_shm")) ||
1866 (!strcasecmp(s, "wayland-shm")))
1867 eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_SHM);
1868 else if ((!strcasecmp(s, "wayland_egl")) ||
1869 (!strcasecmp(s, "wayland-egl")))
1870 eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_EGL);
1871 else if ((!strcasecmp(s, "drm")))
1872 eina_stringshare_replace(&_elm_config->engine, ELM_DRM);
1873 else if ((!strcasecmp(s, "ddraw")))
1874 eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_DDRAW);
1876 ERR("Unknown engine '%s'.", s);
1877 if (_elm_config->engine)
1878 eina_stringshare_replace(&_elm_preferred_engine, _elm_config->engine);
1881 s = getenv("ELM_VSYNC");
1882 if (s) _elm_config->vsync = !!atoi(s);
1884 s = getenv("ELM_THUMBSCROLL_ENABLE");
1885 if (s) _elm_config->thumbscroll_enable = !!atoi(s);
1886 s = getenv("ELM_THUMBSCROLL_THRESHOLD");
1887 if (s) _elm_config->thumbscroll_threshold = atoi(s);
1888 s = getenv("ELM_THUMBSCROLL_HOLD_THRESHOLD");
1889 if (s) _elm_config->thumbscroll_hold_threshold = atoi(s);
1890 // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
1891 s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
1892 if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
1893 s = getenv("ELM_THUMBSCROLL_FLICK_DISTANCE_TOLERANCE");
1894 if (s) _elm_config->thumbscroll_flick_distance_tolerance = atoi(s);
1895 s = getenv("ELM_THUMBSCROLL_FRICTION");
1896 if (s) _elm_config->thumbscroll_friction = _elm_atof(s);
1897 s = getenv("ELM_THUMBSCROLL_MIN_FRICTION");
1898 if (s) _elm_config->thumbscroll_min_friction = _elm_atof(s);
1899 s = getenv("ELM_THUMBSCROLL_FRICTION_STANDARD");
1900 if (s) _elm_config->thumbscroll_friction_standard = _elm_atof(s);
1901 s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
1902 if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
1903 s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
1904 if (s) _elm_config->thumbscroll_bounce_friction = _elm_atof(s);
1905 s = getenv("ELM_THUMBSCROLL_ACCELERATION_THRESHOLD");
1906 if (s) _elm_config->thumbscroll_acceleration_threshold = _elm_atof(s);
1907 s = getenv("ELM_THUMBSCROLL_ACCELERATION_TIME_LIMIT");
1908 if (s) _elm_config->thumbscroll_acceleration_time_limit = _elm_atof(s);
1909 s = getenv("ELM_THUMBSCROLL_ACCELERATION_WEIGHT");
1910 if (s) _elm_config->thumbscroll_acceleration_weight = _elm_atof(s);
1911 s = getenv("ELM_PAGE_SCROLL_FRICTION");
1912 if (s) _elm_config->page_scroll_friction = _elm_atof(s);
1913 s = getenv("ELM_BRING_IN_SCROLL_FRICTION");
1914 if (s) _elm_config->bring_in_scroll_friction = _elm_atof(s);
1915 s = getenv("ELM_ZOOM_FRICTION");
1916 if (s) _elm_config->zoom_friction = _elm_atof(s);
1917 s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
1920 friction = _elm_atof(s);
1927 _elm_config->thumbscroll_border_friction = friction;
1929 s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION");
1932 friction = _elm_atof(s);
1939 _elm_config->thumbscroll_sensitivity_friction = friction;
1941 s = getenv("ELM_SCROLL_SMOOTH_START_ENABLE");
1942 if (s) _elm_config->scroll_smooth_start_enable = !!atoi(s);
1943 // s = getenv("ELM_SCROLL_SMOOTH_TIME_INTERVAL"); // not used anymore
1944 // if (s) _elm_config->scroll_smooth_time_interval = atof(s); // not used anymore
1945 s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
1946 if (s) _elm_config->scroll_smooth_amount = _elm_atof(s);
1947 // s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT"); // not used anymore
1948 // if (s) _elm_config->scroll_smooth_history_weight = _elm_atof(s); // not used anymore
1949 // s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME"); // not used anymore
1950 // if (s) _elm_config->scroll_smooth_future_time = _elm_atof(s); // not used anymore
1951 s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
1952 if (s) _elm_config->scroll_smooth_time_window = _elm_atof(s);
1953 s = getenv("ELM_FOCUS_AUTOSCROLL_MODE");
1956 if (!strcmp(s, "ELM_FOCUS_AUTOSCROLL_MODE_NONE"))
1957 _elm_config->focus_autoscroll_mode = ELM_FOCUS_AUTOSCROLL_MODE_NONE;
1958 else if (!strcmp(s, "ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN"))
1959 _elm_config->focus_autoscroll_mode = ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN;
1961 _elm_config->focus_autoscroll_mode = ELM_FOCUS_AUTOSCROLL_MODE_SHOW;
1963 s = getenv("ELM_SLIDER_INDICATOR_VISIBLE_MODE");
1966 if (!strcmp(s, "ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT"))
1967 _elm_config->slider_indicator_visible_mode = ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT;
1968 else if (!strcmp(s, "ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS"))
1969 _elm_config->slider_indicator_visible_mode = ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS;
1970 else if (!strcmp(s, "ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS"))
1971 _elm_config->slider_indicator_visible_mode = ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS;
1973 _elm_config->slider_indicator_visible_mode = ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE;
1975 s = getenv("ELM_THEME");
1976 if (s) eina_stringshare_replace(&_elm_config->theme, s);
1978 s = getenv("ELM_FONT_HINTING");
1981 if (!strcasecmp(s, "none")) _elm_config->font_hinting = 0;
1982 else if (!strcasecmp(s, "auto"))
1983 _elm_config->font_hinting = 1;
1984 else if (!strcasecmp(s, "bytecode"))
1985 _elm_config->font_hinting = 2;
1988 s = getenv("ELM_FONT_PATH");
1994 EINA_LIST_FREE(_elm_config->font_dirs, p)
1996 eina_stringshare_del(p);
1999 buf2 = alloca(strlen(s) + 1);
2004 if ((*p == ':') || (*p == 0))
2009 strncpy(buf2, pp, len);
2011 _elm_config->font_dirs =
2012 eina_list_append(_elm_config->font_dirs,
2013 eina_stringshare_add(buf2));
2026 s = getenv("ELM_IMAGE_CACHE");
2027 if (s) _elm_config->image_cache = atoi(s);
2029 s = getenv("ELM_FONT_CACHE");
2030 if (s) _elm_config->font_cache = atoi(s);
2032 s = getenv("ELM_SCALE");
2033 if (s) _elm_config->scale = _elm_atof(s);
2035 s = getenv("ELM_FINGER_SIZE");
2036 if (s) _elm_config->finger_size = atoi(s);
2038 s = getenv("ELM_PASSWORD_SHOW_LAST");
2039 if (s) _elm_config->password_show_last = !!atoi(s);
2041 s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT");
2044 double pw_show_last_timeout = _elm_atof(s);
2045 if (pw_show_last_timeout >= 0.0)
2046 _elm_config->password_show_last_timeout = pw_show_last_timeout;
2049 s = getenv("ELM_FPS");
2050 if (s) _elm_config->fps = _elm_atof(s);
2051 if (_elm_config->fps < 1.0) _elm_config->fps = 1.0;
2053 s = getenv("ELM_MODULES");
2054 if (s) eina_stringshare_replace(&_elm_config->modules, s);
2056 s = getenv("ELM_TOOLTIP_DELAY");
2059 double delay = _elm_atof(s);
2061 _elm_config->tooltip_delay = delay;
2064 s = getenv("ELM_CURSOR_ENGINE_ONLY");
2065 if (s) _elm_config->cursor_engine_only = !!atoi(s);
2067 s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE");
2068 if (s) _elm_config->focus_highlight_enable = !!atoi(s);
2070 s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE");
2071 if (s) _elm_config->focus_highlight_animate = !!atoi(s);
2073 s = getenv("ELM_FOCUS_HIGHLIGHT_CLIP_DISABLE");
2074 if (s) _elm_config->focus_highlight_clip_disable = !!atoi(s);
2076 s = getenv("ELM_FOCUS_MOVE_POLICY");
2077 if (s) _elm_config->focus_move_policy = !!atoi(s);
2079 s = getenv("ELM_ITEM_SELECT_ON_FOCUS_DISABLE");
2080 if (s) _elm_config->item_select_on_focus_disable = !!atoi(s);
2082 s = getenv("ELM_FIRST_ITEM_FOCUS_ON_FIRST_FOCUS_IN");
2083 if (s) _elm_config->first_item_focus_on_first_focus_in = !!atoi(s);
2085 s = getenv("ELM_TOOLBAR_SHRINK_MODE");
2086 if (s) _elm_config->toolbar_shrink_mode = atoi(s);
2088 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE");
2089 if (s) _elm_config->fileselector_expand_enable = !!atoi(s);
2091 s = getenv("ELM_FILESELECTOR_DOUBLE_TAP_NAVIGATION_ENABLE");
2092 if (s) _elm_config->fileselector_double_tap_navigation_enable = !!atoi(s);
2094 s = getenv("ELM_INWIN_DIALOGS_ENABLE");
2095 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s);
2097 s = getenv("ELM_ICON_SIZE");
2098 if (s) _elm_config->icon_size = atoi(s);
2100 s = getenv("ELM_LONGPRESS_TIMEOUT");
2101 if (s) _elm_config->longpress_timeout = _elm_atof(s);
2102 if (_elm_config->longpress_timeout < 0.0)
2103 _elm_config->longpress_timeout = 0.0;
2105 s = getenv("ELM_EFFECT_ENABLE");
2106 if (s) _elm_config->effect_enable = !!atoi(s);
2108 s = getenv("ELM_DESKTOP_ENTRY");
2109 if (s) _elm_config->desktop_entry = !!atoi(s);
2110 s = getenv("ELM_ACCESS_MODE");
2111 if (s) _elm_config->access_mode = ELM_ACCESS_MODE_ON;
2113 s = getenv("ELM_SELECTION_CLEAR_ENABLE");
2114 if (s) _elm_config->selection_clear_enable = !!atoi(s);
2116 s = getenv("ELM_AUTO_THROTTLE");
2117 if (s) _elm_config->auto_throttle = EINA_TRUE;
2118 s = getenv("ELM_AUTO_THROTTLE_AMOUNT");
2119 if (s) _elm_config->auto_throttle_amount = _elm_atof(s);
2120 s = getenv("ELM_AUTO_NORENDER_WITHDRAWN");
2121 if (s) _elm_config->auto_norender_withdrawn = EINA_TRUE;
2122 s = getenv("ELM_AUTO_NORENDER_ICONIFIED_SAME_AS_WITHDRAWN");
2123 if (s) _elm_config->auto_norender_iconified_same_as_withdrawn = EINA_TRUE;
2124 s = getenv("ELM_AUTO_FLUSH_WITHDRAWN");
2125 if (s) _elm_config->auto_flush_withdrawn = EINA_TRUE;
2126 s = getenv("ELM_AUTO_DUMP_WIDTHDRAWN");
2127 if (s) _elm_config->auto_dump_withdrawn = EINA_TRUE;
2129 s = getenv("ELM_INDICATOR_SERVICE_0");
2130 if (s) eina_stringshare_replace(&_elm_config->indicator_service_0, s);
2131 s = getenv("ELM_INDICATOR_SERVICE_90");
2132 if (s) eina_stringshare_replace(&_elm_config->indicator_service_90, s);
2133 s = getenv("ELM_INDICATOR_SERVICE_180");
2134 if (s) eina_stringshare_replace(&_elm_config->indicator_service_180, s);
2135 s = getenv("ELM_INDICATOR_SERVICE_270");
2136 if (s) eina_stringshare_replace(&_elm_config->indicator_service_270, s);
2137 s = getenv("ELM_DISABLE_EXTERNAL_MENU");
2138 if (s) _elm_config->disable_external_menu = !!atoi(s);
2140 s = getenv("ELM_CLOUSEAU");
2141 if (s) _elm_config->clouseau_enable = atoi(s);
2142 s = getenv("ELM_MAGNIFIER_ENABLE");
2143 if (s) _elm_config->magnifier_enable = !!atoi(s);
2144 s = getenv("ELM_MAGNIFIER_SCALE");
2145 if (s) _elm_config->magnifier_scale = _elm_atof(s);
2146 s = getenv("ELM_ATSPI_MODE");
2147 if (s) _elm_config->atspi_mode = ELM_ATSPI_MODE_ON;
2149 s = getenv("ELM_TRANSITION_DURATION_FACTOR");
2150 if (s) _elm_config->transition_duration_factor = atof(s);
2152 s = getenv("ELM_POPUP_HORIZONTAL_ALIGN");
2153 if (s) _elm_config->popup_horizontal_align = _elm_atof(s);
2154 s = getenv("ELM_POPUP_VERTICAL_ALIGN");
2155 if (s) _elm_config->popup_vertical_align = _elm_atof(s);
2159 _elm_config_key_binding_hash(void)
2161 Elm_Config_Bindings_Widget *wb;
2164 if (_elm_key_bindings)
2165 eina_hash_free(_elm_key_bindings);
2167 _elm_key_bindings = eina_hash_string_superfast_new(NULL);
2168 EINA_LIST_FOREACH(_elm_config->bindings, l, wb)
2170 eina_hash_add(_elm_key_bindings, wb->name, wb->key_bindings);
2175 _elm_config_modifier_check(const Evas_Modifier *m,
2176 Eina_List *mod_list)
2179 Elm_Config_Binding_Modifier *mod;
2180 EINA_LIST_FOREACH(mod_list, l, mod)
2182 if ((evas_key_modifier_is_set(m, mod->mod)) ^ (mod->flag))
2189 _elm_config_key_binding_call(Evas_Object *obj,
2190 const Evas_Event_Key_Down *ev,
2191 const Elm_Action *actions)
2193 Elm_Config_Binding_Key *binding;
2194 Eina_List *binding_list, *l;
2197 binding_list = eina_hash_find(_elm_key_bindings, elm_widget_type_get(obj));
2201 EINA_LIST_FOREACH(binding_list, l, binding)
2203 if (binding->key && (!strcmp(binding->key, ev->key))
2204 && _elm_config_modifier_check(ev->modifiers, binding->modifiers))
2206 while (actions[i].name)
2208 if (!strcmp(binding->action, actions[i].name))
2209 return actions[i].func(obj, binding->params);
2220 elm_config_mirrored_get(void)
2222 return _elm_config->is_mirrored;
2226 elm_config_mirrored_set(Eina_Bool mirrored)
2228 mirrored = !!mirrored;
2229 if (_elm_config->is_mirrored == mirrored) return;
2230 _elm_config->is_mirrored = mirrored;
2235 elm_config_cursor_engine_only_get(void)
2237 return _elm_config->cursor_engine_only;
2241 elm_config_cursor_engine_only_set(Eina_Bool engine_only)
2243 engine_only = !!engine_only;
2244 _elm_config->cursor_engine_only = engine_only;
2248 elm_config_tooltip_delay_get(void)
2250 return _elm_config->tooltip_delay;
2254 elm_config_tooltip_delay_set(double delay)
2256 if (delay < 0.0) return;
2257 _elm_config->tooltip_delay = delay;
2261 elm_config_scale_get(void)
2263 return _elm_config->scale;
2267 elm_config_scale_set(double scale)
2269 if (scale < 0.0) return;
2270 if (_elm_config->scale == scale) return;
2271 _elm_config->scale = scale;
2276 elm_config_password_show_last_get(void)
2278 return _elm_config->password_show_last;
2282 elm_config_password_show_last_set(Eina_Bool password_show_last)
2284 if (_elm_config->password_show_last == password_show_last) return;
2285 _elm_config->password_show_last = password_show_last;
2286 edje_password_show_last_set(_elm_config->password_show_last);
2290 elm_config_password_show_last_timeout_get(void)
2292 return _elm_config->password_show_last_timeout;
2296 elm_config_password_show_last_timeout_set(double password_show_last_timeout)
2298 if (password_show_last_timeout < 0.0) return;
2299 if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
2300 _elm_config->password_show_last_timeout = password_show_last_timeout;
2301 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
2305 elm_config_save(void)
2307 return _elm_config_save();
2311 elm_config_reload(void)
2313 _elm_config_reload();
2317 elm_config_profile_get(void)
2319 return _elm_config_current_profile_get();
2323 elm_config_profile_dir_get(const char *profile,
2326 return _elm_config_profile_dir_get(profile, is_user);
2330 elm_config_profile_dir_free(const char *p_dir)
2332 free((void *)p_dir);
2336 elm_config_profile_list_get(void)
2338 return _elm_config_profiles_list();
2342 elm_config_profile_list_free(Eina_List *l)
2346 EINA_LIST_FREE(l, dir)
2347 eina_stringshare_del(dir);
2351 elm_config_profile_set(const char *profile)
2353 EINA_SAFETY_ON_NULL_RETURN(profile);
2354 _elm_config_profile_set(profile);
2358 elm_config_engine_get(void)
2360 return _elm_config->engine;
2364 elm_config_engine_set(const char *engine)
2366 EINA_SAFETY_ON_NULL_RETURN(engine);
2368 _elm_config_engine_set(engine);
2372 elm_config_text_classes_list_get(void)
2374 return _elm_config_text_classes_get();
2378 elm_config_text_classes_list_free(Eina_List *list)
2380 _elm_config_text_classes_free(list);
2383 EAPI const Eina_List *
2384 elm_config_font_overlay_list_get(void)
2386 return _elm_config_font_overlays_list();
2390 elm_config_access_get(void)
2392 return _elm_config_access_get();
2396 elm_config_access_set(Eina_Bool is_access)
2398 _elm_config_access_set(is_access);
2402 elm_config_atspi_mode_get(void)
2404 return _elm_config_atspi_mode_get();
2408 elm_config_atspi_mode_set(Eina_Bool is_enable)
2410 _elm_config_atspi_mode_set(is_enable);
2414 elm_config_selection_unfocused_clear_get(void)
2416 return _elm_config_selection_unfocused_clear_get();
2420 elm_config_selection_unfocused_clear_set(Eina_Bool enabled)
2422 _elm_config_selection_unfocused_clear_set(enabled);
2426 elm_config_font_overlay_set(const char *text_class,
2428 Evas_Font_Size size)
2430 EINA_SAFETY_ON_NULL_RETURN(text_class);
2431 _elm_config_font_overlay_set(text_class, font, size);
2435 elm_config_font_overlay_unset(const char *text_class)
2437 EINA_SAFETY_ON_NULL_RETURN(text_class);
2438 _elm_config_font_overlay_remove(text_class);
2442 elm_config_font_overlay_apply(void)
2444 _elm_config_font_overlay_apply();
2449 elm_config_color_classes_list_get(void)
2451 return _elm_config_color_classes_get();
2455 elm_config_color_classes_list_free(Eina_List *list)
2457 _elm_config_color_classes_free(list);
2460 EAPI const Eina_List *
2461 elm_config_color_overlay_list_get(void)
2463 return _elm_config_color_overlays_list();
2467 elm_config_color_overlay_set(const char *color_class,
2468 int r, int g, int b, int a,
2469 int r2, int g2, int b2, int a2,
2470 int r3, int g3, int b3, int a3)
2472 EINA_SAFETY_ON_NULL_RETURN(color_class);
2473 _elm_config_color_overlay_set(color_class,
2480 elm_config_color_overlay_unset(const char *color_class)
2482 EINA_SAFETY_ON_NULL_RETURN(color_class);
2483 _elm_config_color_overlay_remove(color_class);
2487 elm_config_color_overlay_apply(void)
2489 _elm_config_color_overlay_apply();
2493 elm_config_finger_size_get(void)
2495 return _elm_config->finger_size;
2499 elm_config_finger_size_set(Evas_Coord size)
2501 if (size < 0) return;
2502 if (_elm_config->finger_size == size) return;
2503 _elm_config->finger_size = size;
2508 elm_config_cache_flush_interval_get(void)
2510 return _elm_config->cache_flush_poll_interval;
2514 elm_config_cache_flush_interval_set(int size)
2516 EINA_SAFETY_ON_FALSE_RETURN(size > 0);
2517 if (_elm_config->cache_flush_poll_interval == size) return;
2518 _elm_config->cache_flush_poll_interval = size;
2524 elm_config_cache_flush_enabled_get(void)
2526 return _elm_config->cache_flush_enable;
2530 elm_config_cache_flush_enabled_set(Eina_Bool enabled)
2532 enabled = !!enabled;
2533 if (_elm_config->cache_flush_enable == enabled) return;
2534 _elm_config->cache_flush_enable = enabled;
2540 elm_config_cache_font_cache_size_get(void)
2542 return _elm_config->font_cache;
2546 elm_config_cache_font_cache_size_set(int size)
2548 if (size < 0) return;
2549 if (_elm_config->font_cache == size) return;
2550 _elm_config->font_cache = size;
2556 elm_config_cache_image_cache_size_get(void)
2558 return _elm_config->image_cache;
2562 elm_config_cache_image_cache_size_set(int size)
2564 if (size < 0) return;
2565 if (_elm_config->image_cache == size) return;
2566 _elm_config->image_cache = size;
2572 elm_config_font_hint_type_set(int type)
2577 if ((type < 0) || (type > 2)) return;
2578 _elm_config->font_hinting = type;
2580 EINA_LIST_FOREACH(_elm_win_list, l, win)
2582 Evas *e = evas_object_evas_get(win);
2584 if (!_elm_config->font_hinting)
2585 evas_font_hinting_set(e, EVAS_FONT_HINTING_NONE);
2586 else if (_elm_config->font_hinting == 1)
2587 evas_font_hinting_set(e, EVAS_FONT_HINTING_AUTO);
2588 else if (_elm_config->font_hinting == 2)
2589 evas_font_hinting_set(e, EVAS_FONT_HINTING_BYTECODE);
2594 elm_config_cache_edje_file_cache_size_get()
2596 return _elm_config->edje_cache;
2600 elm_config_cache_edje_file_cache_size_set(int size)
2602 if (size < 0) return;
2603 if (_elm_config->edje_cache == size) return;
2604 _elm_config->edje_cache = size;
2610 elm_config_cache_edje_collection_cache_size_get(void)
2612 return _elm_config->edje_collection_cache;
2616 elm_config_cache_edje_collection_cache_size_set(int size)
2618 if (_elm_config->edje_collection_cache == size) return;
2619 _elm_config->edje_collection_cache = size;
2625 elm_config_vsync_get(void)
2627 return _elm_config->vsync;
2631 elm_config_vsync_set(Eina_Bool enabled)
2633 _elm_config->vsync = enabled;
2637 elm_config_accel_preference_override_get(void)
2639 return _elm_config->accel_override;
2643 elm_config_accel_preference_override_set(Eina_Bool enabled)
2645 _elm_config->accel_override = enabled;
2649 elm_config_focus_highlight_enabled_get(void)
2651 return _elm_config->focus_highlight_enable;
2655 elm_config_focus_highlight_enabled_set(Eina_Bool enable)
2657 _elm_config->focus_highlight_enable = !!enable;
2661 elm_config_focus_highlight_animate_get(void)
2663 return _elm_config->focus_highlight_animate;
2667 elm_config_focus_highlight_animate_set(Eina_Bool animate)
2669 _elm_config->focus_highlight_animate = !!animate;
2673 elm_config_focus_highlight_clip_disabled_get(void)
2675 return _elm_config->focus_highlight_clip_disable;
2679 elm_config_focus_highlight_clip_disabled_set(Eina_Bool disable)
2681 _elm_config->focus_highlight_clip_disable = !!disable;
2684 EAPI Elm_Focus_Move_Policy
2685 elm_config_focus_move_policy_get(void)
2687 return _elm_config->focus_move_policy;
2691 elm_config_focus_move_policy_set(Elm_Focus_Move_Policy policy)
2693 _elm_config->focus_move_policy = policy;
2697 elm_config_item_select_on_focus_disabled_get(void)
2699 return _elm_config->item_select_on_focus_disable;
2703 elm_config_item_select_on_focus_disabled_set(Eina_Bool disable)
2705 _elm_config->item_select_on_focus_disable = !!disable;
2709 elm_config_first_item_focus_on_first_focusin_get(void)
2711 return _elm_config->first_item_focus_on_first_focus_in;
2715 elm_config_first_item_focus_on_first_focusin_set(Eina_Bool enable)
2717 _elm_config->first_item_focus_on_first_focus_in = !!enable;
2721 elm_config_scroll_bounce_enabled_get(void)
2723 return _elm_config->thumbscroll_bounce_enable;
2727 elm_config_scroll_bounce_enabled_set(Eina_Bool enabled)
2729 _elm_config->thumbscroll_bounce_enable = enabled;
2733 elm_config_scroll_bounce_friction_get(void)
2735 return _elm_config->thumbscroll_bounce_friction;
2739 elm_config_scroll_bounce_friction_set(double friction)
2741 _elm_config->thumbscroll_bounce_friction = friction;
2745 elm_config_scroll_page_scroll_friction_get(void)
2747 return _elm_config->page_scroll_friction;
2751 elm_config_scroll_page_scroll_friction_set(double friction)
2753 _elm_config->page_scroll_friction = friction;
2757 elm_config_scroll_bring_in_scroll_friction_get(void)
2759 return _elm_config->bring_in_scroll_friction;
2763 elm_config_scroll_bring_in_scroll_friction_set(double friction)
2765 _elm_config->bring_in_scroll_friction = friction;
2769 elm_config_scroll_zoom_friction_get(void)
2771 return _elm_config->zoom_friction;
2775 elm_config_scroll_zoom_friction_set(double friction)
2777 _elm_config->zoom_friction = friction;
2781 elm_config_scroll_thumbscroll_enabled_get(void)
2783 return _elm_config->thumbscroll_enable;
2787 elm_config_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
2789 _elm_config->thumbscroll_enable = enabled;
2793 elm_config_scroll_thumbscroll_threshold_get(void)
2795 return _elm_config->thumbscroll_threshold;
2799 elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold)
2801 _elm_config->thumbscroll_threshold = threshold;
2805 elm_config_scroll_thumbscroll_hold_threshold_get(void)
2807 return _elm_config->thumbscroll_hold_threshold;
2811 elm_config_scroll_thumbscroll_hold_threshold_set(unsigned int threshold)
2813 _elm_config->thumbscroll_hold_threshold = threshold;
2817 elm_config_scroll_thumbscroll_momentum_threshold_get(void)
2819 return _elm_config->thumbscroll_momentum_threshold;
2823 elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold)
2825 _elm_config->thumbscroll_momentum_threshold = threshold;
2829 elm_config_scroll_thumbscroll_flick_distance_tolerance_get(void)
2831 return _elm_config->thumbscroll_flick_distance_tolerance;
2835 elm_config_scroll_thumbscroll_flick_distance_tolerance_set(unsigned int distance)
2837 _elm_config->thumbscroll_flick_distance_tolerance = distance;
2841 elm_config_scroll_thumbscroll_friction_get(void)
2843 return _elm_config->thumbscroll_friction;
2847 elm_config_scroll_thumbscroll_friction_set(double friction)
2849 _elm_config->thumbscroll_friction = friction;
2853 elm_config_scroll_thumbscroll_min_friction_get(void)
2855 return _elm_config->thumbscroll_min_friction;
2859 elm_config_scroll_thumbscroll_min_friction_set(double friction)
2861 _elm_config->thumbscroll_min_friction = friction;
2865 elm_config_scroll_thumbscroll_friction_standard_get(void)
2867 return _elm_config->thumbscroll_friction_standard;
2871 elm_config_scroll_thumbscroll_friction_standard_set(double standard)
2873 _elm_config->thumbscroll_friction_standard = standard;
2877 elm_config_scroll_thumbscroll_border_friction_get(void)
2879 return _elm_config->thumbscroll_border_friction;
2883 elm_config_scroll_thumbscroll_border_friction_set(double friction)
2885 if (friction < 0.0) friction = 0.0;
2886 if (friction > 1.0) friction = 1.0;
2887 _elm_config->thumbscroll_border_friction = friction;
2891 elm_config_scroll_thumbscroll_sensitivity_friction_get(void)
2893 return _elm_config->thumbscroll_sensitivity_friction;
2897 elm_config_scroll_thumbscroll_sensitivity_friction_set(double friction)
2899 if (friction < 0.1) friction = 0.1;
2900 if (friction > 1.0) friction = 1.0;
2901 _elm_config->thumbscroll_sensitivity_friction = friction;
2905 elm_config_scroll_thumbscroll_smooth_start_get(void)
2907 return _elm_config->scroll_smooth_start_enable;
2911 elm_config_scroll_thumbscroll_smooth_start_set(Eina_Bool enable)
2913 _elm_config->scroll_smooth_start_enable = enable;
2917 elm_config_scroll_thumbscroll_smooth_amount_set(double amount)
2919 if (amount < 0.0) amount = 0.0;
2920 if (amount > 1.0) amount = 1.0;
2921 _elm_config->scroll_smooth_amount = amount;
2925 elm_config_scroll_thumbscroll_smooth_amount_get(void)
2927 return _elm_config->scroll_smooth_amount;
2931 elm_config_scroll_thumbscroll_smooth_time_window_set(double amount)
2933 if (amount < 0.0) amount = 0.0;
2934 if (amount > 1.0) amount = 1.0;
2935 _elm_config->scroll_smooth_time_window = amount;
2939 elm_config_scroll_thumbscroll_smooth_time_window_get(void)
2941 return _elm_config->scroll_smooth_time_window;
2945 elm_config_scroll_thumbscroll_acceleration_threshold_get(void)
2947 return _elm_config->thumbscroll_acceleration_threshold;
2951 elm_config_scroll_thumbscroll_acceleration_threshold_set(double threshold)
2953 _elm_config->thumbscroll_acceleration_threshold = threshold;
2957 elm_config_scroll_thumbscroll_acceleration_time_limit_get(void)
2959 return _elm_config->thumbscroll_acceleration_time_limit;
2963 elm_config_scroll_thumbscroll_acceleration_time_limit_set(double time_limit)
2965 _elm_config->thumbscroll_acceleration_time_limit = time_limit;
2969 elm_config_scroll_thumbscroll_acceleration_weight_get(void)
2971 return _elm_config->thumbscroll_acceleration_weight;
2975 elm_config_scroll_thumbscroll_acceleration_weight_set(double weight)
2977 _elm_config->thumbscroll_acceleration_weight = weight;
2980 EAPI Elm_Focus_Autoscroll_Mode
2981 elm_config_focus_autoscroll_mode_get(void)
2983 return _elm_config->focus_autoscroll_mode;
2987 elm_config_slider_indicator_visible_mode_set(Elm_Slider_Indicator_Visible_Mode mode)
2989 _elm_config->slider_indicator_visible_mode = mode;
2992 EAPI Elm_Slider_Indicator_Visible_Mode
2993 elm_config_slider_indicator_visible_mode_get(void)
2995 return _elm_config->slider_indicator_visible_mode;
2999 elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode)
3001 _elm_config->focus_autoscroll_mode = mode;
3005 elm_config_longpress_timeout_set(double longpress_timeout)
3007 _elm_config->longpress_timeout = longpress_timeout;
3011 elm_config_longpress_timeout_get(void)
3013 return _elm_config->longpress_timeout;
3017 elm_config_softcursor_mode_set(Elm_Softcursor_Mode mode)
3019 _elm_config->softcursor_mode = mode;
3022 EAPI Elm_Softcursor_Mode
3023 elm_config_softcursor_mode_get(void)
3025 return _elm_config->softcursor_mode;
3029 elm_config_disable_external_menu_get(void)
3031 return _elm_config->disable_external_menu;
3035 elm_config_disable_external_menu_set(Eina_Bool disable)
3037 _elm_config->disable_external_menu = !!disable;
3041 elm_config_clouseau_enabled_get(void)
3043 return _elm_config->clouseau_enable;
3047 elm_config_clouseau_enabled_set(Eina_Bool enable)
3049 _elm_config->clouseau_enable = !!enable;
3050 _elm_clouseau_reload();
3054 elm_config_glayer_long_tap_start_timeout_get(void)
3056 return _elm_config->glayer_long_tap_start_timeout;
3060 elm_config_glayer_long_tap_start_timeout_set(double long_tap_timeout)
3062 _elm_config->glayer_long_tap_start_timeout = long_tap_timeout;
3066 elm_config_glayer_double_tap_timeout_get(void)
3068 return _elm_config->glayer_double_tap_timeout;
3072 elm_config_glayer_double_tap_timeout_set(double double_tap_timeout)
3074 _elm_config->glayer_double_tap_timeout = double_tap_timeout;
3078 elm_config_magnifier_enable_get(void)
3080 return _elm_config->magnifier_enable;
3084 elm_config_magnifier_enable_set(Eina_Bool enable)
3086 _elm_config->magnifier_enable = !!enable;
3090 elm_config_magnifier_scale_get(void)
3092 return _elm_config->magnifier_scale;
3096 elm_config_magnifier_scale_set(double scale)
3098 _elm_config->magnifier_scale = scale;
3102 elm_config_audio_mute_get(Edje_Channel channel)
3106 case EDJE_CHANNEL_EFFECT:
3107 return _elm_config->audio_mute_effect;
3109 case EDJE_CHANNEL_BACKGROUND:
3110 return _elm_config->audio_mute_background;
3112 case EDJE_CHANNEL_MUSIC:
3113 return _elm_config->audio_mute_music;
3115 case EDJE_CHANNEL_FOREGROUND:
3116 return _elm_config->audio_mute_foreground;
3118 case EDJE_CHANNEL_INTERFACE:
3119 return _elm_config->audio_mute_interface;
3121 case EDJE_CHANNEL_INPUT:
3122 return _elm_config->audio_mute_input;
3124 case EDJE_CHANNEL_ALERT:
3125 return _elm_config->audio_mute_alert;
3127 case EDJE_CHANNEL_ALL:
3128 return _elm_config->audio_mute_all;
3137 elm_config_audio_mute_set(Edje_Channel channel, Eina_Bool mute)
3141 case EDJE_CHANNEL_EFFECT:
3142 _elm_config->audio_mute_effect = mute;
3144 case EDJE_CHANNEL_BACKGROUND:
3145 _elm_config->audio_mute_background = mute;
3147 case EDJE_CHANNEL_MUSIC:
3148 _elm_config->audio_mute_music = mute;
3150 case EDJE_CHANNEL_FOREGROUND:
3151 _elm_config->audio_mute_foreground = mute;
3153 case EDJE_CHANNEL_INTERFACE:
3154 _elm_config->audio_mute_interface = mute;
3156 case EDJE_CHANNEL_INPUT:
3157 _elm_config->audio_mute_input = mute;
3159 case EDJE_CHANNEL_ALERT:
3160 _elm_config->audio_mute_alert = mute;
3162 case EDJE_CHANNEL_ALL:
3163 _elm_config->audio_mute_all = mute;
3168 edje_audio_channel_mute_set(channel, mute);
3172 elm_config_window_auto_focus_enable_get(void)
3174 return _elm_config->win_auto_focus_enable;
3178 elm_config_window_auto_focus_enable_set(Eina_Bool enable)
3180 _elm_config->win_auto_focus_enable = enable;
3184 elm_config_window_auto_focus_animate_get(void)
3186 return _elm_config->win_auto_focus_animate;
3190 elm_config_window_auto_focus_animate_set(Eina_Bool enable)
3192 _elm_config->win_auto_focus_animate = enable;
3196 elm_config_all_flush(void)
3198 char buf[4096], buf2[4096];
3204 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/");
3205 if (len + 1 >= sizeof(buf))
3208 ok = ecore_file_mkpath(buf);
3211 ERR("Problem accessing Elementary's user configuration directory: %s",
3216 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config");
3217 if (len + 1 >= sizeof(buf))
3220 ok = ecore_file_mkpath(buf);
3223 ERR("Problem accessing Elementary's user configuration directory: %s",
3228 if (!_elm_config_profile_save())
3234 if (len + sizeof("flush.cfg") >= sizeof(buf) - len)
3237 memcpy(buf + len, "flush.cfg", sizeof("flush.cfg"));
3238 len += sizeof("flush.cfg") - 1;
3240 if (len + sizeof(".tmp") >= sizeof(buf))
3243 memcpy(buf2, buf, len);
3244 memcpy(buf2 + len, ".tmp", sizeof(".tmp"));
3246 ef = eet_open(buf2, EET_FILE_MODE_WRITE);
3250 ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1);
3254 err = _elm_config_eet_close_error_get(ef, buf2);
3262 ret = ecore_file_mv(buf2, buf);
3265 ERR("Error saving Elementary's configuration file");
3269 ecore_file_unlink(buf2);
3273 ecore_file_unlink(buf2);
3281 const char *cur_dom = textdomain(NULL);
3282 const char *trans_comment = gettext("");
3283 const char *msg_locale = setlocale(LC_MESSAGES, NULL);
3285 /* Same concept as what glib does:
3286 * We shouldn't translate if there are no translations for the
3287 * application in the current locale + domain. (Unless locale is
3288 * en_/C where translating only parts of the interface make some
3291 _elm_config->translate = !(strcmp (cur_dom, "messages") &&
3292 !*trans_comment && strncmp (msg_locale, "en_", 3) &&
3293 strcmp (msg_locale, "C"));
3294 /* Get RTL orientation from system */
3295 if (_elm_config->translate)
3297 bindtextdomain(PACKAGE, LOCALE_DIR);
3298 _elm_config->is_mirrored = !strcmp(E_("default:LTR"), "default:RTL");
3305 _elm_config_init(void)
3307 if (!ELM_EVENT_CONFIG_ALL_CHANGED)
3308 ELM_EVENT_CONFIG_ALL_CHANGED = ecore_event_type_new();
3310 _profile_fetch_from_conf();
3313 ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
3314 ELM_SAFE_FREE(_elm_gl_preference, eina_stringshare_del);
3315 _translation_init();
3317 _elm_config_font_overlay_apply();
3318 _elm_config_color_overlay_apply();
3320 _elm_clouseau_reload();
3321 _elm_config_key_binding_hash();
3325 _elm_config_sub_shutdown(void)
3327 #ifdef HAVE_ELEMENTARY_X
3328 if (ecore_x_display_get()) ecore_x_shutdown();
3330 ELM_SAFE_FREE(_eio_monitor, eio_monitor_del);
3331 ELM_SAFE_FREE(_config_change_delay_timer, ecore_timer_del);
3335 _config_change_delay_cb(void *data EINA_UNUSED)
3339 _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/flush.cfg");
3340 if (ecore_file_exists(buf)) _config_flush_get();
3341 _config_change_delay_timer = NULL;
3343 return ECORE_CALLBACK_CANCEL;
3347 _elm_config_file_monitor_cb(void *data EINA_UNUSED,
3348 int type EINA_UNUSED,
3351 Eio_Monitor_Event *ev = event;
3353 if (ev->monitor != _eio_monitor) return ECORE_CALLBACK_PASS_ON;
3355 ecore_timer_del(_config_change_delay_timer);
3356 _config_change_delay_timer = ecore_timer_add(0.1, _config_change_delay_cb, NULL);
3358 return ECORE_CALLBACK_PASS_ON;
3362 _elm_config_sub_init(void)
3364 #if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WAYLAND)
3365 const char *ev = getenv("ELM_DISPLAY");
3368 #ifdef HAVE_ELEMENTARY_X
3369 Eina_Bool init_x = EINA_FALSE;
3370 Eina_Bool have_display = !!getenv("DISPLAY");
3372 if (ev) /* If ELM_DISPLAY is specified */
3374 if (!strcmp(ev, "x11")) /* and it is X11 */
3376 if (!have_display) /* if there is no $DISPLAY */
3378 ERR("$ELM_DISPLAY is set to x11 but $DISPLAY is not set");
3379 init_x = EINA_FALSE;
3381 else /* if there is */
3385 init_x = EINA_FALSE;
3387 else /* ELM_DISPLAY not specified */
3389 if (have_display) /* If there is a $DISPLAY */
3391 else /* No $DISPLAY */
3392 init_x = EINA_FALSE;
3399 #ifdef HAVE_ELEMENTARY_WAYLAND
3400 Eina_Bool init_wl = EINA_FALSE;
3401 Eina_Bool have_wl_display = !!getenv("WAYLAND_DISPLAY");
3403 if (ev) /* If ELM_DISPLAY is specified */
3405 if (!strcmp(ev, "wl")) /* and it is X11 */
3407 if (!have_wl_display) /* if there is no $DISPLAY */
3409 ERR("$ELM_DISPLAY is set to wl but $WAYLAND_DISPLAY is not set");
3410 init_wl = EINA_FALSE;
3412 else /* if there is */
3413 init_wl = EINA_TRUE;
3416 init_wl = EINA_FALSE;
3418 else /* ELM_DISPLAY not specified */
3420 if (have_wl_display) /* If there is a $WAYLAND_DISPLAY */
3421 init_wl = EINA_TRUE;
3422 else /* No $WAYLAND_DISPLAY */
3423 init_wl = EINA_FALSE;
3427 ecore_wl_init(NULL);
3434 len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/");
3435 if (len + 10 >= sizeof(buf)) // the space to add "flush.cfg"
3438 ok = ecore_file_mkpath(buf);
3441 ERR("Problem accessing Elementary's user configuration directory: %s",
3446 strcat(buf, "flush.cfg");
3447 if (!ecore_file_exists(buf)) elm_config_all_flush();
3449 _eio_monitor = eio_monitor_add(buf);
3450 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, _elm_config_file_monitor_cb, NULL);
3453 _config_sub_apply();
3457 _elm_config_reload(void)
3459 _config_free(_elm_config);
3463 _elm_config_font_overlay_apply();
3464 _elm_config_color_overlay_apply();
3467 _elm_clouseau_reload();
3468 _elm_config_key_binding_hash();
3469 ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
3473 _elm_config_engine_set(const char *engine)
3475 eina_stringshare_replace(&(_elm_config->engine), engine);
3479 elm_config_preferred_engine_get(void)
3481 return _elm_preferred_engine;
3485 elm_config_preferred_engine_set(const char *engine)
3489 #define ENGINE_COMPARE(name) (!strcmp(name, engine))
3490 if (!(d = getenv("DISPLAY")) && (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
3491 ENGINE_COMPARE(ELM_OPENGL_X11)))
3492 eina_stringshare_replace(&(_elm_preferred_engine), ELM_WAYLAND_EGL);
3494 eina_stringshare_replace(&(_elm_preferred_engine), engine);
3495 #undef ENGINE_COMPARE
3499 ELM_SAFE_FREE(_elm_preferred_engine, eina_stringshare_del);
3504 elm_config_accel_preference_get(void)
3506 if (_elm_gl_preference) return _elm_gl_preference;
3507 if (_elm_accel_preference) return _elm_accel_preference;
3508 return _elm_config->accel;
3512 elm_config_accel_preference_set(const char *pref)
3516 Eina_Bool is_hw_accel = EINA_FALSE;
3517 unsigned int tokens = 0, i;
3520 /* Accel preference's string has the window surface configuration as a hw accel, depth, stencil and msaa.
3521 * The string format is "{HW Accel}:depth{value}:stencil{value}:msaa{msaa string}"
3522 * Especially, msaa string is related Evas GL MSAA enum value(low, mid, high)
3523 * so msaa string has four types as msaa, msaa_low, msaa_mid, msaa_high
3524 * For instance, "opengl:depth24:stencil8:msaa_high".
3525 * It means that using hw accelation, window surface depth buffer's size is 24, stencil buffer's size 8 and msaa bits is the highest.
3526 * The other use-case is "opengl:depth24".
3527 * It measn that using hw accelation, depth buffer size is 24. stencil and msaa are not used.
3528 * The simple case is "opengl:depth:stencil:msaa".
3529 * It means that depth, stencil and msaa are setted by pre-defined value(depth:24, stencil:8, msaa:low)
3532 DBG("accel preference's string: %s",pref);
3534 eina_stringshare_replace(&(_elm_gl_preference), pref);
3535 ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
3536 ELM_SAFE_FREE(_elm_config->accel, eina_stringshare_del);
3538 /* split GL items (hw accel, gl depth, gl stencil, gl msaa */
3539 arr = eina_str_split_full(pref, ":", 0, &tokens);
3540 for (i = 0; arr && arr[i]; i++)
3542 if ((!strcasecmp(arr[i], "gl")) ||
3543 (!strcasecmp(arr[i], "opengl")) ||
3544 (!strcasecmp(arr[i], "3d")) ||
3545 (!strcasecmp(arr[i], "hw")) ||
3546 (!strcasecmp(arr[i], "accel")) ||
3547 (!strcasecmp(arr[i], "hardware"))
3550 eina_stringshare_replace(&(_elm_accel_preference), arr[i]);
3551 eina_stringshare_replace(&(_elm_config->accel), arr[i]);
3552 is_hw_accel = EINA_TRUE;
3554 else if (!strncmp(arr[i], "depth", 5))
3556 char *value_str = arr[i] + 5;
3557 if ((value_str) && (isdigit(*value_str)))
3558 _elm_config->gl_depth = atoi(value_str);
3560 _elm_config->gl_depth = 24;
3562 else if (!strncmp(arr[i], "stencil", 7))
3564 char *value_str = arr[i] + 7;
3565 if ((value_str) && (isdigit(*value_str)))
3566 _elm_config->gl_stencil = atoi(value_str);
3568 _elm_config->gl_stencil = 8;
3570 else if (!strncmp(arr[i], "msaa_low", 8))
3571 _elm_config->gl_msaa = 1; // 1 means msaa low
3572 else if (!strncmp(arr[i], "msaa_mid", 8))
3573 _elm_config->gl_msaa = 2; // 2 means msaa mid
3574 else if (!strncmp(arr[i], "msaa_high", 9))
3575 _elm_config->gl_msaa = 4; // 4 means msaa high
3576 else if (!strncmp(arr[i], "msaa", 4))
3577 _elm_config->gl_msaa = 1; // 1 means msaa low
3580 DBG("accel: %s", _elm_accel_preference);
3581 DBG("gl depth: %d", _elm_config->gl_depth);
3582 DBG("gl stencil: %d", _elm_config->gl_stencil);
3583 DBG("gl msaa: %d", _elm_config->gl_msaa);
3587 if (is_hw_accel == EINA_FALSE)
3589 ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
3590 ELM_SAFE_FREE(_elm_config->accel, eina_stringshare_del);
3595 ELM_SAFE_FREE(_elm_gl_preference, eina_stringshare_del);
3596 ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
3597 ELM_SAFE_FREE(_elm_config->accel, eina_stringshare_del);
3602 elm_config_indicator_service_get(int rotation)
3607 return _elm_config->indicator_service_0;
3609 return _elm_config->indicator_service_90;
3611 return _elm_config->indicator_service_180;
3613 return _elm_config->indicator_service_270;
3620 elm_config_transition_duration_factor_set(double factor)
3622 if (factor < 0.0) return;
3623 if (_elm_config->transition_duration_factor == factor) return;
3624 _elm_config->transition_duration_factor = factor;
3625 edje_transition_duration_factor_set(_elm_config->transition_duration_factor);
3630 elm_config_transition_duration_factor_get(void)
3632 return _elm_config->transition_duration_factor;
3636 _elm_config_profile_set(const char *profile)
3638 if (!profile) return;
3642 if (!strcmp(_elm_profile, profile))
3648 _elm_profile = strdup(profile);
3650 _color_overlays_cancel();
3651 _config_free(_elm_config);
3655 _elm_config_font_overlay_apply();
3656 _elm_config_color_overlay_apply();
3659 _elm_clouseau_reload();
3660 _elm_config_key_binding_hash();
3664 _elm_config_shutdown(void)
3666 ELM_SAFE_FREE(_elm_config, _config_free);
3667 ELM_SAFE_FREE(_elm_preferred_engine, eina_stringshare_del);
3668 ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
3669 ELM_SAFE_FREE(_elm_profile, free);
3670 _elm_font_overlays_del_free();
3674 ELM_SAFE_FREE(_elm_key_bindings, eina_hash_free);
3678 * Add backwards compatability implementation for elm_scale_get/set and elm_finger_size_get/set
3679 * to allow running unmodified Tizen applications on a new drop of elementary
3685 return elm_config_scale_get();
3689 elm_scale_set(double scale)
3691 elm_config_scale_set(scale);
3695 elm_finger_size_get(void)
3697 return elm_config_finger_size_get();
3701 elm_finger_size_set(Evas_Coord size)
3703 elm_config_finger_size_set(size);