2 # include "elementary_config.h"
6 #include <dlfcn.h> /* dlopen,dlclose,etc */
9 #ifdef HAVE_CRT_EXTERNS_H
10 # include <crt_externs.h>
17 #include <Elementary.h>
20 #define SEMI_BROKEN_QUICKLAUNCH 1
22 static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
23 EAPI Elm_Version *elm_version = &_version;
26 _elm_dangerous_call_check(const char *call)
31 snprintf(buf, sizeof(buf), "%i.%i.%i.%i", VMAJ, VMIN, VMIC, VREV);
32 eval = getenv("ELM_NO_FINGER_WAGGLING");
33 if ((eval) && (!strcmp(eval, buf)))
35 printf("ELEMENTARY FINGER WAGGLE!!!!!!!!!!\n"
38 "PLEASE see the API documentation for this function. This call\n"
39 "should almost never be used. Only in very special cases.\n"
41 "To remove this warning please set the environment variable:\n"
42 " ELM_NO_FINGER_WAGGLING\n"
43 "To the value of the Elementary version + revision number. e.g.:\n"
51 static Eina_Bool _elm_signal_exit(void *data,
55 static Eina_Prefix *pfx = NULL;
56 char *_elm_appname = NULL;
57 const char *_elm_data_dir = NULL;
58 const char *_elm_lib_dir = NULL;
59 int _elm_log_dom = -1;
61 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
63 static int _elm_init_count = 0;
64 static int _elm_sub_init_count = 0;
65 static int _elm_ql_init_count = 0;
66 static int _elm_policies[ELM_POLICY_LAST];
67 static Ecore_Event_Handler *_elm_exit_handler = NULL;
68 static Eina_Bool quicklaunch_on = 0;
71 _elm_signal_exit(void *data __UNUSED__,
72 int ev_type __UNUSED__,
76 return ECORE_CALLBACK_PASS_ON;
82 edje_scale_set(_elm_config->scale);
83 _elm_win_rescale(NULL, EINA_FALSE);
84 _elm_ews_wm_rescale(NULL, EINA_FALSE);
87 static void *app_mainfunc = NULL;
88 static const char *app_domain = NULL;
89 static const char *app_checkfile = NULL;
91 static const char *app_compile_bin_dir = NULL;
92 static const char *app_compile_lib_dir = NULL;
93 static const char *app_compile_data_dir = NULL;
94 static const char *app_compile_locale_dir = NULL;
95 static const char *app_prefix_dir = NULL;
96 static const char *app_bin_dir = NULL;
97 static const char *app_lib_dir = NULL;
98 static const char *app_data_dir = NULL;
99 static const char *app_locale_dir = NULL;
101 static Eina_Prefix *app_pfx = NULL;
108 const char *dirs[4] = { NULL, NULL, NULL, NULL };
109 char *caps = NULL, *p1, *p2;
112 if (!app_domain) return;
114 ecore_app_args_get(&argc, &argv);
115 if (argc < 1) return;
117 dirs[0] = app_compile_bin_dir;
118 dirs[1] = app_compile_lib_dir;
119 dirs[2] = app_compile_data_dir;
120 dirs[3] = app_compile_locale_dir;
122 if (!dirs[1]) dirs[1] = dirs[0];
123 if (!dirs[0]) dirs[0] = dirs[1];
124 if (!dirs[3]) dirs[3] = dirs[2];
125 if (!dirs[2]) dirs[2] = dirs[3];
129 caps = alloca(strlen(app_domain) + 1);
130 for (p1 = (char *)app_domain, p2 = caps; *p1; p1++, p2++)
134 app_pfx = eina_prefix_new(argv[0], app_mainfunc, caps, app_domain,
135 app_checkfile, dirs[0], dirs[1], dirs[2], dirs[3]);
139 _prefix_shutdown(void)
141 if (app_pfx) eina_prefix_free(app_pfx);
142 if (app_domain) eina_stringshare_del(app_domain);
143 if (app_checkfile) eina_stringshare_del(app_checkfile);
144 if (app_compile_bin_dir) eina_stringshare_del(app_compile_bin_dir);
145 if (app_compile_lib_dir) eina_stringshare_del(app_compile_lib_dir);
146 if (app_compile_data_dir) eina_stringshare_del(app_compile_data_dir);
147 if (app_compile_locale_dir) eina_stringshare_del(app_compile_locale_dir);
148 if (app_prefix_dir) eina_stringshare_del(app_prefix_dir);
149 if (app_bin_dir) eina_stringshare_del(app_bin_dir);
150 if (app_lib_dir) eina_stringshare_del(app_lib_dir);
151 if (app_data_dir) eina_stringshare_del(app_data_dir);
152 if (app_locale_dir) eina_stringshare_del(app_locale_dir);
155 app_checkfile = NULL;
156 app_compile_bin_dir = NULL;
157 app_compile_lib_dir = NULL;
158 app_compile_data_dir = NULL;
159 app_compile_locale_dir = NULL;
160 app_prefix_dir = NULL;
164 app_locale_dir = NULL;
173 if (_elm_init_count > 1) return _elm_init_count;
174 elm_quicklaunch_init(argc, argv);
175 elm_quicklaunch_sub_init(argc, argv);
177 return _elm_init_count;
184 if (_elm_init_count > 0) return _elm_init_count;
186 while (_elm_win_deferred_free) ecore_main_loop_iterate();
188 // _prefix_shutdown();
189 elm_quicklaunch_sub_shutdown();
190 elm_quicklaunch_shutdown();
191 return _elm_init_count;
195 elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile)
197 app_mainfunc = mainfunc;
198 eina_stringshare_replace(&app_domain, dom);
199 eina_stringshare_replace(&app_checkfile, checkfile);
203 elm_app_compile_bin_dir_set(const char *dir)
205 eina_stringshare_replace(&app_compile_bin_dir, dir);
209 elm_app_compile_lib_dir_set(const char *dir)
211 eina_stringshare_replace(&app_compile_lib_dir, dir);
215 elm_app_compile_data_dir_set(const char *dir)
217 eina_stringshare_replace(&app_compile_data_dir, dir);
221 elm_app_compile_locale_set(const char *dir)
223 eina_stringshare_replace(&app_compile_locale_dir, dir);
227 elm_app_prefix_dir_get(void)
229 if (app_prefix_dir) return app_prefix_dir;
231 if (!app_pfx) return "";
232 app_prefix_dir = eina_prefix_get(app_pfx);
233 return app_prefix_dir;
237 elm_app_bin_dir_get(void)
239 if (app_bin_dir) return app_bin_dir;
241 if (!app_pfx) return "";
242 app_bin_dir = eina_prefix_bin_get(app_pfx);
247 elm_app_lib_dir_get(void)
249 if (app_lib_dir) return app_lib_dir;
251 if (!app_pfx) return "";
252 app_lib_dir = eina_prefix_lib_get(app_pfx);
257 elm_app_data_dir_get(void)
259 if (app_data_dir) return app_data_dir;
261 if (!app_pfx) return "";
262 app_data_dir = eina_prefix_data_get(app_pfx);
267 elm_app_locale_dir_get(void)
269 if (app_locale_dir) return app_locale_dir;
271 if (!app_pfx) return "";
272 app_locale_dir = eina_prefix_locale_get(app_pfx);
273 return app_locale_dir;
277 static int _elm_need_e_dbus = 0;
280 elm_need_e_dbus(void)
283 if (_elm_need_e_dbus++) return EINA_TRUE;
292 _elm_unneed_e_dbus(void)
295 if (--_elm_need_e_dbus) return;
297 _elm_need_e_dbus = 0;
303 static int _elm_need_efreet = 0;
306 elm_need_efreet(void)
309 if (_elm_need_efreet++) return EINA_TRUE;
317 list = efreet_icon_extra_list_get();
320 e_user_dir_concat_static(buf, "icons");
321 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
322 e_prefix_data_concat_static(buf, "data/icons");
323 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
334 _elm_unneed_efreet(void)
337 if (--_elm_need_efreet) return;
339 _elm_need_efreet = 0;
340 efreet_trash_shutdown();
341 efreet_mime_shutdown();
347 elm_quicklaunch_mode_set(Eina_Bool ql_on)
349 quicklaunch_on = ql_on;
353 elm_quicklaunch_mode_get(void)
355 return quicklaunch_on;
359 elm_quicklaunch_init(int argc,
362 _elm_ql_init_count++;
363 if (_elm_ql_init_count > 1) return _elm_ql_init_count;
365 _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
368 EINA_LOG_ERR("could not register elementary log domain.");
369 _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
375 #ifdef HAVE_ELEMENTARY_EMAP
378 ecore_app_args_set(argc, (const char **)argv);
380 memset(_elm_policies, 0, sizeof(_elm_policies));
381 if (!ELM_EVENT_POLICY_CHANGED)
382 ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
386 _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
388 if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
390 pfx = eina_prefix_new(argv[0], elm_quicklaunch_init,
391 "ELM", "elementary", "config/profile.cfg",
392 PACKAGE_LIB_DIR, /* don't have a bin dir currently */
398 _elm_data_dir = eina_stringshare_add(eina_prefix_data_get(pfx));
399 _elm_lib_dir = eina_stringshare_add(eina_prefix_lib_get(pfx));
401 if (!_elm_data_dir) _elm_data_dir = eina_stringshare_add("/");
402 if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/");
405 return _elm_ql_init_count;
409 elm_quicklaunch_sub_init(int argc,
412 _elm_sub_init_count++;
413 if (_elm_sub_init_count > 1) return _elm_sub_init_count;
416 #ifdef SEMI_BROKEN_QUICKLAUNCH
417 return _elm_sub_init_count;
422 ecore_app_args_set(argc, (const char **)argv);
426 _elm_config_sub_init();
427 ecore_evas_init(); // FIXME: check errors
430 ecore_con_url_init();
433 return _elm_sub_init_count;
437 elm_quicklaunch_sub_shutdown(void)
439 _elm_sub_init_count--;
440 if (_elm_sub_init_count > 0) return _elm_sub_init_count;
443 #ifdef SEMI_BROKEN_QUICKLAUNCH
444 return _elm_sub_init_count;
450 _elm_module_shutdown();
451 _elm_ews_wm_shutdown();
452 ecore_con_url_shutdown();
453 ecore_con_shutdown();
454 ecore_imf_shutdown();
455 ecore_evas_shutdown();
456 _elm_config_sub_shutdown();
457 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
458 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
459 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
460 ENGINE_COMPARE(ELM_XRENDER_X11) ||
461 ENGINE_COMPARE(ELM_OPENGL_X11) ||
462 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
463 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
464 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
465 ENGINE_COMPARE(ELM_OPENGL_COCOA) ||
466 ENGINE_COMPARE(ELM_SOFTWARE_WIN32) ||
467 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
468 ENGINE_COMPARE(ELM_EWS))
469 #undef ENGINE_COMPARE
470 evas_cserve_disconnect();
474 return _elm_sub_init_count;
478 elm_quicklaunch_shutdown(void)
480 _elm_ql_init_count--;
481 if (_elm_ql_init_count > 0) return _elm_ql_init_count;
482 if (pfx) eina_prefix_free(pfx);
484 eina_stringshare_del(_elm_data_dir);
485 _elm_data_dir = NULL;
486 eina_stringshare_del(_elm_lib_dir);
492 _elm_config_shutdown();
494 ecore_event_handler_del(_elm_exit_handler);
495 _elm_exit_handler = NULL;
497 _elm_theme_shutdown();
498 _elm_unneed_efreet();
499 _elm_unneed_e_dbus();
500 _elm_unneed_ethumb();
502 ecore_file_shutdown();
504 #ifdef HAVE_ELEMENTARY_EMAP
511 if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
513 eina_log_domain_unregister(_elm_log_dom);
517 _elm_widget_type_clear();
520 return _elm_ql_init_count;
524 elm_quicklaunch_seed(void)
526 #ifndef SEMI_BROKEN_QUICKLAUNCH
529 Evas_Object *win, *bg, *bt;
531 win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
532 bg = elm_bg_add(win);
533 elm_win_resize_object_add(win, bg);
534 evas_object_show(bg);
535 bt = elm_button_add(win);
536 elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
537 elm_win_resize_object_add(win, bt);
538 ecore_main_loop_iterate();
539 evas_object_del(win);
540 ecore_main_loop_iterate();
541 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
542 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
543 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
544 ENGINE_COMPARE(ELM_XRENDER_X11) ||
545 ENGINE_COMPARE(ELM_OPENGL_X11))
546 #undef ENGINE_COMPARE
548 # ifdef HAVE_ELEMENTARY_X
552 ecore_main_loop_iterate();
558 static void *qr_handle = NULL;
560 static int (*qr_main)(int argc,
564 elm_quicklaunch_prepare(int argc __UNUSED__,
568 char *exe = elm_quicklaunch_exe_path_get(argv[0]);
571 ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
579 exe2 = malloc(strlen(exe) + 1 + 10);
581 p = strrchr(exe2, '/');
584 exename = alloca(strlen(p) + 1);
587 strcat(p, "../lib/");
590 if (!access(exe2, R_OK | X_OK))
598 qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
601 fprintf(stderr, "dlerr: %s\n", dlerror());
602 WRN("dlopen('%s') failed: %s", exe, dlerror());
606 INF("dlopen('%s') = %p", exe, qr_handle);
607 qr_main = dlsym(qr_handle, "elm_main");
608 INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
611 WRN("not quicklauncher capable: no elm_main in '%s'", exe);
630 extern char **environ;
635 for (i = 0, size = 0; environ[i]; i++)
636 size += strlen(environ[i]) + 1;
638 p = malloc((i + 1) * sizeof(char *));
643 for (i = 0; oldenv[i]; i++)
644 environ[i] = strdup(oldenv[i]);
651 elm_quicklaunch_fork(int argc,
654 void (postfork_func) (void *data),
664 // need to accept current environment from elementary_run
671 if (child > 0) return EINA_TRUE;
674 perror("could not fork");
679 perror("could not chdir");
680 args = alloca((argc + 1) * sizeof(char *));
681 for (i = 0; i < argc; i++) args[i] = argv[i];
683 WRN("%s not quicklaunch capable, fallback...", argv[0]);
684 execvp(argv[0], args);
685 ERR("failed to execute '%s': %s", argv[0], strerror(errno));
689 if (child > 0) return EINA_TRUE;
692 perror("could not fork");
695 if (postfork_func) postfork_func(postfork_data);
699 #ifdef SEMI_BROKEN_QUICKLAUNCH
700 ecore_app_args_set(argc, (const char **)argv);
703 _elm_config_sub_init();
704 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
705 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
706 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
707 ENGINE_COMPARE(ELM_XRENDER_X11) ||
708 ENGINE_COMPARE(ELM_OPENGL_X11))
709 #undef ENGINE_COMPARE
711 # ifdef HAVE_ELEMENTARY_X
715 ecore_evas_init(); // FIXME: check errors
723 perror("could not chdir");
724 // FIXME: this is very linux specific. it changes argv[0] of the process
725 // so ps etc. report what you'd expect. for other unixes and os's this
732 ecore_app_args_get(&real_argc, &real_argv);
733 lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
734 for (p = real_argv[0]; p < lastarg; p++) *p = 0;
735 strcpy(real_argv[0], argv[0]);
737 ecore_app_args_set(argc, (const char **)argv);
738 ret = qr_main(argc, argv);
752 elm_quicklaunch_cleanup(void)
765 elm_quicklaunch_fallback(int argc,
769 elm_quicklaunch_init(argc, argv);
770 elm_quicklaunch_sub_init(argc, argv);
771 elm_quicklaunch_prepare(argc, argv);
772 ret = qr_main(argc, argv);
778 elm_quicklaunch_exe_path_get(const char *exe)
780 static char *path = NULL;
781 static Eina_List *pathlist = NULL;
785 if (exe[0] == '/') return strdup(exe);
786 if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
787 if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
792 path = getenv("PATH");
793 buf2 = alloca(strlen(path) + 1);
798 if ((*p == ':') || (!*p))
803 strncpy(buf2, pp, len);
805 pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
817 EINA_LIST_FOREACH(pathlist, l, pathitr)
819 snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
820 if (!access(buf, R_OK | X_OK)) return strdup(buf);
828 ecore_main_loop_begin();
834 ecore_main_loop_quit();
838 elm_policy_set(unsigned int policy,
841 Elm_Event_Policy_Changed *ev;
843 if (policy >= ELM_POLICY_LAST)
846 if (value == _elm_policies[policy])
849 /* TODO: validade policy? */
851 ev = malloc(sizeof(*ev));
853 ev->new_value = value;
854 ev->old_value = _elm_policies[policy];
856 _elm_policies[policy] = value;
858 ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
864 elm_policy_get(unsigned int policy)
866 if (policy >= ELM_POLICY_LAST)
868 return _elm_policies[policy];
872 elm_language_set(const char *lang)
874 setlocale(LC_ALL, lang);
875 _elm_win_translate();
879 elm_object_mirrored_get(const Evas_Object *obj)
881 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
882 return elm_widget_mirrored_get(obj);
886 elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
888 EINA_SAFETY_ON_NULL_RETURN(obj);
889 elm_widget_mirrored_set(obj, mirrored);
893 elm_object_mirrored_automatic_get(const Evas_Object *obj)
895 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
896 return elm_widget_mirrored_automatic_get(obj);
900 elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic)
902 EINA_SAFETY_ON_NULL_RETURN(obj);
903 elm_widget_mirrored_automatic_set(obj, automatic);
911 elm_object_scale_set(Evas_Object *obj,
914 EINA_SAFETY_ON_NULL_RETURN(obj);
915 elm_widget_scale_set(obj, scale);
919 elm_object_scale_get(const Evas_Object *obj)
921 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0);
922 return elm_widget_scale_get(obj);
926 elm_object_text_part_set(Evas_Object *obj, const char *part, const char *label)
928 EINA_SAFETY_ON_NULL_RETURN(obj);
929 elm_widget_text_part_set(obj, part, label);
933 elm_object_text_part_get(const Evas_Object *obj, const char *part)
935 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
936 return elm_widget_text_part_get(obj, part);
940 elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text)
942 EINA_SAFETY_ON_NULL_RETURN(obj);
943 elm_widget_domain_translatable_text_part_set(obj, part, domain, text);
947 elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part)
949 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
950 return elm_widget_translatable_text_part_get(obj, part);
954 elm_object_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content)
956 EINA_SAFETY_ON_NULL_RETURN(obj);
957 elm_widget_content_part_set(obj, part, content);
961 elm_object_content_part_get(const Evas_Object *obj, const char *part)
963 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
964 return elm_widget_content_part_get(obj, part);
968 elm_object_content_part_unset(Evas_Object *obj, const char *part)
970 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
971 return elm_widget_content_part_unset(obj, part);
977 return _elm_config->scale;
981 elm_scale_set(double scale)
983 if (_elm_config->scale == scale) return;
984 _elm_config->scale = scale;
989 elm_scale_all_set(double scale)
991 elm_scale_set(scale);
992 _elm_config_all_update();
996 elm_password_show_last_get(void)
998 return _elm_config->password_show_last;
1002 elm_password_show_last_set(Eina_Bool password_show_last)
1004 if (_elm_config->password_show_last == password_show_last) return;
1005 _elm_config->password_show_last = password_show_last;
1006 edje_password_show_last_set(_elm_config->password_show_last);
1010 elm_password_show_last_timeout_get(void)
1012 return _elm_config->password_show_last_timeout;
1016 elm_password_show_last_timeout_set(double password_show_last_timeout)
1018 if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
1019 _elm_config->password_show_last_timeout = password_show_last_timeout;
1020 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1024 elm_object_style_set(Evas_Object *obj,
1027 EINA_SAFETY_ON_NULL_RETURN(obj);
1028 elm_widget_style_set(obj, style);
1032 elm_object_style_get(const Evas_Object *obj)
1034 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1035 return elm_widget_style_get(obj);
1039 elm_object_disabled_set(Evas_Object *obj,
1042 EINA_SAFETY_ON_NULL_RETURN(obj);
1043 elm_widget_disabled_set(obj, disabled);
1047 elm_object_disabled_get(const Evas_Object *obj)
1049 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1050 return elm_widget_disabled_get(obj);
1054 elm_config_save(void)
1056 return _elm_config_save();
1060 elm_config_reload(void)
1062 _elm_config_reload();
1066 elm_profile_current_get(void)
1068 return _elm_config_current_profile_get();
1072 elm_profile_dir_get(const char *profile,
1075 return _elm_config_profile_dir_get(profile, is_user);
1079 elm_profile_dir_free(const char *p_dir)
1081 free((void *)p_dir);
1085 elm_profile_list_get(void)
1087 return _elm_config_profiles_list();
1091 elm_profile_list_free(Eina_List *l)
1095 EINA_LIST_FREE(l, dir)
1096 eina_stringshare_del(dir);
1100 elm_profile_set(const char *profile)
1102 EINA_SAFETY_ON_NULL_RETURN(profile);
1103 _elm_config_profile_set(profile);
1107 elm_profile_all_set(const char *profile)
1109 _elm_config_profile_set(profile);
1110 _elm_config_all_update();
1114 elm_engine_current_get(void)
1116 return _elm_config->engine;
1120 elm_engine_set(const char *engine)
1122 EINA_SAFETY_ON_NULL_RETURN(engine);
1124 _elm_config_engine_set(engine);
1127 EAPI const Eina_List *
1128 elm_text_classes_list_get(void)
1130 return _elm_config_text_classes_get();
1134 elm_text_classes_list_free(const Eina_List *list)
1136 _elm_config_text_classes_free((Eina_List *)list);
1139 EAPI const Eina_List *
1140 elm_font_overlay_list_get(void)
1142 return _elm_config_font_overlays_list();
1146 elm_font_overlay_set(const char *text_class,
1148 Evas_Font_Size size)
1150 _elm_config_font_overlay_set(text_class, font, size);
1154 elm_font_overlay_unset(const char *text_class)
1156 _elm_config_font_overlay_remove(text_class);
1160 elm_font_overlay_apply(void)
1162 _elm_config_font_overlay_apply();
1166 elm_font_overlay_all_apply(void)
1168 elm_font_overlay_apply();
1169 _elm_config_all_update();
1172 EAPI Elm_Font_Properties *
1173 elm_font_properties_get(const char *font)
1175 EINA_SAFETY_ON_NULL_RETURN_VAL(font, NULL);
1176 return _elm_font_properties_get(NULL, font);
1180 elm_font_properties_free(Elm_Font_Properties *efp)
1184 EINA_SAFETY_ON_NULL_RETURN(efp);
1185 EINA_LIST_FREE(efp->styles, str)
1186 if (str) eina_stringshare_del(str);
1187 if (efp->name) eina_stringshare_del(efp->name);
1192 elm_font_fontconfig_name_get(const char *name,
1197 EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
1198 if (!style || style[0] == 0) return eina_stringshare_add(name);
1199 snprintf(buf, 256, "%s" ELM_FONT_TOKEN_STYLE "%s", name, style);
1200 return eina_stringshare_add(buf);
1204 elm_font_fontconfig_name_free(const char *name)
1206 eina_stringshare_del(name);
1210 elm_font_available_hash_add(Eina_List *list)
1212 Eina_Hash *font_hash;
1218 /* populate with default font families */
1219 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Regular");
1220 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Bold");
1221 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Oblique");
1222 font_hash = _elm_font_available_hash_add(font_hash,
1223 "Sans:style=Bold Oblique");
1225 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Regular");
1226 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Bold");
1227 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Oblique");
1228 font_hash = _elm_font_available_hash_add(font_hash,
1229 "Serif:style=Bold Oblique");
1231 font_hash = _elm_font_available_hash_add(font_hash,
1232 "Monospace:style=Regular");
1233 font_hash = _elm_font_available_hash_add(font_hash,
1234 "Monospace:style=Bold");
1235 font_hash = _elm_font_available_hash_add(font_hash,
1236 "Monospace:style=Oblique");
1237 font_hash = _elm_font_available_hash_add(font_hash,
1238 "Monospace:style=Bold Oblique");
1240 EINA_LIST_FOREACH(list, l, key)
1241 font_hash = _elm_font_available_hash_add(font_hash, key);
1247 elm_font_available_hash_del(Eina_Hash *hash)
1249 _elm_font_available_hash_del(hash);
1253 elm_finger_size_get(void)
1255 return _elm_config->finger_size;
1259 elm_finger_size_set(Evas_Coord size)
1261 if (_elm_config->finger_size == size) return;
1262 _elm_config->finger_size = size;
1267 elm_finger_size_all_set(Evas_Coord size)
1269 elm_finger_size_set(size);
1270 _elm_config_all_update();
1274 elm_coords_finger_size_adjust(int times_w,
1279 if ((w) && (*w < (_elm_config->finger_size * times_w)))
1280 *w = _elm_config->finger_size * times_w;
1281 if ((h) && (*h < (_elm_config->finger_size * times_h)))
1282 *h = _elm_config->finger_size * times_h;
1291 edje_file_cache_flush();
1292 edje_collection_cache_flush();
1294 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1296 Evas *e = evas_object_evas_get(obj);
1297 evas_image_cache_flush(e);
1298 evas_font_cache_flush(e);
1299 evas_render_dump(e);
1304 elm_cache_flush_interval_get(void)
1306 return _elm_config->cache_flush_poll_interval;
1310 elm_cache_flush_interval_set(int size)
1312 if (_elm_config->cache_flush_poll_interval == size) return;
1313 _elm_config->cache_flush_poll_interval = size;
1319 elm_cache_flush_interval_all_set(int size)
1321 elm_cache_flush_interval_set(size);
1322 _elm_config_all_update();
1326 elm_cache_flush_enabled_get(void)
1328 return _elm_config->cache_flush_enable;
1332 elm_cache_flush_enabled_set(Eina_Bool enabled)
1334 enabled = !!enabled;
1335 if (_elm_config->cache_flush_enable == enabled) return;
1336 _elm_config->cache_flush_enable = enabled;
1342 elm_cache_flush_enabled_all_set(Eina_Bool enabled)
1344 elm_cache_flush_enabled_set(enabled);
1345 _elm_config_all_update();
1349 elm_font_cache_get(void)
1351 return _elm_config->font_cache;
1355 elm_font_cache_set(int size)
1357 if (_elm_config->font_cache == size) return;
1358 _elm_config->font_cache = size;
1364 elm_font_cache_all_set(int size)
1366 elm_font_cache_set(size);
1367 _elm_config_all_update();
1371 elm_image_cache_get(void)
1373 return _elm_config->image_cache;
1377 elm_image_cache_set(int size)
1379 if (_elm_config->image_cache == size) return;
1380 _elm_config->image_cache = size;
1386 elm_image_cache_all_set(int size)
1388 elm_image_cache_set(size);
1389 _elm_config_all_update();
1393 elm_edje_file_cache_get(void)
1395 return _elm_config->edje_cache;
1399 elm_edje_file_cache_set(int size)
1401 if (_elm_config->edje_cache == size) return;
1402 _elm_config->edje_cache = size;
1408 elm_edje_file_cache_all_set(int size)
1410 elm_edje_file_cache_set(size);
1411 _elm_config_all_update();
1415 elm_edje_collection_cache_get(void)
1417 return _elm_config->edje_collection_cache;
1421 elm_edje_collection_cache_set(int size)
1423 if (_elm_config->edje_collection_cache == size) return;
1424 _elm_config->edje_collection_cache = size;
1430 elm_edje_collection_cache_all_set(int size)
1432 elm_edje_collection_cache_set(size);
1433 _elm_config_all_update();
1437 elm_object_focus_get(const Evas_Object *obj)
1439 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1440 return elm_widget_focus_get(obj);
1444 elm_object_focus_set(Evas_Object *obj,
1447 EINA_SAFETY_ON_NULL_RETURN(obj);
1450 if (elm_widget_focus_get(obj)) return;
1451 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1455 if (!elm_widget_can_focus_get(obj)) return;
1456 elm_widget_focused_object_clear(obj);
1461 elm_object_focus(Evas_Object *obj)
1463 EINA_SAFETY_ON_NULL_RETURN(obj);
1464 elm_object_focus_set(obj, EINA_TRUE);
1468 elm_object_unfocus(Evas_Object *obj)
1470 EINA_SAFETY_ON_NULL_RETURN(obj);
1471 elm_object_focus_set(obj, EINA_FALSE);
1475 elm_object_focus_allow_set(Evas_Object *obj,
1478 EINA_SAFETY_ON_NULL_RETURN(obj);
1479 elm_widget_can_focus_set(obj, enable);
1483 elm_object_focus_allow_get(const Evas_Object *obj)
1485 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1486 return (elm_widget_can_focus_get(obj)) || (elm_widget_child_can_focus_get(obj));
1490 elm_object_focus_custom_chain_set(Evas_Object *obj,
1493 EINA_SAFETY_ON_NULL_RETURN(obj);
1494 elm_widget_focus_custom_chain_set(obj, objs);
1498 elm_object_focus_custom_chain_unset(Evas_Object *obj)
1500 EINA_SAFETY_ON_NULL_RETURN(obj);
1501 elm_widget_focus_custom_chain_unset(obj);
1504 EAPI const Eina_List *
1505 elm_object_focus_custom_chain_get(const Evas_Object *obj)
1507 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1508 return elm_widget_focus_custom_chain_get(obj);
1512 elm_object_focus_custom_chain_append(Evas_Object *obj,
1514 Evas_Object *relative_child)
1516 EINA_SAFETY_ON_NULL_RETURN(obj);
1517 EINA_SAFETY_ON_NULL_RETURN(child);
1518 elm_widget_focus_custom_chain_append(obj, child, relative_child);
1522 elm_object_focus_custom_chain_prepend(Evas_Object *obj,
1524 Evas_Object *relative_child)
1526 EINA_SAFETY_ON_NULL_RETURN(obj);
1527 EINA_SAFETY_ON_NULL_RETURN(child);
1528 elm_widget_focus_custom_chain_prepend(obj, child, relative_child);
1532 elm_object_focus_cycle(Evas_Object *obj,
1533 Elm_Focus_Direction dir)
1535 EINA_SAFETY_ON_NULL_RETURN(obj);
1536 elm_widget_focus_cycle(obj, dir);
1540 elm_object_focus_direction_go(Evas_Object *obj,
1544 EINA_SAFETY_ON_NULL_RETURN(obj);
1545 elm_widget_focus_direction_go(obj, x, y);
1549 elm_object_tree_unfocusable_set(Evas_Object *obj,
1550 Eina_Bool tree_unfocusable)
1552 EINA_SAFETY_ON_NULL_RETURN(obj);
1553 elm_widget_tree_unfocusable_set(obj, tree_unfocusable);
1557 elm_object_tree_unfocusable_get(const Evas_Object *obj)
1559 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1560 return elm_widget_tree_unfocusable_get(obj);
1564 elm_focus_highlight_enabled_get(void)
1566 return _elm_config->focus_highlight_enable;
1570 elm_focus_highlight_enabled_set(Eina_Bool enable)
1572 _elm_config->focus_highlight_enable = !!enable;
1576 elm_focus_highlight_animate_get(void)
1578 return _elm_config->focus_highlight_animate;
1582 elm_focus_highlight_animate_set(Eina_Bool animate)
1584 _elm_config->focus_highlight_animate = !!animate;
1588 elm_scroll_bounce_enabled_get(void)
1590 return _elm_config->thumbscroll_bounce_enable;
1594 elm_scroll_bounce_enabled_set(Eina_Bool enabled)
1596 _elm_config->thumbscroll_bounce_enable = enabled;
1600 elm_scroll_bounce_enabled_all_set(Eina_Bool enabled)
1602 elm_scroll_bounce_enabled_set(enabled);
1603 _elm_config_all_update();
1607 elm_scroll_bounce_friction_get(void)
1609 return _elm_config->thumbscroll_bounce_friction;
1613 elm_scroll_bounce_friction_set(double friction)
1615 _elm_config->thumbscroll_bounce_friction = friction;
1619 elm_scroll_bounce_friction_all_set(double friction)
1621 elm_scroll_bounce_friction_set(friction);
1622 _elm_config_all_update();
1626 elm_scroll_page_scroll_friction_get(void)
1628 return _elm_config->page_scroll_friction;
1632 elm_scroll_page_scroll_friction_set(double friction)
1634 _elm_config->page_scroll_friction = friction;
1638 elm_scroll_page_scroll_friction_all_set(double friction)
1640 elm_scroll_page_scroll_friction_set(friction);
1641 _elm_config_all_update();
1645 elm_scroll_bring_in_scroll_friction_get(void)
1647 return _elm_config->bring_in_scroll_friction;
1651 elm_scroll_bring_in_scroll_friction_set(double friction)
1653 _elm_config->bring_in_scroll_friction = friction;
1657 elm_scroll_bring_in_scroll_friction_all_set(double friction)
1659 elm_scroll_bring_in_scroll_friction_set(friction);
1660 _elm_config_all_update();
1664 elm_scroll_zoom_friction_get(void)
1666 return _elm_config->zoom_friction;
1670 elm_scroll_zoom_friction_set(double friction)
1672 _elm_config->zoom_friction = friction;
1676 elm_scroll_zoom_friction_all_set(double friction)
1678 elm_scroll_zoom_friction_set(friction);
1679 _elm_config_all_update();
1683 elm_scroll_thumbscroll_enabled_get(void)
1685 return _elm_config->thumbscroll_enable;
1689 elm_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
1691 _elm_config->thumbscroll_enable = enabled;
1695 elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled)
1697 elm_scroll_thumbscroll_enabled_set(enabled);
1698 _elm_config_all_update();
1702 elm_scroll_thumbscroll_threshold_get(void)
1704 return _elm_config->thumbscroll_threshold;
1708 elm_scroll_thumbscroll_threshold_set(unsigned int threshold)
1710 _elm_config->thumbscroll_threshold = threshold;
1714 elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold)
1716 elm_scroll_thumbscroll_threshold_set(threshold);
1717 _elm_config_all_update();
1721 elm_scroll_thumbscroll_momentum_threshold_get(void)
1723 return _elm_config->thumbscroll_momentum_threshold;
1727 elm_scroll_thumbscroll_momentum_threshold_set(double threshold)
1729 _elm_config->thumbscroll_momentum_threshold = threshold;
1733 elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold)
1735 elm_scroll_thumbscroll_momentum_threshold_set(threshold);
1736 _elm_config_all_update();
1740 elm_scroll_thumbscroll_friction_get(void)
1742 return _elm_config->thumbscroll_friction;
1746 elm_scroll_thumbscroll_friction_set(double friction)
1748 _elm_config->thumbscroll_friction = friction;
1752 elm_scroll_thumbscroll_friction_all_set(double friction)
1754 elm_scroll_thumbscroll_friction_set(friction);
1755 _elm_config_all_update();
1759 elm_scroll_thumbscroll_border_friction_get(void)
1761 return _elm_config->thumbscroll_border_friction;
1765 elm_scroll_thumbscroll_border_friction_set(double friction)
1767 if (friction < 0.0) friction = 0.0;
1768 if (friction > 1.0) friction = 1.0;
1769 _elm_config->thumbscroll_friction = friction;
1773 elm_scroll_thumbscroll_border_friction_all_set(double friction)
1775 elm_scroll_thumbscroll_border_friction_set(friction);
1776 _elm_config_all_update();
1780 elm_scroll_thumbscroll_sensitivity_friction_get(void)
1782 return _elm_config->thumbscroll_sensitivity_friction;
1786 elm_scroll_thumbscroll_sensitivity_friction_set(double friction)
1788 if (friction < 0.1) friction = 0.1;
1789 if (friction > 1.0) friction = 1.0;
1790 _elm_config->thumbscroll_friction = friction;
1794 elm_scroll_thumbscroll_sensitivity_friction_all_set(double friction)
1796 elm_scroll_thumbscroll_sensitivity_friction_set(friction);
1797 _elm_config_all_update();
1801 elm_object_scroll_hold_push(Evas_Object *obj)
1803 EINA_SAFETY_ON_NULL_RETURN(obj);
1804 elm_widget_scroll_hold_push(obj);
1808 elm_object_scroll_hold_pop(Evas_Object *obj)
1810 EINA_SAFETY_ON_NULL_RETURN(obj);
1811 elm_widget_scroll_hold_pop(obj);
1815 elm_object_scroll_freeze_push(Evas_Object *obj)
1817 EINA_SAFETY_ON_NULL_RETURN(obj);
1818 elm_widget_scroll_freeze_push(obj);
1822 elm_object_scroll_lock_x_set(Evas_Object *obj,
1825 EINA_SAFETY_ON_NULL_RETURN(obj);
1826 elm_widget_drag_lock_x_set(obj, lock);
1830 elm_object_scroll_lock_y_set(Evas_Object *obj,
1833 EINA_SAFETY_ON_NULL_RETURN(obj);
1834 elm_widget_drag_lock_y_set(obj, lock);
1838 elm_object_scroll_lock_x_get(const Evas_Object *obj)
1840 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1841 return elm_widget_drag_lock_x_get(obj);
1845 elm_object_scroll_lock_y_get(const Evas_Object *obj)
1847 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1848 return elm_widget_drag_lock_y_get(obj);
1852 elm_object_scroll_freeze_pop(Evas_Object *obj)
1854 EINA_SAFETY_ON_NULL_RETURN(obj);
1855 elm_widget_scroll_freeze_pop(obj);
1859 elm_object_widget_check(const Evas_Object *obj)
1861 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1862 return elm_widget_is(obj);
1866 elm_object_parent_widget_get(const Evas_Object *obj)
1868 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1869 return elm_widget_parent_widget_get(obj);
1873 elm_object_top_widget_get(const Evas_Object *obj)
1875 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1876 return elm_widget_top_get(obj);
1880 elm_object_widget_type_get(const Evas_Object *obj)
1882 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1883 return elm_widget_type_get(obj);
1887 elm_object_signal_emit(Evas_Object *obj,
1888 const char *emission,
1891 EINA_SAFETY_ON_NULL_RETURN(obj);
1892 elm_widget_signal_emit(obj, emission, source);
1896 elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
1898 EINA_SAFETY_ON_NULL_RETURN(obj);
1899 EINA_SAFETY_ON_NULL_RETURN(func);
1900 elm_widget_signal_callback_add(obj, emission, source, func, data);
1904 elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func)
1906 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1907 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
1908 return elm_widget_signal_callback_del(obj, emission, source, func);
1912 elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data)
1914 EINA_SAFETY_ON_NULL_RETURN(obj);
1915 EINA_SAFETY_ON_NULL_RETURN(func);
1916 elm_widget_event_callback_add(obj, func, data);
1920 elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data)
1922 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1923 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
1924 return elm_widget_event_callback_del(obj, func, data);
1928 elm_object_tree_dump(const Evas_Object *top)
1931 elm_widget_tree_dump(top);
1939 elm_object_tree_dot_dump(const Evas_Object *top,
1943 FILE *f = fopen(file, "wb");
1944 elm_widget_tree_dot_dump(top, f);
1954 elm_longpress_timeout_set(double longpress_timeout)
1956 _elm_config->longpress_timeout = longpress_timeout;
1960 elm_longpress_timeout_get(void)
1962 return _elm_config->longpress_timeout;
1966 elm_object_item_object_get(const Elm_Object_Item *it)
1968 return ((Elm_Widget_Item *) it)->widget;
1972 elm_object_item_content_part_set(Elm_Object_Item *it,
1974 Evas_Object *content)
1976 _elm_widget_item_content_part_set((Elm_Widget_Item *) it, part, content);
1980 elm_object_item_content_part_get(const Elm_Object_Item *it,
1983 return _elm_widget_item_content_part_get((Elm_Widget_Item *) it, part);
1987 elm_object_item_content_part_unset(Elm_Object_Item *it, const char *part)
1989 return _elm_widget_item_content_part_unset((Elm_Widget_Item *) it, part);
1993 elm_object_item_text_part_set(Elm_Object_Item *it,
1997 _elm_widget_item_text_part_set((Elm_Widget_Item *) it, part, label);
2001 elm_object_item_text_part_get(const Elm_Object_Item *it, const char *part)
2003 return _elm_widget_item_text_part_get((Elm_Widget_Item *) it, part);
2007 elm_object_access_info_set(Evas_Object *obj, const char *txt)
2009 elm_widget_access_info_set(obj, txt);
2013 elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt)
2015 _elm_widget_item_access_info_set((Elm_Widget_Item *) it, txt);
2019 elm_object_item_data_get(const Elm_Object_Item *it)
2021 return elm_widget_item_data_get(it);
2025 elm_object_item_data_set(Elm_Object_Item *it, void *data)
2027 elm_widget_item_data_set(it, data);
2031 elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source)
2033 _elm_widget_item_signal_emit((Elm_Widget_Item *) it, emission, source);