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
29 * To write an Elementary app, you can get started with the following:
32 * #include <Elementary.h>
33 * #ifndef ELM_LIB_QUICKLAUNCH
35 * elm_main(int argc, char **argv)
37 * // create window(s) here and do any application init
38 * elm_run(); // run main loop
39 * elm_shutdown(); // after mainloop finishes running, shutdown
40 * return 0; // exit 0 for exit code
46 * To take full advantage of the quicklaunch architecture for launching
47 * processes as quickly as possible (saving time at startup time like
48 * connecting to X11, loading and linking shared libraries) you may want to
49 * use the following configure.in/configure.ac and Makefile.am and autogen.sh
50 * script to generate your files. It is assumed your application uses the
51 * main.c file for its code.
53 * configure.in/configure.ac:
56 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
58 AC_CONFIG_SRCDIR(configure.in)
60 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
61 AM_CONFIG_HEADER(config.h)
71 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
72 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
75 PKG_CHECK_MODULES([ELEMENTARY], elementary)
83 AUTOMAKE_OPTIONS = 1.4 foreign
84 MAINTAINERCLEANFILES = Makefile.in
86 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
89 myapp_LTLIBRARIES = myapp.la
93 myapp_la_SOURCES = main.c
94 myapp_la_LIBADD = @ELEMENTARY_LIBS@
96 myapp_la_LDFLAGS = -module -avoid-version -no-undefined
98 myapp_SOURCES = main.c
99 myapp_LDADD = @ELEMENTARY_LIBS@
100 myapp_CFLAGS = -DELM_LIB_QUICKLAUNCH=1
107 rm -rf autom4te.cache
108 rm -f aclocal.m4 ltmain.sh
113 echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
114 echo "Running autoheader..." ; autoheader || exit 1
115 echo "Running autoconf..." ; autoconf || exit 1
116 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
117 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
119 if [ -z "$NOCONFIGURE" ]; then
124 * To gnerate all the things needed to bootstrap just run:
130 * This will generate Makefile.in's, the confgure script and everything else.
131 * After this it works like all normal autotools projects:
138 * Note sudo was assumed to get root permissions, as this would install in
139 * /usr/local which is system-owned. Ue any way you like to gain root, or
140 * specify a different prefix with configure:
143 ./confiugre --prefix=$HOME/mysoftware
146 * Also remember that autotools buys you some useful commands like:
151 * This uninstalls the software after it was installed with "make install".
152 * It is very useful to clear up what you built if you wish to clean the
159 * This firstly checks if your build tree is "clean" and ready for
160 * distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is
161 * ready to upload and distribute to the world, that contains the generated
162 * Makefile.in's and configure script. The users do not need to run
163 * autogen.sh - just configure and on. They don't need autotools installed.
164 * This tarball also builds cleanly, has all the sources it needs to build
165 * included (that is sources for your application, not libraries it depends
166 * on like Elementary). It builds cleanly in a buildroot and does not
167 * contain any files that are temporarily generated like binaries and other
168 * build-gnerated files, so the tarball is clean, and no need to worry
169 * about cleaning up your tree before packaging.
175 * This cleans up all build files (binaries, objects etc.) from the tree.
181 * This cleans out all files from the build and from configure's output too.
184 make maintainer-clean
187 * This deletes all the files autogen.sh will produce so the tree is clean
188 * to be put into a revision-control system (like CVS, SVN or GIT for example).
190 * The above will build a library - libmyapp.so and install in the target
191 * library directory (default is /usr/local/lib). You will also get a
192 * myapp.a and myapp.la - these are useless and can be deleted. Libtool likes
193 * to generate these all the time. You will also get a binary in the target
194 * binary directory (default is /usr/local/bin). This is a "debug binary".
195 * This will run and dlopen() the myapp.so and then jump to it's elm_main
196 * function. This allows for easy debugging with GDB and Valgrind. When you
197 * are ready to go to production do the following:
199 * 1. delete the myapp binary. i.e. rm /usr/local/bin/myapp
201 * 2. symlink the myapp binary to elementary_run (supplied by elementary).
202 * i.e. ln -s elmentary_run /usr/local/bin/myapp
204 * 3. run elementary_quicklaunch as part of your graphical login session and
207 * This will man elementary_quicklaunch does pre-initialization before the
208 * application needs to be run, saving the effort at the time the application
209 * is needed, thus speeding up the time it takes to appear.
211 * If you don't want to use the quicklaunch infrastructure (which is
212 * optional), you can execute the old fashioned way by just running the
213 * myapp binary loader than will load the myapp.so for you, or you can
214 * remove the split-file binary and put it into one binary as things always
215 * have been with the following configure.in/configure.ac and Makfile.am
218 * configure.in/configure.ac:
221 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
223 AC_CONFIG_SRCDIR(configure.in)
225 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
226 AM_CONFIG_HEADER(config.h)
235 PKG_CHECK_MODULES([ELEMENTARY], elementary)
243 AUTOMAKE_OPTIONS = 1.4 foreign
244 MAINTAINERCLEANFILES = Makefile.in
246 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
250 myapp_SOURCES = main.c
251 myapp_LDADD = @ELEMENTARY_LIBS@
255 * Notice that they are the same as before, just with libtool and library
256 * building sections removed. Both ways work for building elementary
257 * applications. It is up to you to decide what is best for you. If you just
258 * follow the template above, you can do it both ways and can decide at build
259 * time. The more advanced of you may suggest making it a configure option.
260 * That is perfectly valid, bu has been left out here for simplicity, as our
261 * aim to have an Elementary (and EFL) tutorial, not an autoconf & automake
266 static int _elm_signal_exit(void *data, int ev_type, void *ev);
268 char *_elm_appname = NULL;
269 const char *_elm_data_dir = NULL;
270 const char *_elm_lib_dir = NULL;
271 int _elm_log_dom = -1;
273 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
275 static int _elm_init_count = 0;
276 static int _elm_policies[ELM_POLICY_LAST];
277 static Ecore_Event_Handler *_elm_exit_handler = NULL;
280 _elm_signal_exit(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
289 edje_scale_set(_elm_config->scale);
293 static Eina_List *widtypes = NULL;
296 _elm_widtype_register(const char **ptr)
298 widtypes = eina_list_append(widtypes, (void *)ptr);
302 _elm_widtype_clear(void)
306 EINA_LIST_FREE(widtypes, ptr)
308 eina_stringshare_del(*ptr);
318 buf = getenv("ELM_THEME");
319 if (buf != NULL && ((!strcmp(buf, "beat") || !strcmp(buf, "kessler"))))
320 setenv("ELM_MODULES","ctxpopup_copypasteUI>entry/api",1);
324 * @defgroup General General
325 * @ingroup Elementary
329 * Inititalise Elementary
331 * This call is exported only for use by the ELM_MAIN() macro. There is no
332 * need to use this if you use this macro (which is highly advisable).
336 elm_init(int argc, char **argv)
339 if (_elm_init_count != 1) return;
341 elm_quicklaunch_init(argc, argv);
342 elm_quicklaunch_sub_init(argc, argv);
346 * Shut down Elementary
348 * This should be called at the end of your application just before it ceases
349 * to do any more processing. This will clean up any permanent resources your
350 * application may have allocated via Elementary that would otherwise persist
351 * on an exit without this call.
358 if (_elm_init_count != 0) return;
359 elm_quicklaunch_sub_shutdown();
360 elm_quicklaunch_shutdown();
364 static Eina_Bool _elm_need_e_dbus = EINA_FALSE;
367 elm_need_e_dbus(void)
370 if (_elm_need_e_dbus) return;
371 _elm_need_e_dbus = 1;
378 _elm_unneed_e_dbus(void)
381 if (_elm_need_e_dbus)
383 _elm_need_e_dbus = 0;
391 static Eina_Bool _elm_need_efreet = EINA_FALSE;
394 elm_need_efreet(void)
397 if (_elm_need_efreet) return;
398 _elm_need_efreet = 1;
406 list = efreet_icon_extra_list_get();
409 e_user_dir_concat_static(buf, "icons");
410 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
411 e_prefix_data_concat_static(buf, "data/icons");
412 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
420 _elm_unneed_efreet(void)
423 if (_elm_need_efreet)
425 _elm_need_efreet = 0;
426 efreet_trash_shutdown();
427 efreet_mime_shutdown();
434 elm_quicklaunch_init(int argc, char **argv)
436 char buf[PATH_MAX], *s;
439 _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
442 EINA_LOG_ERR("could not register elementary log domain.");
443 _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
448 ecore_app_args_set(argc, (const char **)argv);
450 memset(_elm_policies, 0, sizeof(_elm_policies));
451 if (ELM_EVENT_POLICY_CHANGED == 0)
452 ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
457 ecore_evas_init(); // FIXME: check errors
461 _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
463 if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
467 s = getenv("ELM_DATA_DIR");
468 _elm_data_dir = eina_stringshare_add(s);
472 s = getenv("ELM_PREFIX");
475 snprintf(buf, sizeof(buf), "%s/share/elementary", s);
476 _elm_data_dir = eina_stringshare_add(buf);
481 s = getenv("ELM_LIB_DIR");
482 _elm_lib_dir = eina_stringshare_add(s);
486 s = getenv("ELM_PREFIX");
489 snprintf(buf, sizeof(buf), "%s/lib", s);
490 _elm_lib_dir = eina_stringshare_add(buf);
494 if ((!_elm_data_dir) || (!_elm_lib_dir))
496 Dl_info elementary_dl;
497 // libelementary.so/../../share/elementary/
498 if (dladdr(elm_init, &elementary_dl))
502 dir = ecore_file_dir_get(elementary_dl.dli_fname);
507 if (ecore_file_is_dir(dir))
508 _elm_lib_dir = eina_stringshare_add(dir);
512 dir2 = ecore_file_dir_get(dir);
515 snprintf(buf, sizeof(buf), "%s/share/elementary", dir2);
516 if (ecore_file_is_dir(buf))
517 _elm_data_dir = eina_stringshare_add(buf);
527 _elm_data_dir = eina_stringshare_add(PACKAGE_DATA_DIR);
529 _elm_data_dir = eina_stringshare_add("/");
531 _elm_lib_dir = eina_stringshare_add(PACKAGE_LIB_DIR);
533 _elm_lib_dir = eina_stringshare_add("/");
539 elm_quicklaunch_sub_init(int argc, char **argv)
541 ecore_app_args_set(argc, (const char **)argv);
542 _elm_config_sub_init();
546 elm_quicklaunch_sub_shutdown(void)
549 if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
550 (_elm_config->engine == ELM_SOFTWARE_16_X11) ||
551 (_elm_config->engine == ELM_XRENDER_X11) ||
552 (_elm_config->engine == ELM_OPENGL_X11) ||
553 (_elm_config->engine == ELM_SOFTWARE_SDL) ||
554 (_elm_config->engine == ELM_SOFTWARE_16_SDL) ||
555 (_elm_config->engine == ELM_OPENGL_SDL) ||
556 (_elm_config->engine == ELM_SOFTWARE_WIN32) ||
557 (_elm_config->engine == ELM_SOFTWARE_16_WINCE))
559 #ifdef HAVE_ELEMENTARY_X
560 ecore_x_disconnect();
562 evas_cserve_disconnect();
567 elm_quicklaunch_shutdown(void)
569 eina_stringshare_del(_elm_data_dir);
570 _elm_data_dir = NULL;
571 eina_stringshare_del(_elm_lib_dir);
577 _elm_config_shutdown();
579 ecore_event_handler_del(_elm_exit_handler);
580 _elm_exit_handler = NULL;
582 _elm_theme_shutdown();
583 _elm_unneed_efreet();
584 _elm_unneed_e_dbus();
585 _elm_unneed_ethumb();
586 _elm_module_shutdown();
587 ecore_imf_shutdown();
588 ecore_evas_shutdown();
591 ecore_file_shutdown();
595 if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
597 eina_log_domain_unregister(_elm_log_dom);
601 _elm_widtype_clear();
607 elm_quicklaunch_seed(void)
609 Evas_Object *win, *bg, *bt;
611 win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
612 bg = elm_bg_add(win);
613 elm_win_resize_object_add(win, bg);
614 evas_object_show(bg);
615 bt = elm_button_add(win);
616 elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
617 elm_win_resize_object_add(win, bt);
618 ecore_main_loop_iterate();
619 evas_object_del(win);
620 ecore_main_loop_iterate();
621 if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
622 (_elm_config->engine == ELM_SOFTWARE_16_X11) ||
623 (_elm_config->engine == ELM_XRENDER_X11) ||
624 (_elm_config->engine == ELM_OPENGL_X11))
626 #ifdef HAVE_ELEMENTARY_X
630 ecore_main_loop_iterate();
633 static void *qr_handle = NULL;
634 static int (*qr_main) (int argc, char **argv) = NULL;
637 elm_quicklaunch_prepare(int argc __UNUSED__, char **argv)
640 char *exe = elm_quicklaunch_exe_path_get(argv[0]);
643 ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
651 exe2 = malloc(strlen(exe) + 1 + 10);
653 p = strrchr(exe2, '/');
656 exename = alloca(strlen(p) + 1);
659 strcat(p, "../lib/");
662 if (access(exe2, R_OK | X_OK) == 0)
670 qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
673 fprintf(stderr, "dlerr: %s\n", dlerror());
674 WRN("dlopen('%s') failed: %s", exe, dlerror());
678 INF("dlopen('%s') = %p", exe, qr_handle);
680 qr_main = dlsym(qr_handle, "elm_main");
681 INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
684 WRN("not quicklauncher capable: no elm_main in '%s'", exe);
700 extern char **environ;
705 for (i = 0, size = 0; environ[i] != NULL; i++)
706 size += strlen(environ[i]) + 1;
708 p = malloc((i + 1) * sizeof(char *));
713 for (i = 0; oldenv[i] != NULL; i++)
714 environ[i] = strdup(oldenv[i]);
720 elm_quicklaunch_fork(int argc, char **argv, char *cwd, void (postfork_func) (void *data), void *postfork_data)
729 // need to accept current environment from elementary_run
736 if (child > 0) return EINA_TRUE;
739 perror("could not fork");
744 perror("could not chdir");
745 args = alloca((argc + 1) * sizeof(char *));
746 for (i = 0; i < argc; i++) args[i] = argv[i];
748 WRN("%s not quicklaunch capable, fallback...", argv[0]);
749 execvp(argv[0], args);
750 ERR("failed to execute '%s': %s", argv[0], strerror(errno));
754 if (child > 0) return EINA_TRUE;
757 perror("could not fork");
760 if (postfork_func) postfork_func(postfork_data);
764 perror("could not chdir");
765 // FIXME: this is very linux specific. it changes argv[0] of the process
766 // so ps etc. report what you'd expect. for other unixes and os's this
773 ecore_app_args_get(&real_argc, &real_argv);
774 lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
775 for (p = real_argv[0]; p < lastarg; p++) *p = 0;
776 strcpy(real_argv[0], argv[0]);
778 ecore_app_args_set(argc, (const char **)argv);
779 ret = qr_main(argc, argv);
788 elm_quicklaunch_cleanup(void)
801 elm_quicklaunch_fallback(int argc, char **argv)
804 elm_quicklaunch_init(argc, argv);
805 elm_quicklaunch_sub_init(argc, argv);
806 elm_quicklaunch_prepare(argc, argv);
807 ret = qr_main(argc, argv);
813 elm_quicklaunch_exe_path_get(const char *exe)
815 static char *path = NULL;
816 static Eina_List *pathlist = NULL;
820 if (exe[0] == '/') return strdup(exe);
821 if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
822 if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
827 path = getenv("PATH");
828 buf2 = alloca(strlen(path) + 1);
833 if ((*p == ':') || (*p == 0))
838 strncpy(buf2, pp, len);
840 pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
852 EINA_LIST_FOREACH(pathlist, l, pathitr)
854 snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
855 if (access(buf, R_OK | X_OK) == 0) return strdup(buf);
863 * This call should be called just after all initialization is complete. This
864 * function will not return until elm_exit() is called. It will keep looping
865 * running the main event/processing loop for Elementary.
871 ecore_main_loop_begin();
877 * If this call is called, it will flag the main loop to cease processing and
878 * return back to its parent function.
884 ecore_main_loop_quit();
889 * Set new policy value.
891 * This will emit the ecore event ELM_EVENT_POLICY_CHANGED in the main
892 * loop giving the event information Elm_Event_Policy_Changed with
893 * policy identifier, new and old values.
895 * @param policy policy identifier as in Elm_Policy.
896 * @param value policy value, depends on identifiers, usually there is
897 * an enumeration with the same prefix as the policy name, for
898 * example: ELM_POLICY_QUIT and Elm_Policy_Quit
899 * (ELM_POLICY_QUIT_NONE, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED).
901 * @return @c EINA_TRUE on success or @c EINA_FALSE on error (right
902 * now just invalid policy identifier, but in future policy
903 * value might be enforced).
906 elm_policy_set(unsigned int policy, int value)
908 Elm_Event_Policy_Changed *ev;
910 if (policy >= ELM_POLICY_LAST)
913 if (value == _elm_policies[policy])
916 /* TODO: validade policy? */
918 ev = malloc(sizeof(*ev));
920 ev->new_value = value;
921 ev->old_value = _elm_policies[policy];
923 _elm_policies[policy] = value;
925 ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
931 * Gets the policy value set for given identifier.
933 * @param policy policy identifier as in Elm_Policy.
935 * @return policy value. Will be 0 if policy identifier is invalid.
938 elm_policy_get(unsigned int policy)
940 if (policy >= ELM_POLICY_LAST)
942 return _elm_policies[policy];
946 * Flush all caches & dump all data that can be to lean down to use less memory
954 EINA_LIST_FOREACH(_elm_win_list, l, obj)
956 Evas *e = evas_object_evas_get(obj);
957 edje_file_cache_flush();
958 edje_collection_cache_flush();
959 evas_image_cache_flush(e);
960 evas_font_cache_flush(e);
966 * @defgroup Scaling Selective Widget Scaling
967 * @ingroup Elementary
969 * Different widgets can be scaled independently. These functions allow you to
970 * manipulate this scaling on a per-widget basis. The object and all its
971 * children get their scaling factors multiplied by the scale factor set.
972 * This is multiplicative, in that if a child also has a scale size set it is
973 * in turn multiplied by its parent's scale size. 1.0 means “don't scale”,
974 * 2.0 is double size, 0.5 is half etc.
978 * Set the scaling factor
980 * @param obj The object
981 * @param scale Scale factor (from 0.0 up, with 1.0 == no scaling)
985 elm_object_scale_set(Evas_Object *obj, double scale)
987 elm_widget_scale_set(obj, scale);
991 * Get the scaling factor
993 * @param obj The object
994 * @return The scaling factor set by elm_object_scale_set()
998 elm_object_scale_get(const Evas_Object *obj)
1000 return elm_widget_scale_get(obj);
1004 * @defgroup Styles Styles
1005 * @ingroup Elementary
1007 * Widgets can have different styles of look. These generic API's set
1008 * styles of widgets, if they support them (and if the theme(s) do).
1014 * This sets the name of the style
1015 * @param obj The object
1016 * @param style The style name to use
1020 elm_object_style_set(Evas_Object *obj, const char *style)
1022 elm_widget_style_set(obj, style);
1028 * This gets the style being used for that widget. Note that the string
1029 * pointer is only valid as longas the object is valid and the style doesn't
1032 * @param obj The object
1033 * @return The style name
1037 elm_object_style_get(const Evas_Object *obj)
1039 return elm_widget_style_get(obj);
1043 * Set the disable state
1045 * This sets the disable state for the widget.
1047 * @param obj The object
1048 * @param disabled The state
1052 elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled)
1054 elm_widget_disabled_set(obj, disabled);
1058 * Get the disable state
1060 * This gets the disable state for the widget.
1062 * @param obj The object
1063 * @return True, if the widget is disabled
1067 elm_object_disabled_get(const Evas_Object *obj)
1069 return elm_widget_disabled_get(obj);
1073 * Get the global scaling factor
1075 * This gets the globally configured scaling factor that is applied to all
1078 * @return The scaling factor
1084 return _elm_config->scale;
1088 * Set the global scaling factor
1090 * This sets the globally configured scaling factor that is applied to all
1093 * @param scale The scaling factor to set
1097 elm_scale_set(double scale)
1099 if (_elm_config->scale == scale) return;
1100 _elm_config->scale = scale;
1105 * Set the global scaling factor for all applications on the display
1107 * This sets the globally configured scaling factor that is applied to all
1108 * objects for all applications.
1109 * @param scale The scaling factor to set
1113 elm_scale_all_set(double scale)
1115 #ifdef HAVE_ELEMENTARY_X
1116 static Ecore_X_Atom atom = 0;
1117 unsigned int scale_i = (unsigned int)(scale * 1000.0);
1119 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
1120 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1126 * @defgroup Fingers Fingers
1127 * @ingroup Elementary
1129 * Elementary is designed to be finger-friendly for touchscreens, and so in
1130 * addition to scaling for display resolution, it can also scale based on
1131 * finger "resolution" (or size).
1135 * Get the configured finger size
1137 * This gets the globally configured finger size in pixels
1139 * @return The finger size
1143 elm_finger_size_get(void)
1145 return _elm_config->finger_size;
1149 * Set the configured finger size
1151 * This sets the globally configured finger size in pixels
1153 * @param size The finger size
1157 elm_finger_size_set(Evas_Coord size)
1159 if (_elm_config->finger_size == size) return;
1160 _elm_config->finger_size = size;
1165 * Set the configured finger size for all applications on the display
1167 * This sets the globally configured finger size in pixels for all applications
1170 * @param size The finger size
1174 elm_finger_size_all_set(Evas_Coord size)
1176 #ifdef HAVE_ELEMENTARY_X
1177 static Ecore_X_Atom atom = 0;
1178 unsigned int size_i = (unsigned int)size;
1180 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
1181 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1187 * Adjust size of an element for finger usage
1189 * This takes width and height sizes (in pixels) as input and a size multiple
1190 * (which is how many fingers you want to place within the area), and adjusts
1191 * the size tobe large enough to accomodate finger. On return the w and h
1192 * sizes poiner do by these parameters will be modified.
1194 * @param times_w How many fingers should fit horizontally
1195 * @param w Pointer to the width size to adjust
1196 * @param times_h How many fingers should fit vertically
1197 * @param h Pointer to the height size to adjust
1201 elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h)
1203 if ((w) && (*w < (_elm_config->finger_size * times_w)))
1204 *w = _elm_config->finger_size * times_w;
1205 if ((h) && (*h < (_elm_config->finger_size * times_h)))
1206 *h = _elm_config->finger_size * times_h;
1210 * @defgroup Focus Focus
1211 * @ingroup Elementary
1213 * Objects have focus. This is what determines where the keyboard input goes to
1214 * within the application window.
1218 * Get the focus of the object
1220 * This gets the focused property of the object.
1222 * @param obj The object
1223 * @return 1 if the object is focused, 0 if not.
1227 elm_object_focus_get(Evas_Object *obj)
1229 return elm_widget_focus_get(obj);
1233 * Set the focus to the object
1235 * This sets the focus target for keyboard input to be the object indicated.
1237 * @param obj The object
1241 elm_object_focus(Evas_Object *obj)
1243 if (!elm_widget_can_focus_get(obj)) return;
1244 elm_widget_focus_steal(obj);
1248 * Remove the focus from the object
1250 * This removes the focus target for keyboard input from be the object
1253 * @param obj The object
1257 elm_object_unfocus(Evas_Object *obj)
1259 if (!elm_widget_can_focus_get(obj)) return;
1260 elm_widget_focused_object_clear(obj);
1264 * Set the ability for the object to focus
1266 * This sets the ability for the object to be able to get keyboard focus or
1267 * not. By default all objects are able to be focused.
1269 * @param obj The object
1270 * @param enable 1 if the object can be focused, 0 if not
1274 elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable)
1276 elm_widget_can_focus_set(obj, enable);
1280 * Get the ability for the object to focus
1282 * This gets the ability for the object to be able to get keyboard focus or
1283 * not. By default all objects are able to be focused.
1285 * @param obj The object
1286 * @return 1 if the object is allowed to be focused, 0 if not.
1290 elm_object_focus_allow_get(const Evas_Object *obj)
1292 return elm_widget_can_focus_get(obj);
1296 * @defgroup Scrollhints Scrollhints
1297 * @ingroup Elementary
1299 * Objects when inside a scroller can scroll, but this may not always be
1300 * desireable in certain situations. This allows an object to hint to itself
1301 * and parents to "not scroll" in one of 2 ways.
1303 * 1. To hold on scrolling. This means just flicking and dragging may no
1304 * longer scroll, but pressing/dragging near an edge of the scroller will
1305 * still scroll. This is automastically used by the entry object when
1307 * 2. To totally freeze scrolling. This means it stops. until popped/released.
1311 * Push the scroll hold by 1
1313 * This increments the scroll hold count by one. If it is more than 0 it will
1314 * take effect on the parents of the indicated object.
1316 * @param obj The object
1317 * @ingroup Scrollhints
1320 elm_object_scroll_hold_push(Evas_Object *obj)
1322 elm_widget_scroll_hold_push(obj);
1326 * Pop the scroll hold by 1
1328 * This decrements the scroll hold count by one. If it is more than 0 it will
1329 * take effect on the parents of the indicated object.
1331 * @param obj The object
1332 * @ingroup Scrollhints
1335 elm_object_scroll_hold_pop(Evas_Object *obj)
1337 elm_widget_scroll_hold_pop(obj);
1341 * Push the scroll freeze by 1
1343 * This increments the scroll freeze count by one. If it is more than 0 it will
1344 * take effect on the parents of the indicated object.
1346 * @param obj The object
1347 * @ingroup Scrollhints
1350 elm_object_scroll_freeze_push(Evas_Object *obj)
1352 elm_widget_scroll_freeze_push(obj);
1356 * Lock the scrolling of the given widget (and thus all parents)
1358 * This locks the given object from scrolling in the X axis (and implicitly
1359 * also locks all parent scrollers too from doing the same).
1361 * @param obj The object
1362 * @param lock The lock state (1 == locked, 0 == unlocked)
1363 * @ingroup Scrollhints
1366 elm_object_scroll_lock_x_set(Evas_Object *obj, Eina_Bool lock)
1368 elm_widget_drag_lock_x_set(obj, lock);
1372 * Lock the scrolling of the given widget (and thus all parents)
1374 * This locks the given object from scrolling in the Y axis (and implicitly
1375 * also locks all parent scrollers too from doing the same).
1377 * @param obj The object
1378 * @param lock The lock state (1 == locked, 0 == unlocked)
1379 * @ingroup Scrollhints
1382 elm_object_scroll_lock_y_set(Evas_Object *obj, Eina_Bool lock)
1384 elm_widget_drag_lock_y_set(obj, lock);
1388 * Get the scrolling lock of the given widget
1390 * This gets the lock for X axis scrolling.
1392 * @param obj The object
1393 * @ingroup Scrollhints
1396 elm_object_scroll_lock_x_get(const Evas_Object *obj)
1398 return elm_widget_drag_lock_x_get(obj);
1402 * Get the scrolling lock of the given widget
1404 * This gets the lock for X axis scrolling.
1406 * @param obj The object
1407 * @ingroup Scrollhints
1410 elm_object_scroll_lock_y_get(const Evas_Object *obj)
1412 return elm_widget_drag_lock_y_get(obj);
1416 * Pop the scroll freeze by 1
1418 * This decrements the scroll freeze count by one. If it is more than 0 it will
1419 * take effect on the parents of the indicated object.
1421 * @param obj The object
1422 * @ingroup Scrollhints
1425 elm_object_scroll_freeze_pop(Evas_Object *obj)
1427 elm_widget_scroll_freeze_pop(obj);
1432 * Check if the given Evas Object is an Elementary widget.
1434 * @param obj the object to query.
1435 * @return @c EINA_TRUE if it is an elementary widget variant,
1436 * @c EINA_FALSE otherwise
1439 elm_object_widget_check(const Evas_Object *obj)
1441 return elm_widget_is(obj);
1445 * Get the first parent of the given object that is an Elementary widget.
1447 * @param obj the object to query.
1448 * @return the parent object that is an Elementary widget, or @c NULL
1449 * if no parent is, or no parents at all.
1452 elm_object_parent_widget_get(const Evas_Object *obj)
1454 return elm_widget_parent_widget_get(obj);
1458 * Get the string that represents this Elementary widget.
1460 * @note Elementary is weird and exposes itself as a single
1461 * Evas_Object_Smart_Class of type "elm_widget", so
1462 * evas_object_type_get() always return that, making debug and
1463 * language bindings hard. This function tries to mitigate this
1464 * problem, but the solution is to change Elementary to use
1465 * proper inheritance.
1467 * @param obj the object to query.
1468 * @return Elementary widget name, or @c NULL if not a valid widget.
1471 elm_object_widget_type_get(const Evas_Object *obj)
1473 return elm_widget_type_get(obj);