2 # include "elementary_config.h"
5 #include <dlfcn.h> /* dlopen,dlclose,etc */
7 #ifdef HAVE_CRT_EXTERNS_H
8 # include <crt_externs.h>
15 #include <Elementary.h>
18 #define SEMI_BROKEN_QUICKLAUNCH 1
20 static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
21 EAPI Elm_Version *elm_version = &_version;
26 * This group includes functions of elm_main.c
31 _elm_dangerous_call_check(const char *call)
36 snprintf(buf, sizeof(buf), "%i.%i.%i.%i", VMAJ, VMIN, VMIC, VREV);
37 eval = getenv("ELM_NO_FINGER_WAGGLING");
38 if ((eval) && (!strcmp(eval, buf)))
40 printf("ELEMENTARY FINGER WAGGLE!!!!!!!!!!\n"
43 "PLEASE see the API documentation for this function. This call\n"
44 "should almost never be used. Only in very special cases.\n"
46 "To remove this warning please set the environment variable:\n"
47 " ELM_NO_FINGER_WAGGLING\n"
48 "To the value of the Elementary version + revision number. e.g.:\n"
57 * @defgroup Start Getting Started
60 * To write an Elementary app, you can get started with the following:
63 * #include <Elementary.h>
64 * #ifndef ELM_LIB_QUICKLAUNCH
66 * elm_main(int argc, char **argv)
68 * // create window(s) here and do any application init
69 * elm_run(); // run main loop
70 * elm_shutdown(); // after mainloop finishes running, shutdown
71 * return 0; // exit 0 for exit code
77 * To take full advantage of the quicklaunch architecture for launching
78 * processes as quickly as possible (saving time at startup time like
79 * connecting to X11, loading and linking shared libraries) you may want to
80 * use the following configure.in/configure.ac and Makefile.am and autogen.sh
81 * script to generate your files. It is assumed your application uses the
82 * main.c file for its code.
84 * configure.in/configure.ac:
87 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
89 AC_CONFIG_SRCDIR(configure.in)
91 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
92 AM_CONFIG_HEADER(config.h)
102 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
103 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
106 PKG_CHECK_MODULES([ELEMENTARY], elementary)
114 AUTOMAKE_OPTIONS = 1.4 foreign
115 MAINTAINERCLEANFILES = Makefile.in
117 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
120 myapp_LTLIBRARIES = myapp.la
124 myapp_la_SOURCES = main.c
125 myapp_la_LIBADD = @ELEMENTARY_LIBS@
127 myapp_la_LDFLAGS = -module -avoid-version -no-undefined
129 myapp_SOURCES = main.c
130 myapp_LDADD = @ELEMENTARY_LIBS@
131 myapp_CFLAGS = -DELM_LIB_QUICKLAUNCH=1
138 rm -rf autom4te.cache
139 rm -f aclocal.m4 ltmain.sh
144 echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
145 echo "Running autoheader..." ; autoheader || exit 1
146 echo "Running autoconf..." ; autoconf || exit 1
147 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
148 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
150 if [ -z "$NOCONFIGURE" ]; then
155 * To gnerate all the things needed to bootstrap just run:
161 * This will generate Makefile.in's, the confgure script and everything else.
162 * After this it works like all normal autotools projects:
169 * Note sudo was assumed to get root permissions, as this would install in
170 * /usr/local which is system-owned. Use any way you like to gain root, or
171 * specify a different prefix with configure:
174 ./confiugre --prefix=$HOME/mysoftware
177 * Also remember that autotools buys you some useful commands like:
182 * This uninstalls the software after it was installed with "make install".
183 * It is very useful to clear up what you built if you wish to clean the
190 * This firstly checks if your build tree is "clean" and ready for
191 * distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is
192 * ready to upload and distribute to the world, that contains the generated
193 * Makefile.in's and configure script. The users do not need to run
194 * autogen.sh - just configure and on. They don't need autotools installed.
195 * This tarball also builds cleanly, has all the sources it needs to build
196 * included (that is sources for your application, not libraries it depends
197 * on like Elementary). It builds cleanly in a buildroot and does not
198 * contain any files that are temporarily generated like binaries and other
199 * build-generated files, so the tarball is clean, and no need to worry
200 * about cleaning up your tree before packaging.
206 * This cleans up all build files (binaries, objects etc.) from the tree.
212 * This cleans out all files from the build and from configure's output too.
215 make maintainer-clean
218 * This deletes all the files autogen.sh will produce so the tree is clean
219 * to be put into a revision-control system (like CVS, SVN or GIT for example).
221 * The above will build a library - libmyapp.so and install in the target
222 * library directory (default is /usr/local/lib). You will also get a
223 * myapp.a and myapp.la - these are useless and can be deleted. Libtool likes
224 * to generate these all the time. You will also get a binary in the target
225 * binary directory (default is /usr/local/bin). This is a "debug binary".
226 * This will run and dlopen() the myapp.so and then jump to it's elm_main
227 * function. This allows for easy debugging with GDB and Valgrind. When you
228 * are ready to go to production do the following:
230 * 1. delete the myapp binary. i.e. rm /usr/local/bin/myapp
232 * 2. symlink the myapp binary to elementary_run (supplied by elementary).
233 * i.e. ln -s elmentary_run /usr/local/bin/myapp
235 * 3. run elementary_quicklaunch as part of your graphical login session and
238 * This will man elementary_quicklaunch does pre-initialization before the
239 * application needs to be run, saving the effort at the time the application
240 * is needed, thus speeding up the time it takes to appear.
242 * If you don't want to use the quicklaunch infrastructure (which is
243 * optional), you can execute the old fashioned way by just running the
244 * myapp binary loader than will load the myapp.so for you, or you can
245 * remove the split-file binary and put it into one binary as things always
246 * have been with the following configure.in/configure.ac and Makfile.am
249 * configure.in/configure.ac:
252 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
254 AC_CONFIG_SRCDIR(configure.in)
256 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
257 AM_CONFIG_HEADER(config.h)
266 PKG_CHECK_MODULES([ELEMENTARY], elementary)
274 AUTOMAKE_OPTIONS = 1.4 foreign
275 MAINTAINERCLEANFILES = Makefile.in
277 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
281 myapp_SOURCES = main.c
282 myapp_LDADD = @ELEMENTARY_LIBS@
286 * Notice that they are the same as before, just with libtool and library
287 * building sections removed. Both ways work for building elementary
288 * applications. It is up to you to decide what is best for you. If you just
289 * follow the template above, you can do it both ways and can decide at build
290 * time. The more advanced of you may suggest making it a configure option.
291 * That is perfectly valid, but has been left out here for simplicity, as our
292 * aim to have an Elementary (and EFL) tutorial, not an autoconf & automake
297 static Eina_Bool _elm_signal_exit(void *data,
301 static Eina_Prefix *pfx = NULL;
302 char *_elm_appname = NULL;
303 const char *_elm_data_dir = NULL;
304 const char *_elm_lib_dir = NULL;
305 int _elm_log_dom = -1;
307 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
309 static int _elm_init_count = 0;
310 static int _elm_sub_init_count = 0;
311 static int _elm_ql_init_count = 0;
312 static int _elm_policies[ELM_POLICY_LAST];
313 static Ecore_Event_Handler *_elm_exit_handler = NULL;
314 static Eina_Bool quicklaunch_on = 0;
317 _elm_signal_exit(void *data __UNUSED__,
318 int ev_type __UNUSED__,
322 return ECORE_CALLBACK_PASS_ON;
328 edje_scale_set(_elm_config->scale);
329 _elm_win_rescale(NULL, EINA_FALSE);
332 static void *app_mainfunc = NULL;
333 static const char *app_domain = NULL;
334 static const char *app_checkfile = NULL;
336 static const char *app_compile_bin_dir = NULL;
337 static const char *app_compile_lib_dir = NULL;
338 static const char *app_compile_data_dir = NULL;
339 static const char *app_compile_locale_dir = NULL;
340 static const char *app_prefix_dir = NULL;
341 static const char *app_bin_dir = NULL;
342 static const char *app_lib_dir = NULL;
343 static const char *app_data_dir = NULL;
344 static const char *app_locale_dir = NULL;
346 static Eina_Prefix *app_pfx = NULL;
353 const char *dirs[4] = { NULL, NULL, NULL, NULL };
354 char *caps = NULL, *p1, *p2;
357 if (!app_domain) return;
359 ecore_app_args_get(&argc, &argv);
360 if (argc < 1) return;
362 dirs[0] = app_compile_bin_dir;
363 dirs[1] = app_compile_lib_dir;
364 dirs[2] = app_compile_data_dir;
365 dirs[3] = app_compile_locale_dir;
367 if (!dirs[1]) dirs[1] = dirs[0];
368 if (!dirs[0]) dirs[0] = dirs[1];
369 if (!dirs[3]) dirs[3] = dirs[2];
370 if (!dirs[2]) dirs[2] = dirs[3];
374 caps = alloca(strlen(app_domain) + 1);
375 for (p1 = (char *)app_domain, p2 = caps; *p1; p1++, p2++)
379 app_pfx = eina_prefix_new(argv[0], app_mainfunc, caps, app_domain,
380 app_checkfile, dirs[0], dirs[1], dirs[2], dirs[3]);
384 _prefix_shutdown(void)
386 if (app_pfx) eina_prefix_free(app_pfx);
387 if (app_domain) eina_stringshare_del(app_domain);
388 if (app_checkfile) eina_stringshare_del(app_checkfile);
389 if (app_compile_bin_dir) eina_stringshare_del(app_compile_bin_dir);
390 if (app_compile_lib_dir) eina_stringshare_del(app_compile_lib_dir);
391 if (app_compile_data_dir) eina_stringshare_del(app_compile_data_dir);
392 if (app_compile_locale_dir) eina_stringshare_del(app_compile_locale_dir);
393 if (app_prefix_dir) eina_stringshare_del(app_prefix_dir);
394 if (app_bin_dir) eina_stringshare_del(app_bin_dir);
395 if (app_lib_dir) eina_stringshare_del(app_lib_dir);
396 if (app_data_dir) eina_stringshare_del(app_data_dir);
397 if (app_locale_dir) eina_stringshare_del(app_locale_dir);
400 app_checkfile = NULL;
401 app_compile_bin_dir = NULL;
402 app_compile_lib_dir = NULL;
403 app_compile_data_dir = NULL;
404 app_compile_locale_dir = NULL;
405 app_prefix_dir = NULL;
409 app_locale_dir = NULL;
418 if (_elm_init_count > 1) return _elm_init_count;
419 elm_quicklaunch_init(argc, argv);
420 elm_quicklaunch_sub_init(argc, argv);
422 return _elm_init_count;
429 if (_elm_init_count > 0) return _elm_init_count;
431 while (_elm_win_deferred_free) ecore_main_loop_iterate();
433 // _prefix_shutdown();
434 elm_quicklaunch_sub_shutdown();
435 elm_quicklaunch_shutdown();
436 return _elm_init_count;
440 elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile)
442 app_mainfunc = mainfunc;
443 eina_stringshare_replace(&app_domain, dom);
444 eina_stringshare_replace(&app_checkfile, checkfile);
448 elm_app_compile_bin_dir_set(const char *dir)
450 eina_stringshare_replace(&app_compile_bin_dir, dir);
454 elm_app_compile_lib_dir_set(const char *dir)
456 eina_stringshare_replace(&app_compile_lib_dir, dir);
460 elm_app_compile_data_dir_set(const char *dir)
462 eina_stringshare_replace(&app_compile_data_dir, dir);
466 elm_app_compile_locale_set(const char *dir)
468 eina_stringshare_replace(&app_compile_locale_dir, dir);
472 elm_app_prefix_dir_get(void)
474 if (app_prefix_dir) return app_prefix_dir;
476 if (!app_pfx) return "";
477 app_prefix_dir = eina_prefix_get(app_pfx);
478 return app_prefix_dir;
482 elm_app_bin_dir_get(void)
484 if (app_bin_dir) return app_bin_dir;
486 if (!app_pfx) return "";
487 app_bin_dir = eina_prefix_bin_get(app_pfx);
492 elm_app_lib_dir_get(void)
494 if (app_lib_dir) return app_lib_dir;
496 if (!app_pfx) return "";
497 app_lib_dir = eina_prefix_lib_get(app_pfx);
502 elm_app_data_dir_get(void)
504 if (app_data_dir) return app_data_dir;
506 if (!app_pfx) return "";
507 app_data_dir = eina_prefix_data_get(app_pfx);
512 elm_app_locale_dir_get(void)
514 if (app_locale_dir) return app_locale_dir;
516 if (!app_pfx) return "";
517 app_locale_dir = eina_prefix_locale_get(app_pfx);
518 return app_locale_dir;
522 static int _elm_need_e_dbus = 0;
525 elm_need_e_dbus(void)
528 if (_elm_need_e_dbus++) return EINA_TRUE;
537 _elm_unneed_e_dbus(void)
540 if (--_elm_need_e_dbus) return;
542 _elm_need_e_dbus = 0;
548 static int _elm_need_efreet = 0;
551 elm_need_efreet(void)
554 if (_elm_need_efreet++) return EINA_TRUE;
562 list = efreet_icon_extra_list_get();
565 e_user_dir_concat_static(buf, "icons");
566 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
567 e_prefix_data_concat_static(buf, "data/icons");
568 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
579 _elm_unneed_efreet(void)
582 if (--_elm_need_efreet) return;
584 _elm_need_efreet = 0;
585 efreet_trash_shutdown();
586 efreet_mime_shutdown();
592 elm_quicklaunch_mode_set(Eina_Bool ql_on)
594 quicklaunch_on = ql_on;
598 elm_quicklaunch_mode_get(void)
600 return quicklaunch_on;
604 elm_quicklaunch_init(int argc,
607 _elm_ql_init_count++;
608 if (_elm_ql_init_count > 1) return _elm_ql_init_count;
610 _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
613 EINA_LOG_ERR("could not register elementary log domain.");
614 _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
620 #ifdef HAVE_ELEMENTARY_EMAP
623 ecore_app_args_set(argc, (const char **)argv);
625 memset(_elm_policies, 0, sizeof(_elm_policies));
626 if (!ELM_EVENT_POLICY_CHANGED)
627 ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
631 _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
633 if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
635 pfx = eina_prefix_new(NULL, elm_quicklaunch_init,
636 "ELM", "elementary", "config/profile.cfg",
637 PACKAGE_LIB_DIR, /* don't have a bin dir currently */
643 _elm_data_dir = eina_stringshare_add(eina_prefix_data_get(pfx));
644 _elm_lib_dir = eina_stringshare_add(eina_prefix_lib_get(pfx));
646 if (!_elm_data_dir) _elm_data_dir = eina_stringshare_add("/");
647 if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/");
650 return _elm_ql_init_count;
654 elm_quicklaunch_sub_init(int argc,
657 _elm_sub_init_count++;
658 if (_elm_sub_init_count > 1) return _elm_sub_init_count;
661 #ifdef SEMI_BROKEN_QUICKLAUNCH
662 return _elm_sub_init_count;
667 ecore_app_args_set(argc, (const char **)argv);
671 _elm_config_sub_init();
672 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
673 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
674 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
675 ENGINE_COMPARE(ELM_XRENDER_X11) ||
676 ENGINE_COMPARE(ELM_OPENGL_X11))
677 #undef ENGINE_COMPARE
679 #ifdef HAVE_ELEMENTARY_X
683 ecore_evas_init(); // FIXME: check errors
686 return _elm_sub_init_count;
690 elm_quicklaunch_sub_shutdown(void)
692 _elm_sub_init_count--;
693 if (_elm_sub_init_count > 0) return _elm_sub_init_count;
696 #ifdef SEMI_BROKEN_QUICKLAUNCH
697 return _elm_sub_init_count;
703 _elm_module_shutdown();
704 ecore_imf_shutdown();
705 ecore_evas_shutdown();
706 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
707 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
708 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
709 ENGINE_COMPARE(ELM_XRENDER_X11) ||
710 ENGINE_COMPARE(ELM_OPENGL_X11))
711 #undef ENGINE_COMPARE
713 #ifdef HAVE_ELEMENTARY_X
714 ecore_x_disconnect();
717 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
718 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
719 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
720 ENGINE_COMPARE(ELM_XRENDER_X11) ||
721 ENGINE_COMPARE(ELM_OPENGL_X11) ||
722 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
723 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
724 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
725 ENGINE_COMPARE(ELM_SOFTWARE_WIN32) ||
726 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
727 #undef ENGINE_COMPARE
728 evas_cserve_disconnect();
732 return _elm_sub_init_count;
736 elm_quicklaunch_shutdown(void)
738 _elm_ql_init_count--;
739 if (_elm_ql_init_count > 0) return _elm_ql_init_count;
740 if (pfx) eina_prefix_free(pfx);
742 eina_stringshare_del(_elm_data_dir);
743 _elm_data_dir = NULL;
744 eina_stringshare_del(_elm_lib_dir);
750 _elm_config_shutdown();
752 ecore_event_handler_del(_elm_exit_handler);
753 _elm_exit_handler = NULL;
755 _elm_theme_shutdown();
756 _elm_unneed_efreet();
757 _elm_unneed_e_dbus();
758 _elm_unneed_ethumb();
759 ecore_file_shutdown();
761 #ifdef HAVE_ELEMENTARY_EMAP
768 if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
770 eina_log_domain_unregister(_elm_log_dom);
774 _elm_widget_type_clear();
777 return _elm_ql_init_count;
781 elm_quicklaunch_seed(void)
783 #ifndef SEMI_BROKEN_QUICKLAUNCH
786 Evas_Object *win, *bg, *bt;
788 win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
789 bg = elm_bg_add(win);
790 elm_win_resize_object_add(win, bg);
791 evas_object_show(bg);
792 bt = elm_button_add(win);
793 elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
794 elm_win_resize_object_add(win, bt);
795 ecore_main_loop_iterate();
796 evas_object_del(win);
797 ecore_main_loop_iterate();
798 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
799 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
800 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
801 ENGINE_COMPARE(ELM_XRENDER_X11) ||
802 ENGINE_COMPARE(ELM_OPENGL_X11))
803 #undef ENGINE_COMPARE
805 # ifdef HAVE_ELEMENTARY_X
809 ecore_main_loop_iterate();
814 static void *qr_handle = NULL;
815 static int (*qr_main)(int argc,
819 elm_quicklaunch_prepare(int argc __UNUSED__,
823 char *exe = elm_quicklaunch_exe_path_get(argv[0]);
826 ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
834 exe2 = malloc(strlen(exe) + 1 + 10);
836 p = strrchr(exe2, '/');
839 exename = alloca(strlen(p) + 1);
842 strcat(p, "../lib/");
845 if (!access(exe2, R_OK | X_OK))
853 qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
856 fprintf(stderr, "dlerr: %s\n", dlerror());
857 WRN("dlopen('%s') failed: %s", exe, dlerror());
861 INF("dlopen('%s') = %p", exe, qr_handle);
862 qr_main = dlsym(qr_handle, "elm_main");
863 INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
866 WRN("not quicklauncher capable: no elm_main in '%s'", exe);
885 extern char **environ;
890 for (i = 0, size = 0; environ[i]; i++)
891 size += strlen(environ[i]) + 1;
893 p = malloc((i + 1) * sizeof(char *));
898 for (i = 0; oldenv[i]; i++)
899 environ[i] = strdup(oldenv[i]);
906 elm_quicklaunch_fork(int argc,
909 void (postfork_func) (void *data),
919 // need to accept current environment from elementary_run
926 if (child > 0) return EINA_TRUE;
929 perror("could not fork");
934 perror("could not chdir");
935 args = alloca((argc + 1) * sizeof(char *));
936 for (i = 0; i < argc; i++) args[i] = argv[i];
938 WRN("%s not quicklaunch capable, fallback...", argv[0]);
939 execvp(argv[0], args);
940 ERR("failed to execute '%s': %s", argv[0], strerror(errno));
944 if (child > 0) return EINA_TRUE;
947 perror("could not fork");
950 if (postfork_func) postfork_func(postfork_data);
954 #ifdef SEMI_BROKEN_QUICKLAUNCH
955 ecore_app_args_set(argc, (const char **)argv);
958 _elm_config_sub_init();
959 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
960 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
961 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
962 ENGINE_COMPARE(ELM_XRENDER_X11) ||
963 ENGINE_COMPARE(ELM_OPENGL_X11))
964 #undef ENGINE_COMPARE
966 # ifdef HAVE_ELEMENTARY_X
970 ecore_evas_init(); // FIXME: check errors
978 perror("could not chdir");
979 // FIXME: this is very linux specific. it changes argv[0] of the process
980 // so ps etc. report what you'd expect. for other unixes and os's this
987 ecore_app_args_get(&real_argc, &real_argv);
988 lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
989 for (p = real_argv[0]; p < lastarg; p++) *p = 0;
990 strcpy(real_argv[0], argv[0]);
992 ecore_app_args_set(argc, (const char **)argv);
993 ret = qr_main(argc, argv);
1001 (void)postfork_func;
1002 (void)postfork_data;
1007 elm_quicklaunch_cleanup(void)
1020 elm_quicklaunch_fallback(int argc,
1024 elm_quicklaunch_init(argc, argv);
1025 elm_quicklaunch_sub_init(argc, argv);
1026 elm_quicklaunch_prepare(argc, argv);
1027 ret = qr_main(argc, argv);
1033 elm_quicklaunch_exe_path_get(const char *exe)
1035 static char *path = NULL;
1036 static Eina_List *pathlist = NULL;
1037 const char *pathitr;
1040 if (exe[0] == '/') return strdup(exe);
1041 if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
1042 if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
1047 path = getenv("PATH");
1048 buf2 = alloca(strlen(path) + 1);
1053 if ((*p == ':') || (!*p))
1058 strncpy(buf2, pp, len);
1060 pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
1072 EINA_LIST_FOREACH(pathlist, l, pathitr)
1074 snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
1075 if (!access(buf, R_OK | X_OK)) return strdup(buf);
1083 ecore_main_loop_begin();
1089 ecore_main_loop_quit();
1093 elm_policy_set(unsigned int policy,
1096 Elm_Event_Policy_Changed *ev;
1098 if (policy >= ELM_POLICY_LAST)
1101 if (value == _elm_policies[policy])
1104 /* TODO: validade policy? */
1106 ev = malloc(sizeof(*ev));
1107 ev->policy = policy;
1108 ev->new_value = value;
1109 ev->old_value = _elm_policies[policy];
1111 _elm_policies[policy] = value;
1113 ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
1119 elm_policy_get(unsigned int policy)
1121 if (policy >= ELM_POLICY_LAST)
1123 return _elm_policies[policy];
1127 * @defgroup UI-Mirroring Selective Widget mirroring
1129 * These functions allow you to set ui-mirroring on specific widgets or the
1130 * whole interface. Widgets can be in one of two modes, automatic and manual.
1131 * Automatic means they'll be changed according to the system mirroring mode
1132 * and manual means only explicit changes will matter. You are not supposed to
1133 * change mirroring state of a widget set to automatic, will mostly work, but
1134 * the behavior is not really defined.
1138 * Returns the widget's mirrored mode.
1140 * @param obj The widget.
1141 * @return mirrored mode of the object.
1145 elm_object_mirrored_get(const Evas_Object *obj)
1147 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1148 return elm_widget_mirrored_get(obj);
1152 * Sets the widget's mirrored mode.
1154 * @param obj The widget.
1155 * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset.
1158 elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
1160 EINA_SAFETY_ON_NULL_RETURN(obj);
1161 elm_widget_mirrored_set(obj, mirrored);
1165 * Returns the widget's mirrored mode setting.
1167 * @param obj The widget.
1168 * @return mirrored mode setting of the object.
1172 elm_object_mirrored_automatic_get(const Evas_Object *obj)
1174 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1175 return elm_widget_mirrored_automatic_get(obj);
1179 * Sets the widget's mirrored mode setting.
1180 * When widget in automatic mode, it follows the system mirrored mode set by
1181 * elm_mirrored_set().
1182 * @param obj The widget.
1183 * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual.
1186 elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic)
1188 EINA_SAFETY_ON_NULL_RETURN(obj);
1189 elm_widget_mirrored_automatic_set(obj, automatic);
1193 elm_object_scale_set(Evas_Object *obj,
1196 EINA_SAFETY_ON_NULL_RETURN(obj);
1197 elm_widget_scale_set(obj, scale);
1201 elm_object_scale_get(const Evas_Object *obj)
1203 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0);
1204 return elm_widget_scale_get(obj);
1208 elm_object_text_part_set(Evas_Object *obj, const char *item, const char *label)
1210 EINA_SAFETY_ON_NULL_RETURN(obj);
1211 elm_widget_text_part_set(obj, item, label);
1215 elm_object_text_part_get(const Evas_Object *obj, const char *item)
1217 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1218 return elm_widget_text_part_get(obj, item);
1222 * Get the global scaling factor
1224 * This gets the globally configured scaling factor that is applied to all
1227 * @return The scaling factor
1233 return _elm_config->scale;
1237 * Set the global scaling factor
1239 * This sets the globally configured scaling factor that is applied to all
1242 * @param scale The scaling factor to set
1246 elm_scale_set(double scale)
1248 if (_elm_config->scale == scale) return;
1249 _elm_config->scale = scale;
1254 * Set the global scaling factor for all applications on the display
1256 * This sets the globally configured scaling factor that is applied to all
1257 * objects for all applications.
1258 * @param scale The scaling factor to set
1262 elm_scale_all_set(double scale)
1264 #ifdef HAVE_ELEMENTARY_X
1265 static Ecore_X_Atom atom = 0;
1266 unsigned int scale_i = (unsigned int)(scale * 1000.0);
1268 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
1269 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1275 elm_password_show_last_get(void)
1277 return _elm_config->password_show_last;
1281 elm_password_show_last_set(Eina_Bool password_show_last)
1283 if (_elm_config->password_show_last == password_show_last) return;
1284 _elm_config->password_show_last = password_show_last;
1285 edje_password_show_last_set(_elm_config->password_show_last);
1289 elm_password_show_last_timeout_get(void)
1291 return _elm_config->password_show_last_timeout;
1295 elm_password_show_last_timeout_set(double password_show_last_timeout)
1297 if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
1298 _elm_config->password_show_last_timeout = password_show_last_timeout;
1299 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
1303 elm_object_style_set(Evas_Object *obj,
1306 EINA_SAFETY_ON_NULL_RETURN(obj);
1307 elm_widget_style_set(obj, style);
1311 elm_object_style_get(const Evas_Object *obj)
1313 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1314 return elm_widget_style_get(obj);
1318 elm_object_disabled_set(Evas_Object *obj,
1321 EINA_SAFETY_ON_NULL_RETURN(obj);
1322 elm_widget_disabled_set(obj, disabled);
1326 elm_object_disabled_get(const Evas_Object *obj)
1328 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1329 return elm_widget_disabled_get(obj);
1333 * @defgroup Config Elementary Config
1336 * Elementary configuration is formed by a set options bounded to a
1337 * given @ref Profile profile, like @ref Theme theme, @ref Fingers
1338 * "finger size", etc. These are functions with which one syncronizes
1339 * changes made to those values to the configuration storing files, de
1340 * facto. You most probably don't want to use the functions in this
1341 * group unlees you're writing an elementary configuration manager.
1345 * Save back Elementary's configuration, so that it will persist on
1348 * @return @c EINA_TRUE, when sucessful. @c EINA_FALSE, otherwise.
1351 * This function will take effect -- thus, do I/O -- immediately. Use
1352 * it when you want to apply all configuration changes at once. The
1353 * current configuration set will get saved onto the current profile
1354 * configuration file.
1358 elm_config_save(void)
1360 return _elm_config_save();
1364 * Reload Elementary's configuration, bounded to current selected
1367 * @return @c EINA_TRUE, when sucessful. @c EINA_FALSE, otherwise.
1370 * Useful when you want to force reloading of configuration values for
1371 * a profile. If one removes user custom configuration directories,
1372 * for example, it will force a reload with system values insted.
1376 elm_config_reload(void)
1378 _elm_config_reload();
1382 * @defgroup Profile Elementary Profile
1385 * Profiles are pre-set options that affect the whole look-and-feel of
1386 * Elementary-based applications. There are, for example, profiles
1387 * aimed at desktop computer applications and others aimed at mobile,
1388 * touchscreen-based ones. You most probably don't want to use the
1389 * functions in this group unlees you're writing an elementary
1390 * configuration manager.
1394 * Get Elementary's profile in use.
1396 * This gets the global profile that is applied to all Elementary
1399 * @return The profile's name
1403 elm_profile_current_get(void)
1405 return _elm_config_current_profile_get();
1409 * Get an Elementary's profile directory path in the filesystem. One
1410 * may want to fetch a system profile's dir or an user one (fetched
1413 * @param profile The profile's name
1414 * @param is_user Whether to lookup for an user profile (@c EINA_TRUE)
1415 * or a system one (@c EINA_FALSE)
1416 * @return The profile's directory path.
1419 * @note You must free it with elm_profile_dir_free().
1422 elm_profile_dir_get(const char *profile,
1425 return _elm_config_profile_dir_get(profile, is_user);
1429 * Free an Elementary's profile directory path, as returned by
1430 * elm_profile_dir_get().
1432 * @param p_dir The profile's path
1437 elm_profile_dir_free(const char *p_dir)
1439 free((void *)p_dir);
1443 * Get Elementary's list of available profiles.
1445 * @return The profiles list. List node data are the profile name
1449 * @note One must free this list, after usage, with the function
1450 * elm_profile_list_free().
1453 elm_profile_list_get(void)
1455 return _elm_config_profiles_list();
1459 * Free Elementary's list of available profiles.
1461 * @param The profiles list, as returned by elm_profile_list_get().
1466 elm_profile_list_free(Eina_List *l)
1470 EINA_LIST_FREE(l, dir)
1471 eina_stringshare_del(dir);
1475 * Set Elementary's profile.
1477 * This sets the global profile that is applied to Elementary
1478 * applications. Just the process the call comes from will be
1481 * @param profile The profile's name
1486 elm_profile_set(const char *profile)
1488 EINA_SAFETY_ON_NULL_RETURN(profile);
1489 _elm_config_profile_set(profile);
1493 * Set Elementary's profile.
1495 * This sets the global profile that is applied to all Elementary
1496 * applications. All running Elementary windows will be affected.
1498 * @param profile The profile's name
1503 elm_profile_all_set(const char *profile)
1505 #ifdef HAVE_ELEMENTARY_X
1506 static Ecore_X_Atom atom = 0;
1508 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_PROFILE");
1509 ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
1515 * @defgroup Engine Elementary Engine
1518 * These are functions setting and querying which rendering engine
1519 * Elementary will use for drawing its windows' pixels.
1523 * Get Elementary's rendering engine in use.
1525 * This gets the global rendering engine that is applied to all
1526 * Elementary applications.
1528 * @return The rendering engine's name
1531 * @note there's no need to free the returned string, here.
1534 elm_engine_current_get(void)
1536 return _elm_config->engine;
1540 * Set Elementary's rendering engine for use.
1542 * This gets sets global rendering engine that is applied to all
1543 * Elementary applications. Note that it will take effect only to
1544 * subsequent Elementary window creations.
1546 * @param The rendering engine's name
1549 * @note there's no need to free the returned string, here.
1552 elm_engine_set(const char *engine)
1554 EINA_SAFETY_ON_NULL_RETURN(engine);
1556 _elm_config_engine_set(engine);
1560 * @defgroup Fonts Elementary Fonts
1563 * These are functions dealing with font rendering, selection and the
1564 * like for Elementary applications. One might fetch which system
1565 * fonts are there to use and set custom fonts for individual classes
1566 * of UI items containing text (text classes).
1570 * Get Elementary's list of supported text classes.
1572 * @return The text classes list, with @c Elm_Text_Class blobs as data.
1575 * Release the list with elm_text_classes_list_free().
1577 EAPI const Eina_List *
1578 elm_text_classes_list_get(void)
1580 return _elm_config_text_classes_get();
1584 * Free Elementary's list of supported text classes.
1588 * @see elm_text_classes_list_get().
1591 elm_text_classes_list_free(const Eina_List *list)
1593 _elm_config_text_classes_free((Eina_List *)list);
1597 * Get Elementary's list of font overlays, set with
1598 * elm_font_overlay_set().
1600 * @return The font overlays list, with @c Elm_Font_Overlay blobs as
1605 * For each text class, one can set a <b>font overlay</b> for it,
1606 * overriding the default font properties for that class coming from
1607 * the theme in use. There is no need to free this list.
1609 * @see elm_font_overlay_set() and elm_font_overlay_unset().
1611 EAPI const Eina_List *
1612 elm_font_overlay_list_get(void)
1614 return _elm_config_font_overlays_list();
1618 * Set a font overlay for a given Elementary text class.
1620 * @param text_class Text class name
1621 * @param font Font name and style string
1622 * @param size Font size
1626 * @p font has to be in the format returned by
1627 * elm_font_fontconfig_name_get(). @see elm_font_overlay_list_get()
1628 * and @elm_font_overlay_unset().
1631 elm_font_overlay_set(const char *text_class,
1633 Evas_Font_Size size)
1635 _elm_config_font_overlay_set(text_class, font, size);
1639 * Unset a font overlay for a given Elementary text class.
1641 * @param text_class Text class name
1645 * This will bring back text elements belonging to text class @p
1646 * text_class back to their default font settings.
1649 elm_font_overlay_unset(const char *text_class)
1651 _elm_config_font_overlay_remove(text_class);
1655 * Apply the changes made with elm_font_overlay_set() and
1656 * elm_font_overlay_unset() on the current Elementary window.
1660 * This applies all font overlays set to all objects in the UI.
1663 elm_font_overlay_apply(void)
1665 _elm_config_font_overlay_apply();
1669 * Apply the changes made with elm_font_overlay_set() and
1670 * elm_font_overlay_unset() on all Elementary application windows.
1674 * This applies all font overlays set to all objects in the UI.
1677 elm_font_overlay_all_apply(void)
1679 #ifdef HAVE_ELEMENTARY_X
1680 static Ecore_X_Atom atom = 0;
1681 unsigned int dummy = (unsigned int)(1 * 1000.0);
1683 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_OVERLAY");
1684 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(), atom, &dummy,
1690 * Translate a font (family) name string in fontconfig's font names
1691 * syntax into an @c Elm_Font_Properties struct.
1693 * @param font The font name and styles string
1694 * @return the font properties struct
1698 * @note The reverse translation can be achived with
1699 * elm_font_fontconfig_name_get(), for one style only (single font
1700 * instance, not family).
1702 EAPI Elm_Font_Properties *
1703 elm_font_properties_get(const char *font)
1705 EINA_SAFETY_ON_NULL_RETURN_VAL(font, NULL);
1706 return _elm_font_properties_get(NULL, font);
1710 * Free font properties return by elm_font_properties_get().
1712 * @param efp the font properties struct
1717 elm_font_properties_free(Elm_Font_Properties *efp)
1721 EINA_SAFETY_ON_NULL_RETURN(efp);
1722 EINA_LIST_FREE(efp->styles, str)
1723 if (str) eina_stringshare_del(str);
1724 if (efp->name) eina_stringshare_del(efp->name);
1729 * Translate a font name, bound to a style, into fontconfig's font names
1732 * @param name The font (family) name
1733 * @param style The given style (may be @c NULL)
1735 * @return the font name and style string
1739 * @note The reverse translation can be achived with
1740 * elm_font_properties_get(), for one style only (single font
1741 * instance, not family).
1744 elm_font_fontconfig_name_get(const char *name,
1749 EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
1750 if (!style || style[0] == 0) return eina_stringshare_add(name);
1751 snprintf(buf, 256, "%s" ELM_FONT_TOKEN_STYLE "%s", name, style);
1752 return eina_stringshare_add(buf);
1756 * Free the font string return by elm_font_fontconfig_name_get().
1758 * @param efp the font properties struct
1763 elm_font_fontconfig_name_free(const char *name)
1765 eina_stringshare_del(name);
1769 * Create a font hash table of available system fonts.
1771 * One must call it with @p list being the return value of
1772 * evas_font_available_list(). The hash will be indexed by font
1773 * (family) names, being its values @c Elm_Font_Properties blobs.
1775 * @param list The list of available system fonts, as returned by
1776 * evas_font_available_list().
1777 * @return the font hash.
1781 * @note The user is supposed to get it populated at least with 3
1782 * default font families (Sans, Serif, Monospace), which should be
1783 * present on most systems.
1786 elm_font_available_hash_add(Eina_List *list)
1788 Eina_Hash *font_hash;
1794 /* populate with default font families */
1795 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Regular");
1796 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Bold");
1797 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Oblique");
1798 font_hash = _elm_font_available_hash_add(font_hash,
1799 "Sans:style=Bold Oblique");
1801 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Regular");
1802 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Bold");
1803 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Oblique");
1804 font_hash = _elm_font_available_hash_add(font_hash,
1805 "Serif:style=Bold Oblique");
1807 font_hash = _elm_font_available_hash_add(font_hash,
1808 "Monospace:style=Regular");
1809 font_hash = _elm_font_available_hash_add(font_hash,
1810 "Monospace:style=Bold");
1811 font_hash = _elm_font_available_hash_add(font_hash,
1812 "Monospace:style=Oblique");
1813 font_hash = _elm_font_available_hash_add(font_hash,
1814 "Monospace:style=Bold Oblique");
1816 EINA_LIST_FOREACH(list, l, key)
1817 font_hash = _elm_font_available_hash_add(font_hash, key);
1823 * Free the hash return by elm_font_available_hash_add().
1825 * @param hash the hash to be freed.
1830 elm_font_available_hash_del(Eina_Hash *hash)
1832 _elm_font_available_hash_del(hash);
1836 elm_finger_size_get(void)
1838 return _elm_config->finger_size;
1842 * Set the configured finger size
1844 * This sets the globally configured finger size in pixels
1846 * @param size The finger size
1850 elm_finger_size_set(Evas_Coord size)
1852 if (_elm_config->finger_size == size) return;
1853 _elm_config->finger_size = size;
1858 * Set the configured finger size for all applications on the display
1860 * This sets the globally configured finger size in pixels for all applications
1863 * @param size The finger size
1867 elm_finger_size_all_set(Evas_Coord size)
1869 #ifdef HAVE_ELEMENTARY_X
1870 static Ecore_X_Atom atom = 0;
1871 unsigned int size_i = (unsigned int)size;
1873 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
1874 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1880 elm_autocapitalization_allow_all_set(Eina_Bool on)
1882 #ifdef HAVE_ELEMENTARY_X
1883 static Ecore_X_Atom atom = 0;
1884 unsigned int on_i = (unsigned int)on;
1886 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_AUTOCAPITAL_ALLOW");
1887 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1893 elm_autoperiod_allow_all_set(Eina_Bool on)
1895 #ifdef HAVE_ELEMENTARY_X
1896 static Ecore_X_Atom atom = 0;
1897 unsigned int on_i = (unsigned int)on;
1899 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_AUTOPERIOD_ALLOW");
1900 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1905 * Adjust size of an element for finger usage
1907 * This takes width and height sizes (in pixels) as input and a size multiple
1908 * (which is how many fingers you want to place within the area), and adjusts
1909 * the size tobe large enough to accommodate finger. On return the w and h
1910 * sizes poiner do by these parameters will be modified.
1912 * @param times_w How many fingers should fit horizontally
1913 * @param w Pointer to the width size to adjust
1914 * @param times_h How many fingers should fit vertically
1915 * @param h Pointer to the height size to adjust
1919 elm_coords_finger_size_adjust(int times_w,
1924 if ((w) && (*w < (_elm_config->finger_size * times_w)))
1925 *w = _elm_config->finger_size * times_w;
1926 if ((h) && (*h < (_elm_config->finger_size * times_h)))
1927 *h = _elm_config->finger_size * times_h;
1931 * @defgroup Caches Caches
1934 * These are functions which let one fine-tune some cache values for
1935 * Elementary applications, thus allowing for performance adjustments.
1939 * Flush all caches & dump all data that can be to lean down to use
1950 edje_file_cache_flush();
1951 edje_collection_cache_flush();
1953 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1955 Evas *e = evas_object_evas_get(obj);
1956 evas_image_cache_flush(e);
1957 evas_font_cache_flush(e);
1958 evas_render_dump(e);
1963 * Get the configured cache flush interval time
1965 * This gets the globally configured cache flush interval time, in
1968 * @return The cache flush interval time
1971 * @see elm_all_flush()
1974 elm_cache_flush_interval_get(void)
1976 return _elm_config->cache_flush_poll_interval;
1980 * Set the configured cache flush interval time
1982 * This sets the globally configured cache flush interval time, in ticks
1984 * @param size The cache flush interval time
1987 * @see elm_all_flush()
1990 elm_cache_flush_interval_set(int size)
1992 if (_elm_config->cache_flush_poll_interval == size) return;
1993 _elm_config->cache_flush_poll_interval = size;
1999 * Set the configured cache flush interval time for all applications on the
2002 * This sets the globally configured cache flush interval time -- in ticks
2003 * -- for all applications on the display.
2005 * @param size The cache flush interval time
2009 elm_cache_flush_interval_all_set(int size)
2011 #ifdef HAVE_ELEMENTARY_X
2012 static Ecore_X_Atom atom = 0;
2013 unsigned int size_i = (unsigned int)size;
2015 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_INTERVAL");
2016 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2022 * Get the configured cache flush enabled state
2024 * This gets the globally configured cache flush state - if it is enabled
2025 * or not. When cache flushing is enabled, elementary will regularly
2026 * (see elm_cache_flush_interval_get() ) flush caches and dump data out of
2027 * memory and allow usage to re-seed caches and data in memory where it
2028 * can do so. An idle application will thus minimise its memory usage as
2029 * data will be freed from memory and not be re-loaded as it is idle and
2030 * not rendering or doing anything graphically right now.
2032 * @return The cache flush state
2035 * @see elm_all_flush()
2038 elm_cache_flush_enabled_get(void)
2040 return _elm_config->cache_flush_enable;
2044 * Set the configured cache flush enabled state
2046 * This sets the globally configured cache flush enabled state
2048 * @param size The cache flush enabled state
2051 * @see elm_all_flush()
2054 elm_cache_flush_enabled_set(Eina_Bool enabled)
2056 enabled = !!enabled;
2057 if (_elm_config->cache_flush_enable == enabled) return;
2058 _elm_config->cache_flush_enable = enabled;
2064 * Set the configured cache flush enabled state for all applications on the
2067 * This sets the globally configured cache flush enabled state for all
2068 * applications on the display.
2070 * @param size The cache flush enabled state
2074 elm_cache_flush_enabled_all_set(Eina_Bool enabled)
2076 #ifdef HAVE_ELEMENTARY_X
2077 static Ecore_X_Atom atom = 0;
2078 unsigned int enabled_i = (unsigned int)enabled;
2080 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_ENABLE");
2081 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2082 atom, &enabled_i, 1);
2087 * Get the configured font cache size
2089 * This gets the globally configured font cache size, in bytes
2091 * @return The font cache size
2095 elm_font_cache_get(void)
2097 return _elm_config->font_cache;
2101 * Set the configured font cache size
2103 * This sets the globally configured font cache size, in bytes
2105 * @param size The font cache size
2109 elm_font_cache_set(int size)
2111 if (_elm_config->font_cache == size) return;
2112 _elm_config->font_cache = size;
2118 * Set the configured font cache size for all applications on the
2121 * This sets the globally configured font cache size -- in bytes
2122 * -- for all applications on the display.
2124 * @param size The font cache size
2128 elm_font_cache_all_set(int size)
2130 #ifdef HAVE_ELEMENTARY_X
2131 static Ecore_X_Atom atom = 0;
2132 unsigned int size_i = (unsigned int)size;
2134 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_CACHE");
2135 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2141 * Get the configured image cache size
2143 * This gets the globally configured image cache size, in bytes
2145 * @return The image cache size
2149 elm_image_cache_get(void)
2151 return _elm_config->image_cache;
2155 * Set the configured image cache size
2157 * This sets the globally configured image cache size, in bytes
2159 * @param size The image cache size
2163 elm_image_cache_set(int size)
2165 if (_elm_config->image_cache == size) return;
2166 _elm_config->image_cache = size;
2172 * Set the configured image cache size for all applications on the
2175 * This sets the globally configured image cache size -- in bytes
2176 * -- for all applications on the display.
2178 * @param size The image cache size
2182 elm_image_cache_all_set(int size)
2184 #ifdef HAVE_ELEMENTARY_X
2185 static Ecore_X_Atom atom = 0;
2186 unsigned int size_i = (unsigned int)size;
2188 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_IMAGE_CACHE");
2189 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2195 * Get the configured edje file cache size.
2197 * This gets the globally configured edje file cache size, in number
2200 * @return The edje file cache size
2204 elm_edje_file_cache_get(void)
2206 return _elm_config->edje_cache;
2210 * Set the configured edje file cache size
2212 * This sets the globally configured edje file cache size, in number
2215 * @param size The edje file cache size
2219 elm_edje_file_cache_set(int size)
2221 if (_elm_config->edje_cache == size) return;
2222 _elm_config->edje_cache = size;
2228 * Set the configured edje file cache size for all applications on the
2231 * This sets the globally configured edje file cache size -- in number
2232 * of files -- for all applications on the display.
2234 * @param size The edje file cache size
2238 elm_edje_file_cache_all_set(int size)
2240 #ifdef HAVE_ELEMENTARY_X
2241 static Ecore_X_Atom atom = 0;
2242 unsigned int size_i = (unsigned int)size;
2244 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_FILE_CACHE");
2245 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2251 * Get the configured edje collections (groups) cache size.
2253 * This gets the globally configured edje collections cache size, in
2254 * number of collections.
2256 * @return The edje collections cache size
2260 elm_edje_collection_cache_get(void)
2262 return _elm_config->edje_collection_cache;
2266 * Set the configured edje collections (groups) cache size
2268 * This sets the globally configured edje collections cache size, in
2269 * number of collections.
2271 * @param size The edje collections cache size
2275 elm_edje_collection_cache_set(int size)
2277 if (_elm_config->edje_collection_cache == size) return;
2278 _elm_config->edje_collection_cache = size;
2284 * Set the configured edje collections (groups) cache size for all
2285 * applications on the display
2287 * This sets the globally configured edje collections cache size -- in
2288 * number of collections -- for all applications on the display.
2290 * @param size The edje collections cache size
2294 elm_edje_collection_cache_all_set(int size)
2296 #ifdef HAVE_ELEMENTARY_X
2297 static Ecore_X_Atom atom = 0;
2298 unsigned int size_i = (unsigned int)size;
2300 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_COLLECTION_CACHE");
2301 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2307 elm_object_focus_get(const Evas_Object *obj)
2309 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2310 return elm_widget_focus_get(obj);
2314 elm_object_focus(Evas_Object *obj)
2316 EINA_SAFETY_ON_NULL_RETURN(obj);
2317 if (elm_widget_focus_get(obj))
2320 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
2324 elm_object_unfocus(Evas_Object *obj)
2326 EINA_SAFETY_ON_NULL_RETURN(obj);
2327 if (!elm_widget_can_focus_get(obj)) return;
2328 elm_widget_focused_object_clear(obj);
2332 elm_object_focus_allow_set(Evas_Object *obj,
2335 EINA_SAFETY_ON_NULL_RETURN(obj);
2336 elm_widget_can_focus_set(obj, enable);
2340 elm_object_focus_allow_get(const Evas_Object *obj)
2342 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2343 return (elm_widget_can_focus_get(obj)) || (elm_widget_child_can_focus_get(obj));
2347 * Set custom focus chain.
2349 * This function i set one new and overwrite any previous custom focus chain
2350 * with the list of objects. The previous list will be deleted and this list
2351 * will be managed. After setted, don't modity it.
2353 * @note On focus cycle, only will be evaluated children of this container.
2355 * @param obj The container object
2356 * @param objs Chain of objects to pass focus
2360 elm_object_focus_custom_chain_set(Evas_Object *obj,
2363 EINA_SAFETY_ON_NULL_RETURN(obj);
2364 elm_widget_focus_custom_chain_set(obj, objs);
2368 * Unset custom focus chain
2370 * @param obj The container object
2374 elm_object_focus_custom_chain_unset(Evas_Object *obj)
2376 EINA_SAFETY_ON_NULL_RETURN(obj);
2377 elm_widget_focus_custom_chain_unset(obj);
2381 * Get custom focus chain
2383 * @param obj The container object
2386 EAPI const Eina_List *
2387 elm_object_focus_custom_chain_get(const Evas_Object *obj)
2389 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2390 return elm_widget_focus_custom_chain_get(obj);
2394 * Append object to custom focus chain.
2396 * @note If relative_child equal to NULL or not in custom chain, the object
2397 * will be added in end.
2399 * @note On focus cycle, only will be evaluated children of this container.
2401 * @param obj The container object
2402 * @param child The child to be added in custom chain
2403 * @param relative_child The relative object to position the child
2407 elm_object_focus_custom_chain_append(Evas_Object *obj,
2409 Evas_Object *relative_child)
2411 EINA_SAFETY_ON_NULL_RETURN(obj);
2412 EINA_SAFETY_ON_NULL_RETURN(child);
2413 elm_widget_focus_custom_chain_append(obj, child, relative_child);
2417 * Prepend object to custom focus chain.
2419 * @note If relative_child equal to NULL or not in custom chain, the object
2420 * will be added in begin.
2422 * @note On focus cycle, only will be evaluated children of this container.
2424 * @param obj The container object
2425 * @param child The child to be added in custom chain
2426 * @param relative_child The relative object to position the child
2430 elm_object_focus_custom_chain_prepend(Evas_Object *obj,
2432 Evas_Object *relative_child)
2434 EINA_SAFETY_ON_NULL_RETURN(obj);
2435 EINA_SAFETY_ON_NULL_RETURN(child);
2436 elm_widget_focus_custom_chain_prepend(obj, child, relative_child);
2440 * Give focus to next object in object tree.
2442 * Give focus to next object in focus chain of one object sub-tree.
2443 * If the last object of chain already have focus, the focus will go to the
2444 * first object of chain.
2446 * @param obj The object root of sub-tree
2447 * @param dir Direction to cycle the focus
2452 elm_object_focus_cycle(Evas_Object *obj,
2453 Elm_Focus_Direction dir)
2455 EINA_SAFETY_ON_NULL_RETURN(obj);
2456 elm_widget_focus_cycle(obj, dir);
2460 * Give focus to near object in one direction.
2462 * Give focus to near object in direction of one object.
2463 * If none focusable object in given direction, the focus will not change.
2465 * @param obj The reference object
2466 * @param x Horizontal component of direction to focus
2467 * @param y Vertical component of direction to focus
2472 elm_object_focus_direction_go(Evas_Object *obj,
2476 EINA_SAFETY_ON_NULL_RETURN(obj);
2477 elm_widget_focus_direction_go(obj, x, y);
2481 elm_object_tree_unfocusable_set(Evas_Object *obj,
2482 Eina_Bool tree_unfocusable)
2484 EINA_SAFETY_ON_NULL_RETURN(obj);
2485 elm_widget_tree_unfocusable_set(obj, tree_unfocusable);
2489 elm_object_tree_unfocusable_get(const Evas_Object *obj)
2491 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2492 return elm_widget_tree_unfocusable_get(obj);
2496 * Get the enable status of the focus highlight
2498 * This gets whether the highlight on focused objects is enabled or not
2502 elm_focus_highlight_enabled_get(void)
2504 return _elm_config->focus_highlight_enable;
2508 * Set the enable status of the focus highlight
2510 * Set whether to show or not the highlight on focused objects
2511 * @param enable Enable highlight if EINA_TRUE, disable otherwise
2515 elm_focus_highlight_enabled_set(Eina_Bool enable)
2517 _elm_config->focus_highlight_enable = !!enable;
2521 * Get the enable status of the highlight animation
2523 * Get whether the focus highlight, if enabled, will animate its switch from
2524 * one object to the next
2528 elm_focus_highlight_animate_get(void)
2530 return _elm_config->focus_highlight_animate;
2534 * Set the enable status of the highlight animation
2536 * Set whether the focus highlight, if enabled, will animate its switch from
2537 * one object to the next
2538 * @param animate Enable animation if EINA_TRUE, disable otherwise
2542 elm_focus_highlight_animate_set(Eina_Bool animate)
2544 _elm_config->focus_highlight_animate = !!animate;
2548 * @defgroup Scrolling Scrolling
2551 * These are functions setting how scrollable views in Elementary
2552 * widgets should behave on user interaction.
2556 * Get whether scrollers should bounce when they reach their
2557 * viewport's edge during a scroll.
2559 * @return the thumb scroll bouncing state
2561 * This is the default behavior for touch screens, in general.
2562 * @ingroup Scrolling
2565 elm_scroll_bounce_enabled_get(void)
2567 return _elm_config->thumbscroll_bounce_enable;
2571 * Set whether scrollers should bounce when they reach their
2572 * viewport's edge during a scroll.
2574 * @param enabled the thumb scroll bouncing state
2576 * @see elm_thumbscroll_bounce_enabled_get()
2577 * @ingroup Scrolling
2580 elm_scroll_bounce_enabled_set(Eina_Bool enabled)
2582 _elm_config->thumbscroll_bounce_enable = enabled;
2586 * Set whether scrollers should bounce when they reach their
2587 * viewport's edge during a scroll, for all Elementary application
2590 * @param enabled the thumb scroll bouncing state
2592 * @see elm_thumbscroll_bounce_enabled_get()
2593 * @ingroup Scrolling
2596 elm_scroll_bounce_enabled_all_set(Eina_Bool enabled)
2598 #ifdef HAVE_ELEMENTARY_X
2599 static Ecore_X_Atom atom = 0;
2600 unsigned int bounce_enable_i = (unsigned int)enabled;
2603 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE");
2604 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2605 atom, &bounce_enable_i, 1);
2610 * Get the amount of inertia a scroller will impose at bounce
2613 * @return the thumb scroll bounce friction
2615 * @ingroup Scrolling
2618 elm_scroll_bounce_friction_get(void)
2620 return _elm_config->thumbscroll_bounce_friction;
2624 * Set the amount of inertia a scroller will impose at bounce
2627 * @param friction the thumb scroll bounce friction
2629 * @see elm_thumbscroll_bounce_friction_get()
2630 * @ingroup Scrolling
2633 elm_scroll_bounce_friction_set(double friction)
2635 _elm_config->thumbscroll_bounce_friction = friction;
2639 * Set the amount of inertia a scroller will impose at bounce
2640 * animations, for all Elementary application windows.
2642 * @param friction the thumb scroll bounce friction
2644 * @see elm_thumbscroll_bounce_friction_get()
2645 * @ingroup Scrolling
2648 elm_scroll_bounce_friction_all_set(double friction)
2650 #ifdef HAVE_ELEMENTARY_X
2651 static Ecore_X_Atom atom = 0;
2652 unsigned int bounce_friction_i = (unsigned int)(friction * 1000.0);
2655 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION");
2656 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2657 atom, &bounce_friction_i, 1);
2662 * Get the amount of inertia a <b>paged</b> scroller will impose at
2663 * page fitting animations.
2665 * @return the page scroll friction
2667 * @ingroup Scrolling
2670 elm_scroll_page_scroll_friction_get(void)
2672 return _elm_config->page_scroll_friction;
2676 * Set the amount of inertia a <b>paged</b> scroller will impose at
2677 * page fitting animations.
2679 * @param friction the page scroll friction
2681 * @see elm_thumbscroll_page_scroll_friction_get()
2682 * @ingroup Scrolling
2685 elm_scroll_page_scroll_friction_set(double friction)
2687 _elm_config->page_scroll_friction = friction;
2691 * Set the amount of inertia a <b>paged</b> scroller will impose at
2692 * page fitting animations, for all Elementary application windows.
2694 * @param friction the page scroll friction
2696 * @see elm_thumbscroll_page_scroll_friction_get()
2697 * @ingroup Scrolling
2700 elm_scroll_page_scroll_friction_all_set(double friction)
2702 #ifdef HAVE_ELEMENTARY_X
2703 static Ecore_X_Atom atom = 0;
2704 unsigned int page_scroll_friction_i = (unsigned int)(friction * 1000.0);
2707 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION");
2708 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2709 atom, &page_scroll_friction_i, 1);
2714 * Get the amount of inertia a scroller will impose at region bring
2717 * @return the bring in scroll friction
2719 * @ingroup Scrolling
2722 elm_scroll_bring_in_scroll_friction_get(void)
2724 return _elm_config->bring_in_scroll_friction;
2728 * Set the amount of inertia a scroller will impose at region bring
2731 * @param friction the bring in scroll friction
2733 * @see elm_thumbscroll_bring_in_scroll_friction_get()
2734 * @ingroup Scrolling
2737 elm_scroll_bring_in_scroll_friction_set(double friction)
2739 _elm_config->bring_in_scroll_friction = friction;
2743 * Set the amount of inertia a scroller will impose at region bring
2744 * animations, for all Elementary application windows.
2746 * @param friction the bring in scroll friction
2748 * @see elm_thumbscroll_bring_in_scroll_friction_get()
2749 * @ingroup Scrolling
2752 elm_scroll_bring_in_scroll_friction_all_set(double friction)
2754 #ifdef HAVE_ELEMENTARY_X
2755 static Ecore_X_Atom atom = 0;
2756 unsigned int bring_in_scroll_friction_i = (unsigned int)(friction * 1000.0);
2760 ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION");
2761 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2762 atom, &bring_in_scroll_friction_i, 1);
2767 * Get the amount of inertia scrollers will impose at animations
2768 * triggered by Elementary widgets' zooming API.
2770 * @return the zoom friction
2772 * @ingroup Scrolling
2775 elm_scroll_zoom_friction_get(void)
2777 return _elm_config->zoom_friction;
2781 * Set the amount of inertia scrollers will impose at animations
2782 * triggered by Elementary widgets' zooming API.
2784 * @param friction the zoom friction
2786 * @see elm_thumbscroll_zoom_friction_get()
2787 * @ingroup Scrolling
2790 elm_scroll_zoom_friction_set(double friction)
2792 _elm_config->zoom_friction = friction;
2796 * Set the amount of inertia scrollers will impose at animations
2797 * triggered by Elementary widgets' zooming API, for all Elementary
2798 * application windows.
2800 * @param friction the zoom friction
2802 * @see elm_thumbscroll_zoom_friction_get()
2803 * @ingroup Scrolling
2806 elm_scroll_zoom_friction_all_set(double friction)
2808 #ifdef HAVE_ELEMENTARY_X
2809 static Ecore_X_Atom atom = 0;
2810 unsigned int zoom_friction_i = (unsigned int)(friction * 1000.0);
2813 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION");
2814 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2815 atom, &zoom_friction_i, 1);
2820 * Get whether scrollers should be draggable from any point in their
2823 * @return the thumb scroll state
2825 * @note This is the default behavior for touch screens, in general.
2826 * @note All other functions namespaced with "thumbscroll" will only
2827 * have effect if this mode is enabled.
2829 * @ingroup Scrolling
2832 elm_scroll_thumbscroll_enabled_get(void)
2834 return _elm_config->thumbscroll_enable;
2838 * Set whether scrollers should be draggable from any point in their
2841 * @param enabled the thumb scroll state
2843 * @see elm_thumbscroll_enabled_get()
2844 * @ingroup Scrolling
2847 elm_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
2849 _elm_config->thumbscroll_enable = enabled;
2853 * Set whether scrollers should be draggable from any point in their
2854 * views, for all Elementary application windows.
2856 * @param enabled the thumb scroll state
2858 * @see elm_thumbscroll_enabled_get()
2859 * @ingroup Scrolling
2862 elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled)
2864 #ifdef HAVE_ELEMENTARY_X
2865 static Ecore_X_Atom atom = 0;
2866 unsigned int ts_enable_i = (unsigned int)enabled;
2868 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ENABLE");
2869 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2870 atom, &ts_enable_i, 1);
2875 * Get the number of pixels one should travel while dragging a
2876 * scroller's view to actually trigger scrolling.
2878 * @return the thumb scroll threshould
2880 * One would use higher values for touch screens, in general, because
2881 * of their inherent imprecision.
2882 * @ingroup Scrolling
2885 elm_scroll_thumbscroll_threshold_get(void)
2887 return _elm_config->thumbscroll_threshold;
2891 * Set the number of pixels one should travel while dragging a
2892 * scroller's view to actually trigger scrolling.
2894 * @param threshold the thumb scroll threshould
2896 * @see elm_thumbscroll_threshould_get()
2897 * @ingroup Scrolling
2900 elm_scroll_thumbscroll_threshold_set(unsigned int threshold)
2902 _elm_config->thumbscroll_threshold = threshold;
2906 * Set the number of pixels one should travel while dragging a
2907 * scroller's view to actually trigger scrolling, for all Elementary
2908 * application windows.
2910 * @param threshold the thumb scroll threshould
2912 * @see elm_thumbscroll_threshould_get()
2913 * @ingroup Scrolling
2916 elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold)
2918 #ifdef HAVE_ELEMENTARY_X
2919 static Ecore_X_Atom atom = 0;
2920 unsigned int ts_threshold_i = (unsigned int)threshold;
2922 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_THRESHOLD");
2923 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2924 atom, &ts_threshold_i, 1);
2929 * Get the minimum speed of mouse cursor movement which will trigger
2930 * list self scrolling animation after a mouse up event
2933 * @return the thumb scroll momentum threshould
2935 * @ingroup Scrolling
2938 elm_scroll_thumbscroll_momentum_threshold_get(void)
2940 return _elm_config->thumbscroll_momentum_threshold;
2944 * Set the minimum speed of mouse cursor movement which will trigger
2945 * list self scrolling animation after a mouse up event
2948 * @param threshold the thumb scroll momentum threshould
2950 * @see elm_thumbscroll_momentum_threshould_get()
2951 * @ingroup Scrolling
2954 elm_scroll_thumbscroll_momentum_threshold_set(double threshold)
2956 _elm_config->thumbscroll_momentum_threshold = threshold;
2960 * Set the minimum speed of mouse cursor movement which will trigger
2961 * list self scrolling animation after a mouse up event
2962 * (pixels/second), for all Elementary application windows.
2964 * @param threshold the thumb scroll momentum threshould
2966 * @see elm_thumbscroll_momentum_threshould_get()
2967 * @ingroup Scrolling
2970 elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold)
2972 #ifdef HAVE_ELEMENTARY_X
2973 static Ecore_X_Atom atom = 0;
2974 unsigned int ts_momentum_threshold_i = (unsigned int)(threshold * 1000.0);
2977 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD");
2978 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2979 atom, &ts_momentum_threshold_i, 1);
2984 * Get the amount of inertia a scroller will impose at self scrolling
2987 * @return the thumb scroll friction
2989 * @ingroup Scrolling
2992 elm_scroll_thumbscroll_friction_get(void)
2994 return _elm_config->thumbscroll_friction;
2998 * Set the amount of inertia a scroller will impose at self scrolling
3001 * @param friction the thumb scroll friction
3003 * @see elm_thumbscroll_friction_get()
3004 * @ingroup Scrolling
3007 elm_scroll_thumbscroll_friction_set(double friction)
3009 _elm_config->thumbscroll_friction = friction;
3013 * Set the amount of inertia a scroller will impose at self scrolling
3014 * animations, for all Elementary application windows.
3016 * @param friction the thumb scroll friction
3018 * @see elm_thumbscroll_friction_get()
3019 * @ingroup Scrolling
3022 elm_scroll_thumbscroll_friction_all_set(double friction)
3024 #ifdef HAVE_ELEMENTARY_X
3025 static Ecore_X_Atom atom = 0;
3026 unsigned int ts_friction_i = (unsigned int)(friction * 1000.0);
3028 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_FRICTION");
3029 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3030 atom, &ts_friction_i, 1);
3035 * Get the amount of lag between your actual mouse cursor dragging
3036 * movement and a scroller's view movement itself, while pushing it
3037 * into bounce state manually.
3039 * @return the thumb scroll border friction
3041 * @ingroup Scrolling
3044 elm_scroll_thumbscroll_border_friction_get(void)
3046 return _elm_config->thumbscroll_border_friction;
3050 * Set the amount of lag between your actual mouse cursor dragging
3051 * movement and a scroller's view movement itself, while pushing it
3052 * into bounce state manually.
3054 * @param friction the thumb scroll border friction. @c 0.0 for
3055 * perfect synchrony between two movements, @c 1.0 for maximum
3058 * @see elm_thumbscroll_border_friction_get()
3059 * @note parameter value will get bound to 0.0 - 1.0 interval, always
3061 * @ingroup Scrolling
3064 elm_scroll_thumbscroll_border_friction_set(double friction)
3072 _elm_config->thumbscroll_friction = friction;
3076 * Set the amount of lag between your actual mouse cursor dragging
3077 * movement and a scroller's view movement itself, while pushing it
3078 * into bounce state manually, for all Elementary application windows.
3080 * @param friction the thumb scroll border friction. @c 0.0 for
3081 * perfect synchrony between two movements, @c 1.0 for maximum
3084 * @see elm_thumbscroll_border_friction_get()
3085 * @note parameter value will get bound to 0.0 - 1.0 interval, always
3087 * @ingroup Scrolling
3090 elm_scroll_thumbscroll_border_friction_all_set(double friction)
3098 #ifdef HAVE_ELEMENTARY_X
3099 static Ecore_X_Atom atom = 0;
3100 unsigned int border_friction_i = (unsigned int)(friction * 1000.0);
3103 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION");
3104 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3105 atom, &border_friction_i, 1);
3110 * @defgroup Scrollhints Scrollhints
3113 * Objects when inside a scroller can scroll, but this may not always be
3114 * desirable in certain situations. This allows an object to hint to itself
3115 * and parents to "not scroll" in one of 2 ways.
3117 * 1. To hold on scrolling. This means just flicking and dragging may no
3118 * longer scroll, but pressing/dragging near an edge of the scroller will
3119 * still scroll. This is automastically used by the entry object when
3121 * 2. To totally freeze scrolling. This means it stops. until popped/released.
3125 * Push the scroll hold by 1
3127 * This increments the scroll hold count by one. If it is more than 0 it will
3128 * take effect on the parents of the indicated object.
3130 * @param obj The object
3131 * @ingroup Scrollhints
3134 elm_object_scroll_hold_push(Evas_Object *obj)
3136 EINA_SAFETY_ON_NULL_RETURN(obj);
3137 elm_widget_scroll_hold_push(obj);
3141 * Pop the scroll hold by 1
3143 * This decrements the scroll hold count by one. If it is more than 0 it will
3144 * take effect on the parents of the indicated object.
3146 * @param obj The object
3147 * @ingroup Scrollhints
3150 elm_object_scroll_hold_pop(Evas_Object *obj)
3152 EINA_SAFETY_ON_NULL_RETURN(obj);
3153 elm_widget_scroll_hold_pop(obj);
3157 * Push the scroll freeze by 1
3159 * This increments the scroll freeze count by one. If it is more than 0 it will
3160 * take effect on the parents of the indicated object.
3162 * @param obj The object
3163 * @ingroup Scrollhints
3166 elm_object_scroll_freeze_push(Evas_Object *obj)
3168 EINA_SAFETY_ON_NULL_RETURN(obj);
3169 elm_widget_scroll_freeze_push(obj);
3173 * Lock the scrolling of the given widget (and thus all parents)
3175 * This locks the given object from scrolling in the X axis (and implicitly
3176 * also locks all parent scrollers too from doing the same).
3178 * @param obj The object
3179 * @param lock The lock state (1 == locked, 0 == unlocked)
3180 * @ingroup Scrollhints
3183 elm_object_scroll_lock_x_set(Evas_Object *obj,
3186 EINA_SAFETY_ON_NULL_RETURN(obj);
3187 elm_widget_drag_lock_x_set(obj, lock);
3191 * Lock the scrolling of the given widget (and thus all parents)
3193 * This locks the given object from scrolling in the Y axis (and implicitly
3194 * also locks all parent scrollers too from doing the same).
3196 * @param obj The object
3197 * @param lock The lock state (1 == locked, 0 == unlocked)
3198 * @ingroup Scrollhints
3201 elm_object_scroll_lock_y_set(Evas_Object *obj,
3204 EINA_SAFETY_ON_NULL_RETURN(obj);
3205 elm_widget_drag_lock_y_set(obj, lock);
3209 * Get the scrolling lock of the given widget
3211 * This gets the lock for X axis scrolling.
3213 * @param obj The object
3214 * @ingroup Scrollhints
3217 elm_object_scroll_lock_x_get(const Evas_Object *obj)
3219 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3220 return elm_widget_drag_lock_x_get(obj);
3224 * Get the scrolling lock of the given widget
3226 * This gets the lock for X axis scrolling.
3228 * @param obj The object
3229 * @ingroup Scrollhints
3232 elm_object_scroll_lock_y_get(const Evas_Object *obj)
3234 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3235 return elm_widget_drag_lock_y_get(obj);
3239 * Pop the scroll freeze by 1
3241 * This decrements the scroll freeze count by one. If it is more than 0 it will
3242 * take effect on the parents of the indicated object.
3244 * @param obj The object
3245 * @ingroup Scrollhints
3248 elm_object_scroll_freeze_pop(Evas_Object *obj)
3250 EINA_SAFETY_ON_NULL_RETURN(obj);
3251 elm_widget_scroll_freeze_pop(obj);
3255 * Check if the given Evas Object is an Elementary widget.
3257 * @param obj the object to query.
3258 * @return @c EINA_TRUE if it is an elementary widget variant,
3259 * @c EINA_FALSE otherwise
3260 * @ingroup WidgetNavigation
3263 elm_object_widget_check(const Evas_Object *obj)
3265 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3266 return elm_widget_is(obj);
3270 elm_object_parent_widget_get(const Evas_Object *obj)
3272 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3273 return elm_widget_parent_widget_get(obj);
3277 * Get the top level parent of an Elementary widget.
3279 * @param obj The object to query.
3280 * @return The top level Elementary widget, or @c NULL if parent cannot be
3282 * @ingroup WidgetNavigation
3285 elm_object_top_widget_get(const Evas_Object *obj)
3287 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3288 return elm_widget_top_get(obj);
3292 * Get the string that represents this Elementary widget.
3294 * @note Elementary is weird and exposes itself as a single
3295 * Evas_Object_Smart_Class of type "elm_widget", so
3296 * evas_object_type_get() always return that, making debug and
3297 * language bindings hard. This function tries to mitigate this
3298 * problem, but the solution is to change Elementary to use
3299 * proper inheritance.
3301 * @param obj the object to query.
3302 * @return Elementary widget name, or @c NULL if not a valid widget.
3303 * @ingroup WidgetNavigation
3306 elm_object_widget_type_get(const Evas_Object *obj)
3308 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3309 return elm_widget_type_get(obj);
3313 * Send a signal to the widget edje object.
3315 * This function sends a signal to the edje object of the obj. An edje program
3316 * can respond to a signal by specifying matching 'signal' and
3319 * @param obj The object
3320 * @param emission The signal's name.
3321 * @param source The signal's source.
3325 elm_object_signal_emit(Evas_Object *obj,
3326 const char *emission,
3329 EINA_SAFETY_ON_NULL_RETURN(obj);
3330 elm_widget_signal_emit(obj, emission, source);
3334 * Add a callback for a signal emitted by widget edje object.
3336 * This function connects a callback function to a signal emitted by the
3337 * edje object of the obj.
3338 * Globs can occur in either the emission or source name.
3340 * @param obj The object
3341 * @param emission The signal's name.
3342 * @param source The signal's source.
3343 * @param func The callback function to be executed when the signal is
3345 * @param data A pointer to data to pass in to the callback function.
3349 elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
3351 EINA_SAFETY_ON_NULL_RETURN(obj);
3352 EINA_SAFETY_ON_NULL_RETURN(func);
3353 elm_widget_signal_callback_add(obj, emission, source, func, data);
3357 * Remove a signal-triggered callback from an widget edje object.
3359 * This function removes a callback, previoulsy attached to a signal emitted
3360 * by the edje object of the obj.
3361 * The parameters emission, source and func must match exactly those passed to
3362 * a previous call to elm_object_signal_callback_add(). The data pointer that
3363 * was passed to this call will be returned.
3365 * @param obj The object
3366 * @param emission The signal's name.
3367 * @param source The signal's source.
3368 * @param func The callback function to be executed when the signal is
3370 * @return The data pointer
3374 elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source))
3376 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3377 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
3378 return elm_widget_signal_callback_del(obj, emission, source, func);
3382 * Add a callback for a event emitted by widget or their children.
3384 * This function connects a callback function to any key_down key_up event
3385 * emitted by the @p obj or their children.
3386 * This only will be called if no other callback has consumed the event.
3387 * If you want consume the event, and no other get it, func should return
3388 * EINA_TRUE and put EVAS_EVENT_FLAG_ON_HOLD in event_flags.
3390 * @warning Accept duplicated callback addition.
3392 * @param obj The object
3393 * @param func The callback function to be executed when the event is
3395 * @param data Data to pass in to the callback function.
3399 elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data)
3401 EINA_SAFETY_ON_NULL_RETURN(obj);
3402 EINA_SAFETY_ON_NULL_RETURN(func);
3403 elm_widget_event_callback_add(obj, func, data);
3407 * Remove a event callback from an widget.
3409 * This function removes a callback, previoulsy attached to event emission
3411 * The parameters func and data must match exactly those passed to
3412 * a previous call to elm_object_event_callback_add(). The data pointer that
3413 * was passed to this call will be returned.
3415 * @param obj The object
3416 * @param func The callback function to be executed when the event is
3418 * @param data Data to pass in to the callback function.
3419 * @return The data pointer
3423 elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data)
3425 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3426 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
3427 return elm_widget_event_callback_del(obj, func, data);
3432 * @defgroup Debug Debug
3437 * Print Tree object hierarchy in stdout
3439 * @param obj The root object
3443 elm_object_tree_dump(const Evas_Object *top)
3446 elm_widget_tree_dump(top);
3454 * Print Elm Objects tree hierarchy in file as dot(graphviz) syntax.
3456 * @param obj The root object
3457 * @param file The path of output file
3461 elm_object_tree_dot_dump(const Evas_Object *top,
3465 FILE *f = fopen(file, "wb");
3466 elm_widget_tree_dot_dump(top, f);
3476 * Set the duration for occuring long press event.
3478 * @param lonpress_timeout Timeout for long press event
3479 * @ingroup Longpress
3482 elm_longpress_timeout_set(double longpress_timeout)
3484 _elm_config->longpress_timeout = longpress_timeout;
3488 * Get the duration for occuring long press event.
3490 * @return Timeout for long press event
3491 * @ingroup Longpress
3494 elm_longpress_timeout_get(void)
3496 return _elm_config->longpress_timeout;