2 # include "elementary_config.h"
9 #include <dlfcn.h> /* dlopen,dlclose,etc */
11 #ifdef HAVE_CRT_EXTERNS_H
12 # include <crt_externs.h>
19 #include <Elementary.h>
22 static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
23 EAPI Elm_Version *elm_version = &_version;
26 * @defgroup Start Getting Started
28 * To write an Elementary app, you can get started with the following:
31 * #include <Elementary.h>
32 * #ifndef ELM_LIB_QUICKLAUNCH
34 * elm_main(int argc, char **argv)
36 * // create window(s) here and do any application init
37 * elm_run(); // run main loop
38 * elm_shutdown(); // after mainloop finishes running, shutdown
39 * return 0; // exit 0 for exit code
45 * To take full advantage of the quicklaunch architecture for launching
46 * processes as quickly as possible (saving time at startup time like
47 * connecting to X11, loading and linking shared libraries) you may want to
48 * use the following configure.in/configure.ac and Makefile.am and autogen.sh
49 * script to generate your files. It is assumed your application uses the
50 * main.c file for its code.
52 * configure.in/configure.ac:
55 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
57 AC_CONFIG_SRCDIR(configure.in)
59 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
60 AM_CONFIG_HEADER(config.h)
70 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
71 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
74 PKG_CHECK_MODULES([ELEMENTARY], elementary)
82 AUTOMAKE_OPTIONS = 1.4 foreign
83 MAINTAINERCLEANFILES = Makefile.in
85 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
88 myapp_LTLIBRARIES = myapp.la
92 myapp_la_SOURCES = main.c
93 myapp_la_LIBADD = @ELEMENTARY_LIBS@
95 myapp_la_LDFLAGS = -module -avoid-version -no-undefined
97 myapp_SOURCES = main.c
98 myapp_LDADD = @ELEMENTARY_LIBS@
99 myapp_CFLAGS = -DELM_LIB_QUICKLAUNCH=1
106 rm -rf autom4te.cache
107 rm -f aclocal.m4 ltmain.sh
112 echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
113 echo "Running autoheader..." ; autoheader || exit 1
114 echo "Running autoconf..." ; autoconf || exit 1
115 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
116 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
118 if [ -z "$NOCONFIGURE" ]; then
123 * To gnerate all the things needed to bootstrap just run:
129 * This will generate Makefile.in's, the confgure script and everything else.
130 * After this it works like all normal autotools projects:
137 * Note sudo was assumed to get root permissions, as this would install in
138 * /usr/local which is system-owned. Ue any way you like to gain root, or
139 * specify a different prefix with configure:
142 ./confiugre --prefix=$HOME/mysoftware
145 * Also remember that autotools buys you some useful commands like:
150 * This uninstalls the software after it was installed with "make install".
151 * It is very useful to clear up what you built if you wish to clean the
158 * This firstly checks if your build tree is "clean" and ready for
159 * distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is
160 * ready to upload and distribute to the world, that contains the generated
161 * Makefile.in's and configure script. The users do not need to run
162 * autogen.sh - just configure and on. They don't need autotools installed.
163 * This tarball also builds cleanly, has all the sources it needs to build
164 * included (that is sources for your application, not libraries it depends
165 * on like Elementary). It builds cleanly in a buildroot and does not
166 * contain any files that are temporarily generated like binaries and other
167 * build-gnerated files, so the tarball is clean, and no need to worry
168 * about cleaning up your tree before packaging.
174 * This cleans up all build files (binaries, objects etc.) from the tree.
180 * This cleans out all files from the build and from configure's output too.
183 make maintainer-clean
186 * This deletes all the files autogen.sh will produce so the tree is clean
187 * to be put into a revision-control system (like CVS, SVN or GIT for example).
189 * The above will build a library - libmyapp.so and install in the target
190 * library directory (default is /usr/local/lib). You will also get a
191 * myapp.a and myapp.la - these are useless and can be deleted. Libtool likes
192 * to generate these all the time. You will also get a binary in the target
193 * binary directory (default is /usr/local/bin). This is a "debug binary".
194 * This will run and dlopen() the myapp.so and then jump to it's elm_main
195 * function. This allows for easy debugging with GDB and Valgrind. When you
196 * are ready to go to production do the following:
198 * 1. delete the myapp binary. i.e. rm /usr/local/bin/myapp
200 * 2. symlink the myapp binary to elementary_run (supplied by elementary).
201 * i.e. ln -s elmentary_run /usr/local/bin/myapp
203 * 3. run elementary_quicklaunch as part of your graphical login session and
206 * This will man elementary_quicklaunch does pre-initialization before the
207 * application needs to be run, saving the effort at the time the application
208 * is needed, thus speeding up the time it takes to appear.
210 * If you don't want to use the quicklaunch infrastructure (which is
211 * optional), you can execute the old fashioned way by just running the
212 * myapp binary loader than will load the myapp.so for you, or you can
213 * remove the split-file binary and put it into one binary as things always
214 * have been with the following configure.in/configure.ac and Makfile.am
217 * configure.in/configure.ac:
220 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
222 AC_CONFIG_SRCDIR(configure.in)
224 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
225 AM_CONFIG_HEADER(config.h)
234 PKG_CHECK_MODULES([ELEMENTARY], elementary)
242 AUTOMAKE_OPTIONS = 1.4 foreign
243 MAINTAINERCLEANFILES = Makefile.in
245 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
249 myapp_SOURCES = main.c
250 myapp_LDADD = @ELEMENTARY_LIBS@
254 * Notice that they are the same as before, just with libtool and library
255 * building sections removed. Both ways work for building elementary
256 * applications. It is up to you to decide what is best for you. If you just
257 * follow the template above, you can do it both ways and can decide at build
258 * time. The more advanced of you may suggest making it a configure option.
259 * That is perfectly valid, bu has been left out here for simplicity, as our
260 * aim to have an Elementary (and EFL) tutorial, not an autoconf & automake
265 static int _elm_signal_exit(void *data, int ev_type, void *ev);
267 char *_elm_appname = NULL;
268 const char *_elm_data_dir = NULL;
269 const char *_elm_lib_dir = NULL;
270 int _elm_log_dom = -1;
272 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
274 static int _elm_init_count = 0;
275 static int _elm_policies[ELM_POLICY_LAST];
276 static Ecore_Event_Handler *_elm_exit_handler = NULL;
279 _elm_signal_exit(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
288 edje_scale_set(_elm_config->scale);
297 buf = getenv("ELM_THEME");
298 if (buf != NULL && ((!strcmp(buf, "beat") || !strcmp(buf, "kessler"))))
299 setenv("ELM_MODULES","ctxpopup_copypasteUI>entry/api",1);
303 * @defgroup General General
307 * Inititalise Elementary
309 * This call is exported only for use by the ELM_MAIN() macro. There is no
310 * need to use this if you use this macro (which is highly advisable).
314 elm_init(int argc, char **argv)
317 if (_elm_init_count != 1) return;
319 elm_quicklaunch_init(argc, argv);
320 elm_quicklaunch_sub_init(argc, argv);
324 * Shut down Elementary
326 * This should be called at the end of your application just before it ceases
327 * to do any more processing. This will clean up any permanent resources your
328 * application may have allocated via Elementary that would otherwise persist
329 * on an exit without this call.
336 if (_elm_init_count != 0) return;
337 elm_quicklaunch_sub_shutdown();
338 elm_quicklaunch_shutdown();
342 static Eina_Bool _elm_need_e_dbus = EINA_FALSE;
345 elm_need_e_dbus(void)
348 if (_elm_need_e_dbus) return;
349 _elm_need_e_dbus = 1;
356 _elm_unneed_e_dbus(void)
359 if (_elm_need_e_dbus)
361 _elm_need_e_dbus = 0;
369 static Eina_Bool _elm_need_efreet = EINA_FALSE;
372 elm_need_efreet(void)
375 if (_elm_need_efreet) return;
376 _elm_need_efreet = 1;
384 list = efreet_icon_extra_list_get();
387 e_user_dir_concat_static(buf, "icons");
388 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
389 e_prefix_data_concat_static(buf, "data/icons");
390 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
398 _elm_unneed_efreet(void)
401 if (_elm_need_efreet)
403 _elm_need_efreet = 0;
404 efreet_trash_shutdown();
405 efreet_mime_shutdown();
412 elm_quicklaunch_init(int argc, char **argv)
414 char buf[PATH_MAX], *s;
417 _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
420 EINA_LOG_ERR("could not register elementary log domain.");
421 _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
426 ecore_app_args_set(argc, (const char **)argv);
428 memset(_elm_policies, 0, sizeof(_elm_policies));
429 if (ELM_EVENT_POLICY_CHANGED == 0)
430 ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
435 ecore_evas_init(); // FIXME: check errors
439 _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
441 if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
445 s = getenv("ELM_DATA_DIR");
446 _elm_data_dir = eina_stringshare_add(s);
450 s = getenv("ELM_PREFIX");
453 snprintf(buf, sizeof(buf), "%s/share/elementary", s);
454 _elm_data_dir = eina_stringshare_add(buf);
459 s = getenv("ELM_LIB_DIR");
460 _elm_lib_dir = eina_stringshare_add(s);
464 s = getenv("ELM_PREFIX");
467 snprintf(buf, sizeof(buf), "%s/lib", s);
468 _elm_lib_dir = eina_stringshare_add(buf);
472 if ((!_elm_data_dir) || (!_elm_lib_dir))
474 Dl_info elementary_dl;
475 // libelementary.so/../../share/elementary/
476 if (dladdr(elm_init, &elementary_dl))
480 dir = ecore_file_dir_get(elementary_dl.dli_fname);
485 if (ecore_file_is_dir(dir))
486 _elm_lib_dir = eina_stringshare_add(dir);
490 dir2 = ecore_file_dir_get(dir);
493 snprintf(buf, sizeof(buf), "%s/share/elementary", dir2);
494 if (ecore_file_is_dir(buf))
495 _elm_data_dir = eina_stringshare_add(buf);
505 _elm_data_dir = eina_stringshare_add(PACKAGE_DATA_DIR);
507 _elm_data_dir = eina_stringshare_add("/");
509 _elm_lib_dir = eina_stringshare_add(PACKAGE_LIB_DIR);
511 _elm_lib_dir = eina_stringshare_add("/");
517 elm_quicklaunch_sub_init(int argc, char **argv)
519 ecore_app_args_set(argc, (const char **)argv);
520 _elm_config_sub_init();
524 elm_quicklaunch_sub_shutdown(void)
527 if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
528 (_elm_config->engine == ELM_SOFTWARE_16_X11) ||
529 (_elm_config->engine == ELM_XRENDER_X11) ||
530 (_elm_config->engine == ELM_OPENGL_X11) ||
531 (_elm_config->engine == ELM_SOFTWARE_SDL) ||
532 (_elm_config->engine == ELM_SOFTWARE_16_SDL) ||
533 (_elm_config->engine == ELM_OPENGL_SDL) ||
534 (_elm_config->engine == ELM_SOFTWARE_WIN32) ||
535 (_elm_config->engine == ELM_SOFTWARE_16_WINCE))
537 #ifdef HAVE_ELEMENTARY_X
538 ecore_x_disconnect();
540 evas_cserve_disconnect();
545 elm_quicklaunch_shutdown(void)
547 eina_stringshare_del(_elm_data_dir);
548 _elm_data_dir = NULL;
549 eina_stringshare_del(_elm_lib_dir);
555 _elm_config_shutdown();
557 ecore_event_handler_del(_elm_exit_handler);
558 _elm_exit_handler = NULL;
560 _elm_theme_shutdown();
561 _elm_unneed_efreet();
562 _elm_unneed_e_dbus();
563 _elm_unneed_ethumb();
564 _elm_module_shutdown();
565 ecore_imf_shutdown();
566 ecore_evas_shutdown();
569 ecore_file_shutdown();
573 if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
575 eina_log_domain_unregister(_elm_log_dom);
583 elm_quicklaunch_seed(void)
585 Evas_Object *win, *bg, *bt;
587 win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
588 bg = elm_bg_add(win);
589 elm_win_resize_object_add(win, bg);
590 evas_object_show(bg);
591 bt = elm_button_add(win);
592 elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
593 elm_win_resize_object_add(win, bt);
594 ecore_main_loop_iterate();
595 evas_object_del(win);
596 ecore_main_loop_iterate();
597 if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
598 (_elm_config->engine == ELM_SOFTWARE_16_X11) ||
599 (_elm_config->engine == ELM_XRENDER_X11) ||
600 (_elm_config->engine == ELM_OPENGL_X11))
602 #ifdef HAVE_ELEMENTARY_X
606 ecore_main_loop_iterate();
609 static void *qr_handle = NULL;
610 static int (*qr_main) (int argc, char **argv) = NULL;
613 elm_quicklaunch_prepare(int argc __UNUSED__, char **argv)
616 char *exe = elm_quicklaunch_exe_path_get(argv[0]);
619 ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
627 exe2 = malloc(strlen(exe) + 1 + 10);
629 p = strrchr(exe2, '/');
632 exename = alloca(strlen(p) + 1);
635 strcat(p, "../lib/");
638 if (access(exe2, R_OK | X_OK) == 0)
646 qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
649 fprintf(stderr, "dlerr: %s\n", dlerror());
650 WRN("dlopen('%s') failed: %s", exe, dlerror());
654 INF("dlopen('%s') = %p", exe, qr_handle);
656 qr_main = dlsym(qr_handle, "elm_main");
657 INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
660 WRN("not quicklauncher capable: no elm_main in '%s'", exe);
676 extern char **environ;
681 for (i = 0, size = 0; environ[i] != NULL; i++)
682 size += strlen(environ[i]) + 1;
684 p = malloc((i + 1) * sizeof(char *));
689 for (i = 0; oldenv[i] != NULL; i++)
690 environ[i] = strdup(oldenv[i]);
696 elm_quicklaunch_fork(int argc, char **argv, char *cwd, void (postfork_func) (void *data), void *postfork_data)
705 // need to accept current environment from elementary_run
712 if (child > 0) return EINA_TRUE;
715 perror("could not fork");
720 perror("could not chdir");
721 args = alloca((argc + 1) * sizeof(char *));
722 for (i = 0; i < argc; i++) args[i] = argv[i];
724 WRN("%s not quicklaunch capable, fallback...", argv[0]);
725 execvp(argv[0], args);
726 ERR("failed to execute '%s': %s", argv[0], strerror(errno));
730 if (child > 0) return EINA_TRUE;
733 perror("could not fork");
736 if (postfork_func) postfork_func(postfork_data);
740 perror("could not chdir");
741 // FIXME: this is very linux specific. it changes argv[0] of the process
742 // so ps etc. report what you'd expect. for other unixes and os's this
749 ecore_app_args_get(&real_argc, &real_argv);
750 lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
751 for (p = real_argv[0]; p < lastarg; p++) *p = 0;
752 strcpy(real_argv[0], argv[0]);
754 ecore_app_args_set(argc, (const char **)argv);
755 ret = qr_main(argc, argv);
764 elm_quicklaunch_cleanup(void)
777 elm_quicklaunch_fallback(int argc, char **argv)
780 elm_quicklaunch_init(argc, argv);
781 elm_quicklaunch_sub_init(argc, argv);
782 elm_quicklaunch_prepare(argc, argv);
783 ret = qr_main(argc, argv);
789 elm_quicklaunch_exe_path_get(const char *exe)
791 static char *path = NULL;
792 static Eina_List *pathlist = NULL;
796 if (exe[0] == '/') return strdup(exe);
797 if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
798 if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
803 path = getenv("PATH");
804 buf2 = alloca(strlen(path) + 1);
809 if ((*p == ':') || (*p == 0))
814 strncpy(buf2, pp, len);
816 pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
828 EINA_LIST_FOREACH(pathlist, l, pathitr)
830 snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
831 if (access(buf, R_OK | X_OK) == 0) return strdup(buf);
839 * This call should be called just after all initialization is complete. This
840 * function will not return until elm_exit() is called. It will keep looping
841 * running the main event/processing loop for Elementary.
847 ecore_main_loop_begin();
853 * If this call is called, it will flag the main loop to cease processing and
854 * return back to its parent function.
860 ecore_main_loop_quit();
865 * Set new policy value.
867 * This will emit the ecore event ELM_EVENT_POLICY_CHANGED in the main
868 * loop giving the event information Elm_Event_Policy_Changed with
869 * policy identifier, new and old values.
871 * @param policy policy identifier as in Elm_Policy.
872 * @param value policy value, depends on identifiers, usually there is
873 * an enumeration with the same prefix as the policy name, for
874 * example: ELM_POLICY_QUIT and Elm_Policy_Quit
875 * (ELM_POLICY_QUIT_NONE, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED).
877 * @return @c EINA_TRUE on success or @c EINA_FALSE on error (right
878 * now just invalid policy identifier, but in future policy
879 * value might be enforced).
882 elm_policy_set(unsigned int policy, int value)
884 Elm_Event_Policy_Changed *ev;
886 if (policy >= ELM_POLICY_LAST)
889 if (value == _elm_policies[policy])
892 /* TODO: validade policy? */
894 ev = malloc(sizeof(*ev));
896 ev->new_value = value;
897 ev->old_value = _elm_policies[policy];
899 _elm_policies[policy] = value;
901 ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
907 * Gets the policy value set for given identifier.
909 * @param policy policy identifier as in Elm_Policy.
911 * @return policy value. Will be 0 if policy identifier is invalid.
914 elm_policy_get(unsigned int policy)
916 if (policy >= ELM_POLICY_LAST)
918 return _elm_policies[policy];
922 * Flush all caches & dump all data that can be to lean down to use less memory
930 EINA_LIST_FOREACH(_elm_win_list, l, obj)
932 Evas *e = evas_object_evas_get(obj);
933 edje_file_cache_flush();
934 edje_collection_cache_flush();
935 evas_image_cache_flush(e);
936 evas_font_cache_flush(e);
942 * @defgroup Scaling Selective Widget Scaling
944 * Different widgets can be scaled independently. These functions allow you to
945 * manipulate this scaling on a per-widget basis. The object and all its
946 * children get their scaling factors multiplied by the scale factor set.
947 * This is multiplicative, in that if a child also has a scale size set it is
948 * in turn multiplied by its parent's scale size. 1.0 means “don't scale”,
949 * 2.0 is double size, 0.5 is half etc.
953 * Set the scaling factor
955 * @param obj The object
956 * @param scale Scale factor (from 0.0 up, with 1.0 == no scaling)
960 elm_object_scale_set(Evas_Object *obj, double scale)
962 elm_widget_scale_set(obj, scale);
966 * Get the scaling factor
968 * @param obj The object
969 * @return The scaling factor set by elm_object_scale_set()
973 elm_object_scale_get(const Evas_Object *obj)
975 return elm_widget_scale_get(obj);
979 * @defgroup Styles Styles
981 * Widgets can have different styles of look. These generic API's set
982 * styles of widgets, if they support them (and if the theme(s) do).
988 * This sets the name of the style
989 * @param obj The object
990 * @param style The style name to use
994 elm_object_style_set(Evas_Object *obj, const char *style)
996 elm_widget_style_set(obj, style);
1002 * This gets the style being used for that widget. Note that the string
1003 * pointer is only valid as longas the object is valid and the style doesn't
1006 * @param obj The object
1007 * @return The style name
1011 elm_object_style_get(const Evas_Object *obj)
1013 return elm_widget_style_get(obj);
1017 * Set the disable state
1019 * This sets the disable state for the widget.
1021 * @param obj The object
1022 * @param disabled The state
1026 elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled)
1028 elm_widget_disabled_set(obj, disabled);
1032 * Get the disable state
1034 * This gets the disable state for the widget.
1036 * @param obj The object
1037 * @return True, if the widget is disabled
1041 elm_object_disabled_get(const Evas_Object *obj)
1043 return elm_widget_disabled_get(obj);
1047 * Get the global scaling factor
1049 * This gets the globally configured scaling factor that is applied to all
1052 * @return The scaling factor
1058 return _elm_config->scale;
1062 * Set the global scaling factor
1064 * This sets the globally configured scaling factor that is applied to all
1067 * @param scale The scaling factor to set
1071 elm_scale_set(double scale)
1073 if (_elm_config->scale == scale) return;
1074 _elm_config->scale = scale;
1079 * Set the global scaling factor for all applications on the display
1081 * This sets the globally configured scaling factor that is applied to all
1082 * objects for all applications.
1083 * @param scale The scaling factor to set
1087 elm_scale_all_set(double scale)
1089 #ifdef HAVE_ELEMENTARY_X
1090 static Ecore_X_Atom atom = 0;
1091 unsigned int scale_i = (unsigned int)(scale * 1000.0);
1093 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
1094 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1100 * @defgroup Fingers Fingers
1102 * Elementary is designed to be finger-friendly for touchscreens, and so in
1103 * addition to scaling for display resolution, it can also scale based on
1104 * finger "resolution" (or size).
1108 * Get the configured finger size
1110 * This gets the globally configured finger size in pixels
1112 * @return The finger size
1116 elm_finger_size_get(void)
1118 return _elm_config->finger_size;
1122 * Set the configured finger size
1124 * This sets the globally configured finger size in pixels
1126 * @param size The finger size
1130 elm_finger_size_set(Evas_Coord size)
1132 if (_elm_config->finger_size == size) return;
1133 _elm_config->finger_size = size;
1138 * Set the configured finger size for all applications on the display
1140 * This sets the globally configured finger size in pixels for all applications
1143 * @param size The finger size
1147 elm_finger_size_all_set(Evas_Coord size)
1149 #ifdef HAVE_ELEMENTARY_X
1150 static Ecore_X_Atom atom = 0;
1151 unsigned int size_i = (unsigned int)size;
1153 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
1154 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1160 * Adjust size of an element for finger usage
1162 * This takes width and height sizes (in pixels) as input and a size multiple
1163 * (which is how many fingers you want to place within the area), and adjusts
1164 * the size tobe large enough to accomodate finger. On return the w and h
1165 * sizes poiner do by these parameters will be modified.
1167 * @param times_w How many fingers should fit horizontally
1168 * @param w Pointer to the width size to adjust
1169 * @param times_h How many fingers should fit vertically
1170 * @param h Pointer to the height size to adjust
1174 elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h)
1176 if ((w) && (*w < (_elm_config->finger_size * times_w)))
1177 *w = _elm_config->finger_size * times_w;
1178 if ((h) && (*h < (_elm_config->finger_size * times_h)))
1179 *h = _elm_config->finger_size * times_h;
1183 * @defgroup Focus Focus
1185 * Objects have focus. This is what determines where the keyboard input goes to
1186 * within the application window.
1190 * Get the focus of the object
1192 * This gets the focused property of the object.
1194 * @param obj The object
1195 * @return 1 if the object is focused, 0 if not.
1199 elm_object_focus_get(Evas_Object *obj)
1201 return elm_widget_focus_get(obj);
1205 * Set the focus to the object
1207 * This sets the focus target for keyboard input to be the object indicated.
1209 * @param obj The object
1213 elm_object_focus(Evas_Object *obj)
1215 if (!elm_widget_can_focus_get(obj)) return;
1216 elm_widget_focus_steal(obj);
1220 * Remove the focus from the object
1222 * This removes the focus target for keyboard input from be the object
1225 * @param obj The object
1229 elm_object_unfocus(Evas_Object *obj)
1231 if (!elm_widget_can_focus_get(obj)) return;
1232 elm_widget_focused_object_clear(obj);
1236 * Set the ability for the object to focus
1238 * This sets the ability for the object to be able to get keyboard focus or
1239 * not. By default all objects are able to be focused.
1241 * @param obj The object
1242 * @param enable 1 if the object can be focused, 0 if not
1246 elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable)
1248 elm_widget_can_focus_set(obj, enable);
1252 * Get the ability for the object to focus
1254 * This gets the ability for the object to be able to get keyboard focus or
1255 * not. By default all objects are able to be focused.
1257 * @param obj The object
1258 * @return 1 if the object is allowed to be focused, 0 if not.
1262 elm_object_focus_allow_get(const Evas_Object *obj)
1264 return elm_widget_can_focus_get(obj);
1268 * @defgroup Scrollhints Scrollhints
1270 * Objects when inside a scroller can scroll, but this may not always be
1271 * desireable in certain situations. This allows an object to hint to itself
1272 * and parents to "not scroll" in one of 2 ways.
1274 * 1. To hold on scrolling. This means just flicking and dragging may no
1275 * longer scroll, but pressing/dragging near an edge of the scroller will
1276 * still scroll. This is automastically used by the entry object when
1278 * 2. To totally freeze scrolling. This means it stops. until popped/released.
1282 * Push the scroll hold by 1
1284 * This increments the scroll hold count by one. If it is more than 0 it will
1285 * take effect on the parents of the indicated object.
1287 * @param obj The object
1288 * @ingroup Scrollhints
1291 elm_object_scroll_hold_push(Evas_Object *obj)
1293 elm_widget_scroll_hold_push(obj);
1297 * Pop the scroll hold by 1
1299 * This decrements the scroll hold count by one. If it is more than 0 it will
1300 * take effect on the parents of the indicated object.
1302 * @param obj The object
1303 * @ingroup Scrollhints
1306 elm_object_scroll_hold_pop(Evas_Object *obj)
1308 elm_widget_scroll_hold_pop(obj);
1312 * Push the scroll freeze by 1
1314 * This increments the scroll freeze count by one. If it is more than 0 it will
1315 * take effect on the parents of the indicated object.
1317 * @param obj The object
1318 * @ingroup Scrollhints
1321 elm_object_scroll_freeze_push(Evas_Object *obj)
1323 elm_widget_scroll_freeze_push(obj);
1327 * Lock the scrolling of the given widget (and thus all parents)
1329 * This locks the given object from scrolling in the X axis (and implicitly
1330 * also locks all parent scrollers too from doing the same).
1332 * @param obj The object
1333 * @param lock The lock state (1 == locked, 0 == unlocked)
1334 * @ingroup Scrollhints
1337 elm_object_scroll_lock_x_set(Evas_Object *obj, Eina_Bool lock)
1339 elm_widget_drag_lock_x_set(obj, lock);
1343 * Lock the scrolling of the given widget (and thus all parents)
1345 * This locks the given object from scrolling in the Y axis (and implicitly
1346 * also locks all parent scrollers too from doing the same).
1348 * @param obj The object
1349 * @param lock The lock state (1 == locked, 0 == unlocked)
1350 * @ingroup Scrollhints
1353 elm_object_scroll_lock_y_set(Evas_Object *obj, Eina_Bool lock)
1355 elm_widget_drag_lock_y_set(obj, lock);
1359 * Get the scrolling lock of the given widget
1361 * This gets the lock for X axis scrolling.
1363 * @param obj The object
1364 * @ingroup Scrollhints
1367 elm_object_scroll_lock_x_get(const Evas_Object *obj)
1369 return elm_widget_drag_lock_x_get(obj);
1373 * Get the scrolling lock of the given widget
1375 * This gets the lock for X axis scrolling.
1377 * @param obj The object
1378 * @ingroup Scrollhints
1381 elm_object_scroll_lock_y_get(const Evas_Object *obj)
1383 return elm_widget_drag_lock_y_get(obj);
1387 * Pop the scroll freeze by 1
1389 * This decrements the scroll freeze count by one. If it is more than 0 it will
1390 * take effect on the parents of the indicated object.
1392 * @param obj The object
1393 * @ingroup Scrollhints
1396 elm_object_scroll_freeze_pop(Evas_Object *obj)
1398 elm_widget_scroll_freeze_pop(obj);
1403 * Check if the given Evas Object is an Elementary widget.
1405 * @param obj the object to query.
1406 * @return @c EINA_TRUE if it is an elementary widget variant,
1407 * @c EINA_FALSE otherwise
1410 elm_object_widget_check(const Evas_Object *obj)
1412 return elm_widget_is(obj);
1416 * Get the first parent of the given object that is an Elementary widget.
1418 * @param obj the object to query.
1419 * @return the parent object that is an Elementary widget, or @c NULL
1420 * if no parent is, or no parents at all.
1423 elm_object_parent_widget_get(const Evas_Object *obj)
1425 return elm_widget_parent_widget_get(obj);
1429 * Get the string that represents this Elementary widget.
1431 * @note Elementary is weird and exposes itself as a single
1432 * Evas_Object_Smart_Class of type "elm_widget", so
1433 * evas_object_type_get() always return that, making debug and
1434 * language bindings hard. This function tries to mitigate this
1435 * problem, but the solution is to change Elementary to use
1436 * proper inheritance.
1438 * @param obj the object to query.
1439 * @return Elementary widget name, or @c NULL if not a valid widget.
1442 elm_object_widget_type_get(const Evas_Object *obj)
1444 return elm_widget_type_get(obj);