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_SOFTWARE_WIN32) ||
466 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
467 ENGINE_COMPARE(ELM_EWS))
468 #undef ENGINE_COMPARE
469 evas_cserve_disconnect();
473 return _elm_sub_init_count;
477 elm_quicklaunch_shutdown(void)
479 _elm_ql_init_count--;
480 if (_elm_ql_init_count > 0) return _elm_ql_init_count;
481 if (pfx) eina_prefix_free(pfx);
483 eina_stringshare_del(_elm_data_dir);
484 _elm_data_dir = NULL;
485 eina_stringshare_del(_elm_lib_dir);
491 _elm_config_shutdown();
493 ecore_event_handler_del(_elm_exit_handler);
494 _elm_exit_handler = NULL;
496 _elm_theme_shutdown();
497 _elm_unneed_efreet();
498 _elm_unneed_e_dbus();
499 _elm_unneed_ethumb();
501 ecore_file_shutdown();
503 #ifdef HAVE_ELEMENTARY_EMAP
510 if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
512 eina_log_domain_unregister(_elm_log_dom);
516 _elm_widget_type_clear();
519 return _elm_ql_init_count;
523 elm_quicklaunch_seed(void)
525 #ifndef SEMI_BROKEN_QUICKLAUNCH
528 Evas_Object *win, *bg, *bt;
530 win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
531 bg = elm_bg_add(win);
532 elm_win_resize_object_add(win, bg);
533 evas_object_show(bg);
534 bt = elm_button_add(win);
535 elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
536 elm_win_resize_object_add(win, bt);
537 ecore_main_loop_iterate();
538 evas_object_del(win);
539 ecore_main_loop_iterate();
540 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
541 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
542 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
543 ENGINE_COMPARE(ELM_XRENDER_X11) ||
544 ENGINE_COMPARE(ELM_OPENGL_X11))
545 #undef ENGINE_COMPARE
547 # ifdef HAVE_ELEMENTARY_X
551 ecore_main_loop_iterate();
556 static void *qr_handle = NULL;
557 static int (*qr_main)(int argc,
561 elm_quicklaunch_prepare(int argc __UNUSED__,
565 char *exe = elm_quicklaunch_exe_path_get(argv[0]);
568 ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
576 exe2 = malloc(strlen(exe) + 1 + 10);
578 p = strrchr(exe2, '/');
581 exename = alloca(strlen(p) + 1);
584 strcat(p, "../lib/");
587 if (!access(exe2, R_OK | X_OK))
595 qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
598 fprintf(stderr, "dlerr: %s\n", dlerror());
599 WRN("dlopen('%s') failed: %s", exe, dlerror());
603 INF("dlopen('%s') = %p", exe, qr_handle);
604 qr_main = dlsym(qr_handle, "elm_main");
605 INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
608 WRN("not quicklauncher capable: no elm_main in '%s'", exe);
627 extern char **environ;
632 for (i = 0, size = 0; environ[i]; i++)
633 size += strlen(environ[i]) + 1;
635 p = malloc((i + 1) * sizeof(char *));
640 for (i = 0; oldenv[i]; i++)
641 environ[i] = strdup(oldenv[i]);
648 elm_quicklaunch_fork(int argc,
651 void (postfork_func) (void *data),
661 // need to accept current environment from elementary_run
668 if (child > 0) return EINA_TRUE;
671 perror("could not fork");
676 perror("could not chdir");
677 args = alloca((argc + 1) * sizeof(char *));
678 for (i = 0; i < argc; i++) args[i] = argv[i];
680 WRN("%s not quicklaunch capable, fallback...", argv[0]);
681 execvp(argv[0], args);
682 ERR("failed to execute '%s': %s", argv[0], strerror(errno));
686 if (child > 0) return EINA_TRUE;
689 perror("could not fork");
692 if (postfork_func) postfork_func(postfork_data);
696 #ifdef SEMI_BROKEN_QUICKLAUNCH
697 ecore_app_args_set(argc, (const char **)argv);
700 _elm_config_sub_init();
701 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
702 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
703 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
704 ENGINE_COMPARE(ELM_XRENDER_X11) ||
705 ENGINE_COMPARE(ELM_OPENGL_X11))
706 #undef ENGINE_COMPARE
708 # ifdef HAVE_ELEMENTARY_X
712 ecore_evas_init(); // FIXME: check errors
720 perror("could not chdir");
721 // FIXME: this is very linux specific. it changes argv[0] of the process
722 // so ps etc. report what you'd expect. for other unixes and os's this
729 ecore_app_args_get(&real_argc, &real_argv);
730 lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
731 for (p = real_argv[0]; p < lastarg; p++) *p = 0;
732 strcpy(real_argv[0], argv[0]);
734 ecore_app_args_set(argc, (const char **)argv);
735 ret = qr_main(argc, argv);
749 elm_quicklaunch_cleanup(void)
762 elm_quicklaunch_fallback(int argc,
766 elm_quicklaunch_init(argc, argv);
767 elm_quicklaunch_sub_init(argc, argv);
768 elm_quicklaunch_prepare(argc, argv);
769 ret = qr_main(argc, argv);
775 elm_quicklaunch_exe_path_get(const char *exe)
777 static char *path = NULL;
778 static Eina_List *pathlist = NULL;
782 if (exe[0] == '/') return strdup(exe);
783 if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
784 if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
789 path = getenv("PATH");
790 buf2 = alloca(strlen(path) + 1);
795 if ((*p == ':') || (!*p))
800 strncpy(buf2, pp, len);
802 pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
814 EINA_LIST_FOREACH(pathlist, l, pathitr)
816 snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
817 if (!access(buf, R_OK | X_OK)) return strdup(buf);
825 ecore_main_loop_begin();
831 ecore_main_loop_quit();
835 elm_policy_set(unsigned int policy,
838 Elm_Event_Policy_Changed *ev;
840 if (policy >= ELM_POLICY_LAST)
843 if (value == _elm_policies[policy])
846 /* TODO: validade policy? */
848 ev = malloc(sizeof(*ev));
850 ev->new_value = value;
851 ev->old_value = _elm_policies[policy];
853 _elm_policies[policy] = value;
855 ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
861 elm_policy_get(unsigned int policy)
863 if (policy >= ELM_POLICY_LAST)
865 return _elm_policies[policy];
869 elm_object_mirrored_get(const Evas_Object *obj)
871 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
872 return elm_widget_mirrored_get(obj);
876 elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
878 EINA_SAFETY_ON_NULL_RETURN(obj);
879 elm_widget_mirrored_set(obj, mirrored);
883 elm_object_mirrored_automatic_get(const Evas_Object *obj)
885 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
886 return elm_widget_mirrored_automatic_get(obj);
890 elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic)
892 EINA_SAFETY_ON_NULL_RETURN(obj);
893 elm_widget_mirrored_automatic_set(obj, automatic);
901 elm_object_scale_set(Evas_Object *obj,
904 EINA_SAFETY_ON_NULL_RETURN(obj);
905 elm_widget_scale_set(obj, scale);
909 elm_object_scale_get(const Evas_Object *obj)
911 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0);
912 return elm_widget_scale_get(obj);
916 elm_object_text_part_set(Evas_Object *obj, const char *part, const char *label)
918 EINA_SAFETY_ON_NULL_RETURN(obj);
919 elm_widget_text_part_set(obj, part, label);
923 elm_object_text_part_get(const Evas_Object *obj, const char *part)
925 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
926 return elm_widget_text_part_get(obj, part);
930 elm_object_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content)
932 EINA_SAFETY_ON_NULL_RETURN(obj);
933 elm_widget_content_part_set(obj, part, content);
937 elm_object_content_part_get(const Evas_Object *obj, const char *part)
939 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
940 return elm_widget_content_part_get(obj, part);
944 elm_object_content_part_unset(Evas_Object *obj, const char *part)
946 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
947 return elm_widget_content_part_unset(obj, part);
953 return _elm_config->scale;
957 elm_scale_set(double scale)
959 if (_elm_config->scale == scale) return;
960 _elm_config->scale = scale;
965 elm_scale_all_set(double scale)
967 elm_scale_set(scale);
968 _elm_config_all_update();
972 elm_password_show_last_get(void)
974 return _elm_config->password_show_last;
978 elm_password_show_last_set(Eina_Bool password_show_last)
980 if (_elm_config->password_show_last == password_show_last) return;
981 _elm_config->password_show_last = password_show_last;
982 edje_password_show_last_set(_elm_config->password_show_last);
986 elm_password_show_last_timeout_get(void)
988 return _elm_config->password_show_last_timeout;
992 elm_password_show_last_timeout_set(double password_show_last_timeout)
994 if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
995 _elm_config->password_show_last_timeout = password_show_last_timeout;
996 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1000 elm_object_style_set(Evas_Object *obj,
1003 EINA_SAFETY_ON_NULL_RETURN(obj);
1004 elm_widget_style_set(obj, style);
1008 elm_object_style_get(const Evas_Object *obj)
1010 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1011 return elm_widget_style_get(obj);
1015 elm_object_disabled_set(Evas_Object *obj,
1018 EINA_SAFETY_ON_NULL_RETURN(obj);
1019 elm_widget_disabled_set(obj, disabled);
1023 elm_object_disabled_get(const Evas_Object *obj)
1025 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1026 return elm_widget_disabled_get(obj);
1030 elm_config_save(void)
1032 return _elm_config_save();
1036 elm_config_reload(void)
1038 _elm_config_reload();
1042 elm_profile_current_get(void)
1044 return _elm_config_current_profile_get();
1048 elm_profile_dir_get(const char *profile,
1051 return _elm_config_profile_dir_get(profile, is_user);
1055 elm_profile_dir_free(const char *p_dir)
1057 free((void *)p_dir);
1061 elm_profile_list_get(void)
1063 return _elm_config_profiles_list();
1067 elm_profile_list_free(Eina_List *l)
1071 EINA_LIST_FREE(l, dir)
1072 eina_stringshare_del(dir);
1076 elm_profile_set(const char *profile)
1078 EINA_SAFETY_ON_NULL_RETURN(profile);
1079 _elm_config_profile_set(profile);
1083 elm_profile_all_set(const char *profile)
1085 _elm_config_profile_set(profile);
1086 _elm_config_all_update();
1090 elm_engine_current_get(void)
1092 return _elm_config->engine;
1096 elm_engine_set(const char *engine)
1098 EINA_SAFETY_ON_NULL_RETURN(engine);
1100 _elm_config_engine_set(engine);
1103 EAPI const Eina_List *
1104 elm_text_classes_list_get(void)
1106 return _elm_config_text_classes_get();
1110 elm_text_classes_list_free(const Eina_List *list)
1112 _elm_config_text_classes_free((Eina_List *)list);
1115 EAPI const Eina_List *
1116 elm_font_overlay_list_get(void)
1118 return _elm_config_font_overlays_list();
1122 elm_font_overlay_set(const char *text_class,
1124 Evas_Font_Size size)
1126 _elm_config_font_overlay_set(text_class, font, size);
1130 elm_font_overlay_unset(const char *text_class)
1132 _elm_config_font_overlay_remove(text_class);
1136 elm_font_overlay_apply(void)
1138 _elm_config_font_overlay_apply();
1142 elm_font_overlay_all_apply(void)
1144 elm_font_overlay_apply();
1145 _elm_config_all_update();
1148 EAPI Elm_Font_Properties *
1149 elm_font_properties_get(const char *font)
1151 EINA_SAFETY_ON_NULL_RETURN_VAL(font, NULL);
1152 return _elm_font_properties_get(NULL, font);
1156 elm_font_properties_free(Elm_Font_Properties *efp)
1160 EINA_SAFETY_ON_NULL_RETURN(efp);
1161 EINA_LIST_FREE(efp->styles, str)
1162 if (str) eina_stringshare_del(str);
1163 if (efp->name) eina_stringshare_del(efp->name);
1168 elm_font_fontconfig_name_get(const char *name,
1173 EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
1174 if (!style || style[0] == 0) return eina_stringshare_add(name);
1175 snprintf(buf, 256, "%s" ELM_FONT_TOKEN_STYLE "%s", name, style);
1176 return eina_stringshare_add(buf);
1180 elm_font_fontconfig_name_free(const char *name)
1182 eina_stringshare_del(name);
1186 elm_font_available_hash_add(Eina_List *list)
1188 Eina_Hash *font_hash;
1194 /* populate with default font families */
1195 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Regular");
1196 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Bold");
1197 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Oblique");
1198 font_hash = _elm_font_available_hash_add(font_hash,
1199 "Sans:style=Bold Oblique");
1201 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Regular");
1202 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Bold");
1203 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Oblique");
1204 font_hash = _elm_font_available_hash_add(font_hash,
1205 "Serif:style=Bold Oblique");
1207 font_hash = _elm_font_available_hash_add(font_hash,
1208 "Monospace:style=Regular");
1209 font_hash = _elm_font_available_hash_add(font_hash,
1210 "Monospace:style=Bold");
1211 font_hash = _elm_font_available_hash_add(font_hash,
1212 "Monospace:style=Oblique");
1213 font_hash = _elm_font_available_hash_add(font_hash,
1214 "Monospace:style=Bold Oblique");
1216 EINA_LIST_FOREACH(list, l, key)
1217 font_hash = _elm_font_available_hash_add(font_hash, key);
1223 elm_font_available_hash_del(Eina_Hash *hash)
1225 _elm_font_available_hash_del(hash);
1229 elm_finger_size_get(void)
1231 return _elm_config->finger_size;
1235 elm_finger_size_set(Evas_Coord size)
1237 if (_elm_config->finger_size == size) return;
1238 _elm_config->finger_size = size;
1243 elm_finger_size_all_set(Evas_Coord size)
1245 elm_finger_size_set(size);
1246 _elm_config_all_update();
1250 elm_coords_finger_size_adjust(int times_w,
1255 if ((w) && (*w < (_elm_config->finger_size * times_w)))
1256 *w = _elm_config->finger_size * times_w;
1257 if ((h) && (*h < (_elm_config->finger_size * times_h)))
1258 *h = _elm_config->finger_size * times_h;
1267 edje_file_cache_flush();
1268 edje_collection_cache_flush();
1270 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1272 Evas *e = evas_object_evas_get(obj);
1273 evas_image_cache_flush(e);
1274 evas_font_cache_flush(e);
1275 evas_render_dump(e);
1280 elm_cache_flush_interval_get(void)
1282 return _elm_config->cache_flush_poll_interval;
1286 elm_cache_flush_interval_set(int size)
1288 if (_elm_config->cache_flush_poll_interval == size) return;
1289 _elm_config->cache_flush_poll_interval = size;
1295 elm_cache_flush_interval_all_set(int size)
1297 elm_cache_flush_interval_set(size);
1298 _elm_config_all_update();
1302 elm_cache_flush_enabled_get(void)
1304 return _elm_config->cache_flush_enable;
1308 elm_cache_flush_enabled_set(Eina_Bool enabled)
1310 enabled = !!enabled;
1311 if (_elm_config->cache_flush_enable == enabled) return;
1312 _elm_config->cache_flush_enable = enabled;
1318 elm_cache_flush_enabled_all_set(Eina_Bool enabled)
1320 elm_cache_flush_enabled_set(enabled);
1321 _elm_config_all_update();
1325 elm_font_cache_get(void)
1327 return _elm_config->font_cache;
1331 elm_font_cache_set(int size)
1333 if (_elm_config->font_cache == size) return;
1334 _elm_config->font_cache = size;
1340 elm_font_cache_all_set(int size)
1342 elm_font_cache_set(size);
1343 _elm_config_all_update();
1347 elm_image_cache_get(void)
1349 return _elm_config->image_cache;
1353 elm_image_cache_set(int size)
1355 if (_elm_config->image_cache == size) return;
1356 _elm_config->image_cache = size;
1362 elm_image_cache_all_set(int size)
1364 elm_image_cache_set(size);
1365 _elm_config_all_update();
1369 elm_edje_file_cache_get(void)
1371 return _elm_config->edje_cache;
1375 elm_edje_file_cache_set(int size)
1377 if (_elm_config->edje_cache == size) return;
1378 _elm_config->edje_cache = size;
1384 elm_edje_file_cache_all_set(int size)
1386 elm_edje_file_cache_set(size);
1387 _elm_config_all_update();
1391 elm_edje_collection_cache_get(void)
1393 return _elm_config->edje_collection_cache;
1397 elm_edje_collection_cache_set(int size)
1399 if (_elm_config->edje_collection_cache == size) return;
1400 _elm_config->edje_collection_cache = size;
1406 elm_edje_collection_cache_all_set(int size)
1408 elm_edje_collection_cache_set(size);
1409 _elm_config_all_update();
1413 elm_object_focus_get(const Evas_Object *obj)
1415 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1416 return elm_widget_focus_get(obj);
1420 elm_object_focus_set(Evas_Object *obj,
1423 EINA_SAFETY_ON_NULL_RETURN(obj);
1426 if (elm_widget_focus_get(obj)) return;
1427 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1431 if (!elm_widget_can_focus_get(obj)) return;
1432 elm_widget_focused_object_clear(obj);
1437 elm_object_focus(Evas_Object *obj)
1439 EINA_SAFETY_ON_NULL_RETURN(obj);
1440 elm_object_focus_set(obj, EINA_TRUE);
1444 elm_object_unfocus(Evas_Object *obj)
1446 EINA_SAFETY_ON_NULL_RETURN(obj);
1447 elm_object_focus_set(obj, EINA_FALSE);
1451 elm_object_focus_allow_set(Evas_Object *obj,
1454 EINA_SAFETY_ON_NULL_RETURN(obj);
1455 elm_widget_can_focus_set(obj, enable);
1459 elm_object_focus_allow_get(const Evas_Object *obj)
1461 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1462 return (elm_widget_can_focus_get(obj)) || (elm_widget_child_can_focus_get(obj));
1466 elm_object_focus_custom_chain_set(Evas_Object *obj,
1469 EINA_SAFETY_ON_NULL_RETURN(obj);
1470 elm_widget_focus_custom_chain_set(obj, objs);
1474 elm_object_focus_custom_chain_unset(Evas_Object *obj)
1476 EINA_SAFETY_ON_NULL_RETURN(obj);
1477 elm_widget_focus_custom_chain_unset(obj);
1480 EAPI const Eina_List *
1481 elm_object_focus_custom_chain_get(const Evas_Object *obj)
1483 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1484 return elm_widget_focus_custom_chain_get(obj);
1488 elm_object_focus_custom_chain_append(Evas_Object *obj,
1490 Evas_Object *relative_child)
1492 EINA_SAFETY_ON_NULL_RETURN(obj);
1493 EINA_SAFETY_ON_NULL_RETURN(child);
1494 elm_widget_focus_custom_chain_append(obj, child, relative_child);
1498 elm_object_focus_custom_chain_prepend(Evas_Object *obj,
1500 Evas_Object *relative_child)
1502 EINA_SAFETY_ON_NULL_RETURN(obj);
1503 EINA_SAFETY_ON_NULL_RETURN(child);
1504 elm_widget_focus_custom_chain_prepend(obj, child, relative_child);
1508 elm_object_focus_cycle(Evas_Object *obj,
1509 Elm_Focus_Direction dir)
1511 EINA_SAFETY_ON_NULL_RETURN(obj);
1512 elm_widget_focus_cycle(obj, dir);
1516 elm_object_focus_direction_go(Evas_Object *obj,
1520 EINA_SAFETY_ON_NULL_RETURN(obj);
1521 elm_widget_focus_direction_go(obj, x, y);
1525 elm_object_tree_unfocusable_set(Evas_Object *obj,
1526 Eina_Bool tree_unfocusable)
1528 EINA_SAFETY_ON_NULL_RETURN(obj);
1529 elm_widget_tree_unfocusable_set(obj, tree_unfocusable);
1533 elm_object_tree_unfocusable_get(const Evas_Object *obj)
1535 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1536 return elm_widget_tree_unfocusable_get(obj);
1540 elm_focus_highlight_enabled_get(void)
1542 return _elm_config->focus_highlight_enable;
1546 elm_focus_highlight_enabled_set(Eina_Bool enable)
1548 _elm_config->focus_highlight_enable = !!enable;
1552 elm_focus_highlight_animate_get(void)
1554 return _elm_config->focus_highlight_animate;
1558 elm_focus_highlight_animate_set(Eina_Bool animate)
1560 _elm_config->focus_highlight_animate = !!animate;
1564 elm_scroll_bounce_enabled_get(void)
1566 return _elm_config->thumbscroll_bounce_enable;
1570 elm_scroll_bounce_enabled_set(Eina_Bool enabled)
1572 _elm_config->thumbscroll_bounce_enable = enabled;
1576 elm_scroll_bounce_enabled_all_set(Eina_Bool enabled)
1578 elm_scroll_bounce_enabled_set(enabled);
1579 _elm_config_all_update();
1583 elm_scroll_bounce_friction_get(void)
1585 return _elm_config->thumbscroll_bounce_friction;
1589 elm_scroll_bounce_friction_set(double friction)
1591 _elm_config->thumbscroll_bounce_friction = friction;
1595 elm_scroll_bounce_friction_all_set(double friction)
1597 elm_scroll_bounce_friction_set(friction);
1598 _elm_config_all_update();
1602 elm_scroll_page_scroll_friction_get(void)
1604 return _elm_config->page_scroll_friction;
1608 elm_scroll_page_scroll_friction_set(double friction)
1610 _elm_config->page_scroll_friction = friction;
1614 elm_scroll_page_scroll_friction_all_set(double friction)
1616 elm_scroll_page_scroll_friction_set(friction);
1617 _elm_config_all_update();
1621 elm_scroll_bring_in_scroll_friction_get(void)
1623 return _elm_config->bring_in_scroll_friction;
1627 elm_scroll_bring_in_scroll_friction_set(double friction)
1629 _elm_config->bring_in_scroll_friction = friction;
1633 elm_scroll_bring_in_scroll_friction_all_set(double friction)
1635 elm_scroll_bring_in_scroll_friction_set(friction);
1636 _elm_config_all_update();
1640 elm_scroll_zoom_friction_get(void)
1642 return _elm_config->zoom_friction;
1646 elm_scroll_zoom_friction_set(double friction)
1648 _elm_config->zoom_friction = friction;
1652 elm_scroll_zoom_friction_all_set(double friction)
1654 elm_scroll_zoom_friction_set(friction);
1655 _elm_config_all_update();
1659 elm_scroll_thumbscroll_enabled_get(void)
1661 return _elm_config->thumbscroll_enable;
1665 elm_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
1667 _elm_config->thumbscroll_enable = enabled;
1671 elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled)
1673 elm_scroll_thumbscroll_enabled_set(enabled);
1674 _elm_config_all_update();
1678 elm_scroll_thumbscroll_threshold_get(void)
1680 return _elm_config->thumbscroll_threshold;
1684 elm_scroll_thumbscroll_threshold_set(unsigned int threshold)
1686 _elm_config->thumbscroll_threshold = threshold;
1690 elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold)
1692 elm_scroll_thumbscroll_threshold_set(threshold);
1693 _elm_config_all_update();
1697 elm_scroll_thumbscroll_momentum_threshold_get(void)
1699 return _elm_config->thumbscroll_momentum_threshold;
1703 elm_scroll_thumbscroll_momentum_threshold_set(double threshold)
1705 _elm_config->thumbscroll_momentum_threshold = threshold;
1709 elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold)
1711 elm_scroll_thumbscroll_momentum_threshold_set(threshold);
1712 _elm_config_all_update();
1716 elm_scroll_thumbscroll_friction_get(void)
1718 return _elm_config->thumbscroll_friction;
1722 elm_scroll_thumbscroll_friction_set(double friction)
1724 _elm_config->thumbscroll_friction = friction;
1728 elm_scroll_thumbscroll_friction_all_set(double friction)
1730 elm_scroll_thumbscroll_friction_set(friction);
1731 _elm_config_all_update();
1735 elm_scroll_thumbscroll_border_friction_get(void)
1737 return _elm_config->thumbscroll_border_friction;
1741 elm_scroll_thumbscroll_border_friction_set(double friction)
1743 if (friction < 0.0) friction = 0.0;
1744 if (friction > 1.0) friction = 1.0;
1745 _elm_config->thumbscroll_friction = friction;
1749 elm_scroll_thumbscroll_border_friction_all_set(double friction)
1751 elm_scroll_thumbscroll_border_friction_set(friction);
1752 _elm_config_all_update();
1756 elm_scroll_thumbscroll_sensitivity_friction_get(void)
1758 return _elm_config->thumbscroll_sensitivity_friction;
1762 elm_scroll_thumbscroll_sensitivity_friction_set(double friction)
1764 if (friction < 0.1) friction = 0.1;
1765 if (friction > 1.0) friction = 1.0;
1766 _elm_config->thumbscroll_friction = friction;
1770 elm_scroll_thumbscroll_sensitivity_friction_all_set(double friction)
1772 elm_scroll_thumbscroll_sensitivity_friction_set(friction);
1773 _elm_config_all_update();
1777 elm_object_scroll_hold_push(Evas_Object *obj)
1779 EINA_SAFETY_ON_NULL_RETURN(obj);
1780 elm_widget_scroll_hold_push(obj);
1784 elm_object_scroll_hold_pop(Evas_Object *obj)
1786 EINA_SAFETY_ON_NULL_RETURN(obj);
1787 elm_widget_scroll_hold_pop(obj);
1791 elm_object_scroll_freeze_push(Evas_Object *obj)
1793 EINA_SAFETY_ON_NULL_RETURN(obj);
1794 elm_widget_scroll_freeze_push(obj);
1798 elm_object_scroll_lock_x_set(Evas_Object *obj,
1801 EINA_SAFETY_ON_NULL_RETURN(obj);
1802 elm_widget_drag_lock_x_set(obj, lock);
1806 elm_object_scroll_lock_y_set(Evas_Object *obj,
1809 EINA_SAFETY_ON_NULL_RETURN(obj);
1810 elm_widget_drag_lock_y_set(obj, lock);
1814 elm_object_scroll_lock_x_get(const Evas_Object *obj)
1816 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1817 return elm_widget_drag_lock_x_get(obj);
1821 elm_object_scroll_lock_y_get(const Evas_Object *obj)
1823 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1824 return elm_widget_drag_lock_y_get(obj);
1828 elm_object_scroll_freeze_pop(Evas_Object *obj)
1830 EINA_SAFETY_ON_NULL_RETURN(obj);
1831 elm_widget_scroll_freeze_pop(obj);
1835 elm_object_widget_check(const Evas_Object *obj)
1837 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1838 return elm_widget_is(obj);
1842 elm_object_parent_widget_get(const Evas_Object *obj)
1844 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1845 return elm_widget_parent_widget_get(obj);
1849 elm_object_top_widget_get(const Evas_Object *obj)
1851 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1852 return elm_widget_top_get(obj);
1856 elm_object_widget_type_get(const Evas_Object *obj)
1858 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1859 return elm_widget_type_get(obj);
1863 elm_object_signal_emit(Evas_Object *obj,
1864 const char *emission,
1867 EINA_SAFETY_ON_NULL_RETURN(obj);
1868 elm_widget_signal_emit(obj, emission, source);
1872 elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
1874 EINA_SAFETY_ON_NULL_RETURN(obj);
1875 EINA_SAFETY_ON_NULL_RETURN(func);
1876 elm_widget_signal_callback_add(obj, emission, source, func, data);
1880 elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func)
1882 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1883 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
1884 return elm_widget_signal_callback_del(obj, emission, source, func);
1888 elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data)
1890 EINA_SAFETY_ON_NULL_RETURN(obj);
1891 EINA_SAFETY_ON_NULL_RETURN(func);
1892 elm_widget_event_callback_add(obj, func, data);
1896 elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data)
1898 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1899 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
1900 return elm_widget_event_callback_del(obj, func, data);
1904 elm_object_tree_dump(const Evas_Object *top)
1907 elm_widget_tree_dump(top);
1915 elm_object_tree_dot_dump(const Evas_Object *top,
1919 FILE *f = fopen(file, "wb");
1920 elm_widget_tree_dot_dump(top, f);
1930 elm_longpress_timeout_set(double longpress_timeout)
1932 _elm_config->longpress_timeout = longpress_timeout;
1936 elm_longpress_timeout_get(void)
1938 return _elm_config->longpress_timeout;
1942 elm_object_item_object_get(const Elm_Object_Item *it)
1944 return ((Elm_Widget_Item *) it)->widget;
1948 elm_object_item_content_part_set(Elm_Object_Item *it,
1950 Evas_Object *content)
1952 _elm_widget_item_content_part_set((Elm_Widget_Item *) it, part, content);
1956 elm_object_item_content_part_get(const Elm_Object_Item *it,
1959 return _elm_widget_item_content_part_get((Elm_Widget_Item *) it, part);
1963 elm_object_item_content_part_unset(Elm_Object_Item *it, const char *part)
1965 return _elm_widget_item_content_part_unset((Elm_Widget_Item *) it, part);
1969 elm_object_item_text_part_set(Elm_Object_Item *it,
1973 _elm_widget_item_text_part_set((Elm_Widget_Item *) it, part, label);
1977 elm_object_item_text_part_get(const Elm_Object_Item *it, const char *part)
1979 return _elm_widget_item_text_part_get((Elm_Widget_Item *) it, part);
1983 elm_object_access_info_set(Evas_Object *obj, const char *txt)
1985 elm_widget_access_info_set(obj, txt);
1989 elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt)
1991 _elm_widget_item_access_info_set((Elm_Widget_Item *) it, txt);
1995 elm_object_item_data_get(const Elm_Object_Item *it)
1997 return elm_widget_item_data_get(it);
2001 elm_object_item_data_set(Elm_Object_Item *it, void *data)
2003 elm_widget_item_data_set(it, data);
2007 elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source)
2009 _elm_widget_item_signal_emit((Elm_Widget_Item *) it, emission, source);