2010-03-06 08:46:08 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2009-01-13 01:20:53 -08:00
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
# define _GNU_SOURCE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <dlfcn.h> /* dlopen,dlclose,etc */
|
|
|
|
|
2010-03-06 08:46:08 -08:00
|
|
|
#ifdef HAVE_CRT_EXTERNS_H
|
|
|
|
# include <crt_externs.h>
|
2008-12-18 16:34:56 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_EVIL
|
|
|
|
# include <Evil.h>
|
|
|
|
#endif
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
2010-05-29 02:48:05 -07:00
|
|
|
static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
|
|
|
|
EAPI Elm_Version *elm_version = &_version;
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* @defgroup Start Getting Started
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* To write an Elementary app, you can get started with the following:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* @code
|
|
|
|
* #include <Elementary.h>
|
|
|
|
* #ifndef ELM_LIB_QUICKLAUNCH
|
|
|
|
* EAPI int
|
|
|
|
* elm_main(int argc, char **argv)
|
|
|
|
* {
|
|
|
|
* // create window(s) here and do any application init
|
|
|
|
* elm_run(); // run main loop
|
|
|
|
* elm_shutdown(); // after mainloop finishes running, shutdown
|
|
|
|
* return 0; // exit 0 for exit code
|
|
|
|
* }
|
|
|
|
* #endif
|
|
|
|
* ELM_MAIN()
|
|
|
|
* @endcode
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 07:05:43 -07:00
|
|
|
* To take full advantage of the quicklaunch architecture for launching
|
|
|
|
* processes as quickly as possible (saving time at startup time like
|
|
|
|
* connecting to X11, loading and linking shared libraries) you may want to
|
|
|
|
* use the following configure.in/configure.ac and Makefile.am and autogen.sh
|
|
|
|
* script to generate your files. It is assumed your application uses the
|
|
|
|
* main.c file for its code.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* configure.in/configure.ac:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
@verbatim
|
|
|
|
AC_INIT(myapp, 0.0.0, myname@mydomain.com)
|
|
|
|
AC_PREREQ(2.52)
|
|
|
|
AC_CONFIG_SRCDIR(configure.in)
|
|
|
|
|
|
|
|
AM_INIT_AUTOMAKE(1.6 dist-bzip2)
|
|
|
|
AM_CONFIG_HEADER(config.h)
|
|
|
|
|
|
|
|
AC_C_BIGENDIAN
|
|
|
|
AC_ISC_POSIX
|
|
|
|
AC_PROG_CC
|
|
|
|
AM_PROG_CC_STDC
|
|
|
|
AC_HEADER_STDC
|
|
|
|
AC_C_CONST
|
|
|
|
|
|
|
|
AC_LIBTOOL_WIN32_DLL
|
|
|
|
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
|
|
|
|
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
|
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
|
|
|
|
PKG_CHECK_MODULES([ELEMENTARY], elementary)
|
|
|
|
|
|
|
|
AC_OUTPUT(Makefile)
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* Makefile.am:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
@verbatim
|
|
|
|
AUTOMAKE_OPTIONS = 1.4 foreign
|
|
|
|
MAINTAINERCLEANFILES = Makefile.in
|
|
|
|
|
|
|
|
INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
|
|
|
|
|
|
|
|
bin_PROGRAMS = myapp
|
|
|
|
myapp_LTLIBRARIES = myapp.la
|
|
|
|
|
|
|
|
myappdir = $(libdir)
|
|
|
|
|
|
|
|
myapp_la_SOURCES = main.c
|
|
|
|
myapp_la_LIBADD = @ELEMENTARY_LIBS@
|
|
|
|
myapp_la_CFLAGS =
|
|
|
|
myapp_la_LDFLAGS = -module -avoid-version -no-undefined
|
|
|
|
|
|
|
|
myapp_SOURCES = main.c
|
|
|
|
myapp_LDADD = @ELEMENTARY_LIBS@
|
|
|
|
myapp_CFLAGS = -DELM_LIB_QUICKLAUNCH=1
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* autogen.sh:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
@verbatim
|
|
|
|
#!/bin/sh
|
|
|
|
rm -rf autom4te.cache
|
|
|
|
rm -f aclocal.m4 ltmain.sh
|
|
|
|
rm -rf m4
|
|
|
|
mkdir m4
|
|
|
|
|
|
|
|
touch README
|
|
|
|
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
|
|
|
|
echo "Running autoheader..." ; autoheader || exit 1
|
|
|
|
echo "Running autoconf..." ; autoconf || exit 1
|
|
|
|
echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
|
|
|
|
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
|
|
|
|
|
|
|
|
if [ -z "$NOCONFIGURE" ]; then
|
|
|
|
./configure "$@"
|
|
|
|
fi
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* To gnerate all the things needed to bootstrap just run:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
@verbatim
|
|
|
|
./autogen.sh
|
|
|
|
@endverbatim
|
|
|
|
*
|
|
|
|
* This will generate Makefile.in's, the confgure script and everything else.
|
|
|
|
* After this it works like all normal autotools projects:
|
|
|
|
@verbatim
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
sudo make install
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* Note sudo was assumed to get root permissions, as this would install in
|
|
|
|
* /usr/local which is system-owned. Ue any way you like to gain root, or
|
|
|
|
* specify a different prefix with configure:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
@verbatim
|
|
|
|
./confiugre --prefix=$HOME/mysoftware
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* Also remember that autotools buys you some useful commands like:
|
|
|
|
@verbatim
|
|
|
|
make uninstall
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* This uninstalls the software after it was installed with "make install".
|
|
|
|
* It is very useful to clear up what you built if you wish to clean the
|
|
|
|
* system.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
@verbatim
|
|
|
|
make distcheck
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* This firstly checks if your build tree is "clean" and ready for
|
|
|
|
* distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is
|
|
|
|
* ready to upload and distribute to the world, that contains the generated
|
|
|
|
* Makefile.in's and configure script. The users do not need to run
|
|
|
|
* autogen.sh - just configure and on. They don't need autotools installed.
|
|
|
|
* This tarball also builds cleanly, has all the sources it needs to build
|
|
|
|
* included (that is sources for your application, not libraries it depends
|
|
|
|
* on like Elementary). It builds cleanly in a buildroot and does not
|
|
|
|
* contain any files that are temporarily generated like binaries and other
|
|
|
|
* build-gnerated files, so the tarball is clean, and no need to worry
|
|
|
|
* about cleaning up your tree before packaging.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
@verbatim
|
|
|
|
make clean
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* This cleans up all build files (binaries, objects etc.) from the tree.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
@verbatim
|
|
|
|
make distclean
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* This cleans out all files from the build and from configure's output too.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
@verbatim
|
|
|
|
make maintainer-clean
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* This deletes all the files autogen.sh will produce so the tree is clean
|
|
|
|
* to be put into a revision-control system (like CVS, SVN or GIT for example).
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 07:05:43 -07:00
|
|
|
* The above will build a library - libmyapp.so and install in the target
|
|
|
|
* library directory (default is /usr/local/lib). You will also get a
|
|
|
|
* myapp.a and myapp.la - these are useless and can be deleted. Libtool likes
|
|
|
|
* to generate these all the time. You will also get a binary in the target
|
|
|
|
* binary directory (default is /usr/local/bin). This is a "debug binary".
|
|
|
|
* This will run and dlopen() the myapp.so and then jump to it's elm_main
|
|
|
|
* function. This allows for easy debugging with GDB and Valgrind. When you
|
|
|
|
* are ready to go to production do the following:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* 1. delete the myapp binary. i.e. rm /usr/local/bin/myapp
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 07:05:43 -07:00
|
|
|
* 2. symlink the myapp binary to elementary_run (supplied by elementary).
|
|
|
|
* i.e. ln -s elmentary_run /usr/local/bin/myapp
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 07:05:43 -07:00
|
|
|
* 3. run elementary_quicklaunch as part of your graphical login session and
|
|
|
|
* keep it running.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 07:05:43 -07:00
|
|
|
* This will man elementary_quicklaunch does pre-initialization before the
|
|
|
|
* application needs to be run, saving the effort at the time the application
|
|
|
|
* is needed, thus speeding up the time it takes to appear.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 07:05:43 -07:00
|
|
|
* If you don't want to use the quicklaunch infrastructure (which is
|
|
|
|
* optional), you can execute the old fashioned way by just running the
|
|
|
|
* myapp binary loader than will load the myapp.so for you, or you can
|
|
|
|
* remove the split-file binary and put it into one binary as things always
|
|
|
|
* have been with the following configure.in/configure.ac and Makfile.am
|
|
|
|
* files:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* configure.in/configure.ac:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
@verbatim
|
|
|
|
AC_INIT(myapp, 0.0.0, myname@mydomain.com)
|
|
|
|
AC_PREREQ(2.52)
|
|
|
|
AC_CONFIG_SRCDIR(configure.in)
|
|
|
|
|
|
|
|
AM_INIT_AUTOMAKE(1.6 dist-bzip2)
|
|
|
|
AM_CONFIG_HEADER(config.h)
|
|
|
|
|
|
|
|
AC_C_BIGENDIAN
|
|
|
|
AC_ISC_POSIX
|
|
|
|
AC_PROG_CC
|
|
|
|
AM_PROG_CC_STDC
|
|
|
|
AC_HEADER_STDC
|
|
|
|
AC_C_CONST
|
|
|
|
|
|
|
|
PKG_CHECK_MODULES([ELEMENTARY], elementary)
|
|
|
|
|
|
|
|
AC_OUTPUT(Makefile)
|
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* Makefile.am:
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
@verbatim
|
|
|
|
AUTOMAKE_OPTIONS = 1.4 foreign
|
|
|
|
MAINTAINERCLEANFILES = Makefile.in
|
|
|
|
|
|
|
|
INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
|
|
|
|
|
|
|
|
bin_PROGRAMS = myapp
|
|
|
|
|
|
|
|
myapp_SOURCES = main.c
|
|
|
|
myapp_LDADD = @ELEMENTARY_LIBS@
|
2009-07-06 23:46:51 -07:00
|
|
|
myapp_CFLAGS =
|
2009-05-19 06:50:06 -07:00
|
|
|
@endverbatim
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* Notice that they are the same as before, just with libtool and library
|
2009-05-19 07:05:43 -07:00
|
|
|
* building sections removed. Both ways work for building elementary
|
|
|
|
* applications. It is up to you to decide what is best for you. If you just
|
|
|
|
* follow the template above, you can do it both ways and can decide at build
|
|
|
|
* time. The more advanced of you may suggest making it a configure option.
|
2009-05-22 14:01:46 -07:00
|
|
|
* That is perfectly valid, bu has been left out here for simplicity, as our
|
2009-05-19 07:05:43 -07:00
|
|
|
* aim to have an Elementary (and EFL) tutorial, not an autoconf & automake
|
|
|
|
* document.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
*/
|
2009-01-13 01:20:53 -08:00
|
|
|
|
2008-11-14 22:09:04 -08:00
|
|
|
static int _elm_signal_exit(void *data, int ev_type, void *ev);
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
char *_elm_appname = NULL;
|
2009-01-13 01:20:53 -08:00
|
|
|
const char *_elm_data_dir = NULL;
|
2009-09-28 21:35:35 -07:00
|
|
|
const char *_elm_lib_dir = NULL;
|
2009-09-11 07:21:58 -07:00
|
|
|
int _elm_log_dom = -1;
|
2009-01-13 01:20:53 -08:00
|
|
|
|
2009-12-01 05:32:48 -08:00
|
|
|
EAPI int ELM_EVENT_POLICY_CHANGED = 0;
|
|
|
|
|
2010-03-26 18:24:21 -07:00
|
|
|
static int _elm_init_count = 0;
|
2009-12-01 05:32:48 -08:00
|
|
|
static int _elm_policies[ELM_POLICY_LAST];
|
2009-02-25 03:00:07 -08:00
|
|
|
static Ecore_Event_Handler *_elm_exit_handler = NULL;
|
2008-12-09 22:43:21 -08:00
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
static int
|
2010-03-09 09:51:30 -08:00
|
|
|
_elm_signal_exit(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
|
|
|
elm_exit();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-05-07 08:49:06 -07:00
|
|
|
void
|
2008-11-14 22:09:04 -08:00
|
|
|
_elm_rescale(void)
|
|
|
|
{
|
|
|
|
edje_scale_set(_elm_config->scale);
|
|
|
|
_elm_win_rescale();
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* @defgroup General General
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inititalise Elementary
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
|
|
|
* This call is exported only for use by the ELM_MAIN() macro. There is no
|
2009-05-19 06:50:06 -07:00
|
|
|
* need to use this if you use this macro (which is highly advisable).
|
|
|
|
* @ingroup General
|
|
|
|
*/
|
2008-09-29 23:58:56 -07:00
|
|
|
EAPI void
|
|
|
|
elm_init(int argc, char **argv)
|
2009-02-25 03:00:07 -08:00
|
|
|
{
|
2010-03-26 18:24:21 -07:00
|
|
|
_elm_init_count++;
|
|
|
|
if (_elm_init_count != 1) return;
|
2009-02-25 03:00:07 -08:00
|
|
|
elm_quicklaunch_init(argc, argv);
|
|
|
|
elm_quicklaunch_sub_init(argc, argv);
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* Shut down Elementary
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This should be called at the end of your application just before it ceases
|
|
|
|
* to do any more processing. This will clean up any permanent resources your
|
|
|
|
* application may have allocated via Elementary that would otherwise persist
|
|
|
|
* on an exit without this call.
|
|
|
|
* @ingroup General
|
|
|
|
*/
|
2009-02-25 03:00:07 -08:00
|
|
|
EAPI void
|
|
|
|
elm_shutdown(void)
|
|
|
|
{
|
2010-03-26 18:24:21 -07:00
|
|
|
_elm_init_count--;
|
|
|
|
if (_elm_init_count != 0) return;
|
2009-02-25 03:00:07 -08:00
|
|
|
elm_quicklaunch_sub_shutdown();
|
|
|
|
elm_quicklaunch_shutdown();
|
|
|
|
}
|
|
|
|
|
2009-09-12 02:37:29 -07:00
|
|
|
#ifdef ELM_EDBUS
|
2010-06-05 06:12:45 -07:00
|
|
|
static Eina_Bool _elm_need_e_dbus = EINA_FALSE;
|
2009-09-12 02:37:29 -07:00
|
|
|
#endif
|
|
|
|
EAPI void
|
|
|
|
elm_need_e_dbus(void)
|
|
|
|
{
|
|
|
|
#ifdef ELM_EDBUS
|
|
|
|
if (_elm_need_e_dbus) return;
|
|
|
|
_elm_need_e_dbus = 1;
|
|
|
|
e_dbus_init();
|
2009-09-22 17:16:52 -07:00
|
|
|
e_hal_init();
|
2009-09-12 02:37:29 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_unneed_e_dbus(void)
|
|
|
|
{
|
|
|
|
#ifdef ELM_EDBUS
|
|
|
|
if (_elm_need_e_dbus)
|
|
|
|
{
|
|
|
|
_elm_need_e_dbus = 0;
|
2009-09-22 17:16:52 -07:00
|
|
|
e_hal_shutdown();
|
2009-09-12 02:37:29 -07:00
|
|
|
e_dbus_shutdown();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef ELM_EFREET
|
2010-06-05 06:12:45 -07:00
|
|
|
static Eina_Bool _elm_need_efreet = EINA_FALSE;
|
2009-09-12 02:37:29 -07:00
|
|
|
#endif
|
|
|
|
EAPI void
|
|
|
|
elm_need_efreet(void)
|
|
|
|
{
|
|
|
|
#ifdef ELM_EFREET
|
|
|
|
if (_elm_need_efreet) return;
|
|
|
|
_elm_need_efreet = 1;
|
|
|
|
efreet_init();
|
|
|
|
efreet_mime_init();
|
|
|
|
efreet_trash_init();
|
|
|
|
/*
|
|
|
|
{
|
|
|
|
Eina_List **list;
|
|
|
|
|
|
|
|
list = efreet_icon_extra_list_get();
|
|
|
|
if (list)
|
|
|
|
{
|
|
|
|
e_user_dir_concat_static(buf, "icons");
|
|
|
|
*list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
|
|
|
|
e_prefix_data_concat_static(buf, "data/icons");
|
|
|
|
*list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_unneed_efreet(void)
|
|
|
|
{
|
2009-10-08 02:31:15 -07:00
|
|
|
#ifdef ELM_EFREET
|
2009-09-12 02:37:29 -07:00
|
|
|
if (_elm_need_efreet)
|
|
|
|
{
|
|
|
|
_elm_need_efreet = 0;
|
|
|
|
efreet_trash_shutdown();
|
|
|
|
efreet_mime_shutdown();
|
|
|
|
efreet_shutdown();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-02-25 03:00:07 -08:00
|
|
|
EAPI void
|
|
|
|
elm_quicklaunch_init(int argc, char **argv)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2009-11-14 17:52:25 -08:00
|
|
|
char buf[PATH_MAX], *s;
|
2010-01-18 01:38:52 -08:00
|
|
|
|
2009-09-11 07:21:58 -07:00
|
|
|
eina_init();
|
|
|
|
_elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
|
|
|
|
if (!_elm_log_dom)
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("could not register elementary log domain.");
|
|
|
|
_elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
|
|
|
|
}
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
eet_init();
|
2009-07-06 23:46:51 -07:00
|
|
|
ecore_init();
|
2008-09-29 23:58:56 -07:00
|
|
|
ecore_app_args_set(argc, (const char **)argv);
|
2009-12-01 05:32:48 -08:00
|
|
|
|
|
|
|
memset(_elm_policies, 0, sizeof(_elm_policies));
|
|
|
|
if (ELM_EVENT_POLICY_CHANGED == 0)
|
|
|
|
ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
ecore_file_init();
|
|
|
|
evas_init();
|
|
|
|
edje_init();
|
|
|
|
ecore_evas_init(); // FIXME: check errors
|
2010-06-03 22:14:35 -07:00
|
|
|
ecore_imf_init();
|
2009-09-28 21:35:35 -07:00
|
|
|
_elm_module_init();
|
2009-11-14 17:52:25 -08:00
|
|
|
|
2009-02-25 03:00:07 -08:00
|
|
|
_elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2010-03-26 18:19:05 -07:00
|
|
|
if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
|
2008-09-29 23:58:56 -07:00
|
|
|
|
2009-01-13 01:20:53 -08:00
|
|
|
if (!_elm_data_dir)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
s = getenv("ELM_DATA_DIR");
|
|
|
|
_elm_data_dir = eina_stringshare_add(s);
|
2009-01-13 01:20:53 -08:00
|
|
|
}
|
|
|
|
if (!_elm_data_dir)
|
2009-07-06 23:46:51 -07:00
|
|
|
{
|
|
|
|
s = getenv("ELM_PREFIX");
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "%s/share/elementary", s);
|
|
|
|
_elm_data_dir = eina_stringshare_add(buf);
|
|
|
|
}
|
2009-01-13 01:20:53 -08:00
|
|
|
}
|
2009-09-28 21:35:35 -07:00
|
|
|
if (!_elm_lib_dir)
|
|
|
|
{
|
|
|
|
s = getenv("ELM_LIB_DIR");
|
|
|
|
_elm_lib_dir = eina_stringshare_add(s);
|
|
|
|
}
|
|
|
|
if (!_elm_lib_dir)
|
|
|
|
{
|
|
|
|
s = getenv("ELM_PREFIX");
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "%s/lib", s);
|
|
|
|
_elm_lib_dir = eina_stringshare_add(buf);
|
|
|
|
}
|
|
|
|
}
|
2009-01-13 01:20:53 -08:00
|
|
|
#ifdef HAVE_DLADDR
|
2009-09-28 21:35:35 -07:00
|
|
|
if ((!_elm_data_dir) || (!_elm_lib_dir))
|
2009-01-13 01:20:53 -08:00
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
Dl_info elementary_dl;
|
|
|
|
// libelementary.so/../../share/elementary/
|
|
|
|
if (dladdr(elm_init, &elementary_dl))
|
|
|
|
{
|
|
|
|
char *dir, *dir2;
|
|
|
|
|
|
|
|
dir = ecore_file_dir_get(elementary_dl.dli_fname);
|
|
|
|
if (dir)
|
|
|
|
{
|
2009-09-28 21:35:35 -07:00
|
|
|
if (!_elm_lib_dir)
|
|
|
|
{
|
|
|
|
if (ecore_file_is_dir(dir))
|
|
|
|
_elm_lib_dir = eina_stringshare_add(dir);
|
|
|
|
}
|
|
|
|
if (!_elm_data_dir)
|
|
|
|
{
|
|
|
|
dir2 = ecore_file_dir_get(dir);
|
|
|
|
if (dir2)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "%s/share/elementary", dir2);
|
|
|
|
if (ecore_file_is_dir(buf))
|
|
|
|
_elm_data_dir = eina_stringshare_add(buf);
|
|
|
|
free(dir2);
|
|
|
|
}
|
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
free(dir);
|
|
|
|
}
|
|
|
|
}
|
2009-01-13 01:20:53 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (!_elm_data_dir)
|
2009-09-28 21:35:35 -07:00
|
|
|
_elm_data_dir = eina_stringshare_add(PACKAGE_DATA_DIR);
|
2010-01-18 01:38:52 -08:00
|
|
|
if (!_elm_data_dir)
|
2009-09-28 21:35:35 -07:00
|
|
|
_elm_data_dir = eina_stringshare_add("/");
|
|
|
|
if (!_elm_lib_dir)
|
|
|
|
_elm_lib_dir = eina_stringshare_add(PACKAGE_LIB_DIR);
|
|
|
|
if (!_elm_lib_dir)
|
|
|
|
_elm_lib_dir = eina_stringshare_add("/");
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2010-05-07 08:49:06 -07:00
|
|
|
_elm_config_init();
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2009-02-25 03:00:07 -08:00
|
|
|
elm_quicklaunch_sub_init(int argc, char **argv)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2009-02-25 03:00:07 -08:00
|
|
|
ecore_app_args_set(argc, (const char **)argv);
|
2010-05-07 08:49:06 -07:00
|
|
|
_elm_config_sub_init();
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
2008-12-09 22:33:24 -08:00
|
|
|
|
2009-02-25 03:00:07 -08:00
|
|
|
EAPI void
|
|
|
|
elm_quicklaunch_sub_shutdown(void)
|
|
|
|
{
|
|
|
|
_elm_win_shutdown();
|
2008-12-09 22:33:24 -08:00
|
|
|
if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
|
2009-02-25 03:00:07 -08:00
|
|
|
(_elm_config->engine == ELM_SOFTWARE_16_X11) ||
|
|
|
|
(_elm_config->engine == ELM_XRENDER_X11) ||
|
|
|
|
(_elm_config->engine == ELM_OPENGL_X11) ||
|
2010-01-13 00:17:15 -08:00
|
|
|
(_elm_config->engine == ELM_SOFTWARE_SDL) ||
|
|
|
|
(_elm_config->engine == ELM_SOFTWARE_16_SDL) ||
|
2010-02-04 10:34:44 -08:00
|
|
|
(_elm_config->engine == ELM_OPENGL_SDL) ||
|
2009-02-25 03:00:07 -08:00
|
|
|
(_elm_config->engine == ELM_SOFTWARE_WIN32) ||
|
|
|
|
(_elm_config->engine == ELM_SOFTWARE_16_WINCE))
|
2008-12-09 22:33:24 -08:00
|
|
|
{
|
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2009-07-06 23:46:51 -07:00
|
|
|
ecore_x_disconnect();
|
2009-05-08 04:27:32 -07:00
|
|
|
#endif
|
2009-07-06 23:46:51 -07:00
|
|
|
evas_cserve_disconnect();
|
2008-12-09 22:33:24 -08:00
|
|
|
}
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
2009-01-13 01:20:53 -08:00
|
|
|
|
2009-02-25 03:00:07 -08:00
|
|
|
EAPI void
|
|
|
|
elm_quicklaunch_shutdown(void)
|
|
|
|
{
|
2009-01-13 01:20:53 -08:00
|
|
|
eina_stringshare_del(_elm_data_dir);
|
|
|
|
_elm_data_dir = NULL;
|
2010-04-28 16:14:04 -07:00
|
|
|
eina_stringshare_del(_elm_lib_dir);
|
|
|
|
_elm_lib_dir = NULL;
|
2009-02-03 02:28:52 -08:00
|
|
|
|
2010-01-18 01:38:52 -08:00
|
|
|
free(_elm_appname);
|
2010-04-28 16:14:04 -07:00
|
|
|
_elm_appname = NULL;
|
2010-01-18 01:38:52 -08:00
|
|
|
|
2010-05-07 08:49:06 -07:00
|
|
|
_elm_config_shutdown();
|
|
|
|
|
2009-02-25 03:00:07 -08:00
|
|
|
ecore_event_handler_del(_elm_exit_handler);
|
|
|
|
_elm_exit_handler = NULL;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2010-04-28 16:14:04 -07:00
|
|
|
_elm_theme_shutdown();
|
2009-09-12 02:37:29 -07:00
|
|
|
_elm_unneed_efreet();
|
|
|
|
_elm_unneed_e_dbus();
|
2010-03-31 05:38:58 -07:00
|
|
|
_elm_unneed_ethumb();
|
2009-09-28 21:35:35 -07:00
|
|
|
_elm_module_shutdown();
|
2010-06-03 22:14:35 -07:00
|
|
|
ecore_imf_shutdown();
|
2008-09-29 23:58:56 -07:00
|
|
|
ecore_evas_shutdown();
|
|
|
|
edje_shutdown();
|
|
|
|
evas_shutdown();
|
|
|
|
ecore_file_shutdown();
|
|
|
|
ecore_shutdown();
|
|
|
|
eet_shutdown();
|
2009-09-11 07:21:58 -07:00
|
|
|
|
|
|
|
if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
|
|
|
|
{
|
|
|
|
eina_log_domain_unregister(_elm_log_dom);
|
|
|
|
_elm_log_dom = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_shutdown();
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2009-02-25 03:00:07 -08:00
|
|
|
EAPI void
|
|
|
|
elm_quicklaunch_seed(void)
|
|
|
|
{
|
|
|
|
Evas_Object *win, *bg, *bt;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 03:00:07 -08:00
|
|
|
win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
|
|
|
|
bg = elm_bg_add(win);
|
|
|
|
elm_win_resize_object_add(win, bg);
|
|
|
|
evas_object_show(bg);
|
|
|
|
bt = elm_button_add(win);
|
|
|
|
elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
|
|
|
|
elm_win_resize_object_add(win, bt);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
evas_object_del(win);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
|
|
|
|
(_elm_config->engine == ELM_SOFTWARE_16_X11) ||
|
|
|
|
(_elm_config->engine == ELM_XRENDER_X11) ||
|
|
|
|
(_elm_config->engine == ELM_OPENGL_X11))
|
|
|
|
{
|
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
2009-07-06 23:46:51 -07:00
|
|
|
ecore_x_sync();
|
|
|
|
#endif
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *qr_handle = NULL;
|
|
|
|
static int (*qr_main) (int argc, char **argv) = NULL;
|
|
|
|
|
2009-06-17 08:35:19 -07:00
|
|
|
EAPI Eina_Bool
|
2010-03-09 09:51:30 -08:00
|
|
|
elm_quicklaunch_prepare(int argc __UNUSED__, char **argv)
|
2009-02-25 03:00:07 -08:00
|
|
|
{
|
2009-03-01 01:33:41 -08:00
|
|
|
#ifdef HAVE_FORK
|
2009-02-25 03:00:07 -08:00
|
|
|
char *exe = elm_quicklaunch_exe_path_get(argv[0]);
|
|
|
|
if (!exe)
|
|
|
|
{
|
2009-09-11 08:02:07 -07:00
|
|
|
ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
|
2009-07-06 23:46:51 -07:00
|
|
|
return EINA_FALSE;
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
char *exe2, *p;
|
|
|
|
char *exename;
|
|
|
|
|
|
|
|
exe2 = malloc(strlen(exe) + 1 + 10);
|
|
|
|
strcpy(exe2, exe);
|
|
|
|
p = strrchr(exe2, '/');
|
|
|
|
if (p) p++;
|
|
|
|
else p = exe2;
|
|
|
|
exename = alloca(strlen(p) + 1);
|
|
|
|
strcpy(exename, p);
|
|
|
|
*p = 0;
|
|
|
|
strcat(p, "../lib/");
|
|
|
|
strcat(p, exename);
|
|
|
|
strcat(p, ".so");
|
|
|
|
if (access(exe2, R_OK | X_OK) == 0)
|
|
|
|
{
|
|
|
|
free(exe);
|
|
|
|
exe = exe2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
free(exe2);
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
|
2009-09-11 08:02:07 -07:00
|
|
|
if (!qr_handle)
|
|
|
|
{
|
2009-09-13 21:20:51 -07:00
|
|
|
fprintf(stderr, "dlerr: %s\n", dlerror());
|
2009-09-11 08:02:07 -07:00
|
|
|
WRN("dlopen('%s') failed: %s", exe, dlerror());
|
|
|
|
free(exe);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
INF("dlopen('%s') = %p", exe, qr_handle);
|
2009-02-25 03:00:07 -08:00
|
|
|
free(exe);
|
|
|
|
qr_main = dlsym(qr_handle, "elm_main");
|
2009-09-11 08:02:07 -07:00
|
|
|
INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
|
2009-02-25 03:00:07 -08:00
|
|
|
if (!qr_main)
|
|
|
|
{
|
2009-09-11 08:02:07 -07:00
|
|
|
WRN("not quicklauncher capable: no elm_main in '%s'", exe);
|
2009-07-06 23:46:51 -07:00
|
|
|
dlclose(qr_handle);
|
|
|
|
qr_handle = NULL;
|
|
|
|
return EINA_FALSE;
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
2009-06-17 08:35:19 -07:00
|
|
|
return EINA_TRUE;
|
2009-03-01 01:33:41 -08:00
|
|
|
#else
|
2009-06-17 08:35:19 -07:00
|
|
|
return EINA_FALSE;
|
2009-03-01 01:33:41 -08:00
|
|
|
#endif
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
|
2009-03-01 01:33:41 -08:00
|
|
|
#ifdef HAVE_FORK
|
2009-02-25 22:20:41 -08:00
|
|
|
static void
|
|
|
|
save_env(void)
|
|
|
|
{
|
|
|
|
int i, size;
|
|
|
|
extern char **environ;
|
|
|
|
char **oldenv, **p;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 22:20:41 -08:00
|
|
|
oldenv = environ;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 22:20:41 -08:00
|
|
|
for (i = 0, size = 0; environ[i] != NULL; i++)
|
|
|
|
size += strlen(environ[i]) + 1;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 22:20:41 -08:00
|
|
|
p = malloc((i + 1) * sizeof(char *));
|
|
|
|
if (!p) return;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 22:20:41 -08:00
|
|
|
environ = p;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 22:20:41 -08:00
|
|
|
for (i = 0; oldenv[i] != NULL; i++)
|
|
|
|
environ[i] = strdup(oldenv[i]);
|
|
|
|
environ[i] = NULL;
|
|
|
|
}
|
2009-03-01 01:33:41 -08:00
|
|
|
#endif
|
2009-02-25 22:20:41 -08:00
|
|
|
|
2009-06-17 08:35:19 -07:00
|
|
|
EAPI Eina_Bool
|
2009-02-25 22:20:41 -08:00
|
|
|
elm_quicklaunch_fork(int argc, char **argv, char *cwd, void (postfork_func) (void *data), void *postfork_data)
|
2009-02-25 03:00:07 -08:00
|
|
|
{
|
2009-03-01 01:33:41 -08:00
|
|
|
#ifdef HAVE_FORK
|
2009-02-25 03:00:07 -08:00
|
|
|
pid_t child;
|
|
|
|
int ret;
|
|
|
|
int real_argc;
|
|
|
|
char **real_argv;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-25 03:00:07 -08:00
|
|
|
// FIXME:
|
|
|
|
// need to accept current environment from elementary_run
|
|
|
|
if (!qr_main)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
int i;
|
|
|
|
char **args;
|
|
|
|
|
|
|
|
child = fork();
|
|
|
|
if (child > 0) return EINA_TRUE;
|
2009-02-25 07:54:26 -08:00
|
|
|
else if (child < 0)
|
|
|
|
{
|
|
|
|
perror("could not fork");
|
2009-06-17 08:35:19 -07:00
|
|
|
return EINA_FALSE;
|
2009-02-25 07:54:26 -08:00
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
setsid();
|
|
|
|
if (chdir(cwd) != 0)
|
2009-02-25 07:54:26 -08:00
|
|
|
perror("could not chdir");
|
2009-07-06 23:46:51 -07:00
|
|
|
args = alloca((argc + 1) * sizeof(char *));
|
|
|
|
for (i = 0; i < argc; i++) args[i] = argv[i];
|
|
|
|
args[argc] = NULL;
|
2009-09-11 07:51:25 -07:00
|
|
|
WRN("%s not quicklaunch capable, fallback...", argv[0]);
|
2009-09-11 08:02:07 -07:00
|
|
|
execvp(argv[0], args);
|
|
|
|
ERR("failed to execute '%s': %s", argv[0], strerror(errno));
|
|
|
|
exit(-1);
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
child = fork();
|
2009-06-17 08:35:19 -07:00
|
|
|
if (child > 0) return EINA_TRUE;
|
2009-02-25 07:54:26 -08:00
|
|
|
else if (child < 0)
|
|
|
|
{
|
|
|
|
perror("could not fork");
|
2009-06-17 08:35:19 -07:00
|
|
|
return EINA_FALSE;
|
2009-02-25 07:54:26 -08:00
|
|
|
}
|
2009-02-25 22:20:41 -08:00
|
|
|
if (postfork_func) postfork_func(postfork_data);
|
|
|
|
|
2009-02-25 18:13:34 -08:00
|
|
|
setsid();
|
2009-02-25 07:54:26 -08:00
|
|
|
if (chdir(cwd) != 0)
|
|
|
|
perror("could not chdir");
|
2009-02-25 22:20:41 -08:00
|
|
|
// FIXME: this is very linux specific. it changes argv[0] of the process
|
|
|
|
// so ps etc. report what you'd expect. for other unixes and os's this
|
|
|
|
// may just not work
|
|
|
|
save_env();
|
2010-03-01 17:14:36 -08:00
|
|
|
if (argv)
|
2009-02-25 22:20:41 -08:00
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
char *lastarg, *p;
|
2009-02-25 22:20:41 -08:00
|
|
|
|
2009-07-06 23:46:51 -07:00
|
|
|
ecore_app_args_get(&real_argc, &real_argv);
|
|
|
|
lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
|
|
|
|
for (p = real_argv[0]; p < lastarg; p++) *p = 0;
|
|
|
|
strcpy(real_argv[0], argv[0]);
|
2009-02-25 22:20:41 -08:00
|
|
|
}
|
|
|
|
ecore_app_args_set(argc, (const char **)argv);
|
2009-02-25 03:00:07 -08:00
|
|
|
ret = qr_main(argc, argv);
|
|
|
|
exit(ret);
|
2009-06-17 08:35:19 -07:00
|
|
|
return EINA_TRUE;
|
2009-03-01 01:33:41 -08:00
|
|
|
#else
|
2009-06-17 08:35:19 -07:00
|
|
|
return EINA_FALSE;
|
2009-07-06 23:46:51 -07:00
|
|
|
#endif
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_quicklaunch_cleanup(void)
|
|
|
|
{
|
2009-03-01 01:33:41 -08:00
|
|
|
#ifdef HAVE_FORK
|
2009-02-25 03:00:07 -08:00
|
|
|
if (qr_handle)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
dlclose(qr_handle);
|
|
|
|
qr_handle = NULL;
|
|
|
|
qr_main = NULL;
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
2009-03-01 01:33:41 -08:00
|
|
|
#endif
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_quicklaunch_fallback(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
elm_quicklaunch_init(argc, argv);
|
|
|
|
elm_quicklaunch_sub_init(argc, argv);
|
|
|
|
elm_quicklaunch_prepare(argc, argv);
|
|
|
|
ret = qr_main(argc, argv);
|
|
|
|
exit(ret);
|
2009-03-01 01:33:41 -08:00
|
|
|
return ret;
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI char *
|
|
|
|
elm_quicklaunch_exe_path_get(const char *exe)
|
|
|
|
{
|
|
|
|
static char *path = NULL;
|
|
|
|
static Eina_List *pathlist = NULL;
|
2009-02-25 11:50:45 -08:00
|
|
|
const char *pathitr;
|
|
|
|
const Eina_List *l;
|
2009-02-25 03:00:07 -08:00
|
|
|
char buf[PATH_MAX];
|
|
|
|
if (exe[0] == '/') return strdup(exe);
|
|
|
|
if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
|
|
|
|
if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
|
|
|
|
if (!path)
|
|
|
|
{
|
2010-03-08 23:30:48 -08:00
|
|
|
const char *p, *pp;
|
2010-03-09 22:46:28 -08:00
|
|
|
char *buf2;
|
2009-07-06 23:46:51 -07:00
|
|
|
path = getenv("PATH");
|
2010-03-09 22:46:28 -08:00
|
|
|
buf2 = alloca(strlen(path) + 1);
|
2009-07-06 23:46:51 -07:00
|
|
|
p = path;
|
|
|
|
pp = p;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if ((*p == ':') || (*p == 0))
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
len = p - pp;
|
2010-03-09 22:46:28 -08:00
|
|
|
strncpy(buf2, pp, len);
|
|
|
|
buf2[len] = 0;
|
|
|
|
pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
|
2009-07-06 23:46:51 -07:00
|
|
|
if (*p == 0) break;
|
|
|
|
p++;
|
|
|
|
pp = p;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*p == 0) break;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
}
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
2009-02-25 11:50:45 -08:00
|
|
|
EINA_LIST_FOREACH(pathlist, l, pathitr)
|
2009-02-25 03:00:07 -08:00
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
|
|
|
|
if (access(buf, R_OK | X_OK) == 0) return strdup(buf);
|
2009-02-25 03:00:07 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* Run the main loop
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This call should be called just after all initialization is complete. This
|
|
|
|
* function will not return until elm_exit() is called. It will keep looping
|
|
|
|
* running the main event/processing loop for Elementary.
|
|
|
|
* @ingroup General
|
|
|
|
*/
|
2008-09-29 23:58:56 -07:00
|
|
|
EAPI void
|
|
|
|
elm_run(void)
|
|
|
|
{
|
|
|
|
ecore_main_loop_begin();
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* Exit the main loop
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* If this call is called, it will flag the main loop to cease processing and
|
|
|
|
* return back to its parent function.
|
|
|
|
* @ingroup General
|
|
|
|
*/
|
2008-09-29 23:58:56 -07:00
|
|
|
EAPI void
|
|
|
|
elm_exit(void)
|
|
|
|
{
|
|
|
|
ecore_main_loop_quit();
|
|
|
|
}
|
2009-02-02 21:09:03 -08:00
|
|
|
|
2009-12-01 05:32:48 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set new policy value.
|
|
|
|
*
|
|
|
|
* This will emit the ecore event ELM_EVENT_POLICY_CHANGED in the main
|
|
|
|
* loop giving the event information Elm_Event_Policy_Changed with
|
|
|
|
* policy identifier, new and old values.
|
|
|
|
*
|
|
|
|
* @param policy policy identifier as in Elm_Policy.
|
|
|
|
* @param value policy value, depends on identifiers, usually there is
|
|
|
|
* an enumeration with the same prefix as the policy name, for
|
|
|
|
* example: ELM_POLICY_QUIT and Elm_Policy_Quit
|
|
|
|
* (ELM_POLICY_QUIT_NONE, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED).
|
|
|
|
*
|
|
|
|
* @return @c EINA_TRUE on success or @c EINA_FALSE on error (right
|
|
|
|
* now just invalid policy identifier, but in future policy
|
|
|
|
* value might be enforced).
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_policy_set(unsigned int policy, int value)
|
|
|
|
{
|
|
|
|
Elm_Event_Policy_Changed *ev;
|
|
|
|
|
|
|
|
if (policy >= ELM_POLICY_LAST)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (value == _elm_policies[policy])
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
/* TODO: validade policy? */
|
|
|
|
|
|
|
|
ev = malloc(sizeof(*ev));
|
|
|
|
ev->policy = policy;
|
|
|
|
ev->new_value = value;
|
|
|
|
ev->old_value = _elm_policies[policy];
|
|
|
|
|
|
|
|
_elm_policies[policy] = value;
|
|
|
|
|
|
|
|
ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the policy value set for given identifier.
|
|
|
|
*
|
|
|
|
* @param policy policy identifier as in Elm_Policy.
|
|
|
|
*
|
|
|
|
* @return policy value. Will be 0 if policy identifier is invalid.
|
|
|
|
*/
|
|
|
|
EAPI int
|
|
|
|
elm_policy_get(unsigned int policy)
|
|
|
|
{
|
|
|
|
if (policy >= ELM_POLICY_LAST)
|
|
|
|
return 0;
|
|
|
|
return _elm_policies[policy];
|
|
|
|
}
|
|
|
|
|
2010-04-12 01:27:10 -07:00
|
|
|
/**
|
|
|
|
* Flush all caches & dump all data that can be to lean down to use less memory
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_all_flush(void)
|
|
|
|
{
|
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *obj;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(_elm_win_list, l, obj)
|
|
|
|
{
|
|
|
|
Evas *e = evas_object_evas_get(obj);
|
|
|
|
edje_file_cache_flush();
|
|
|
|
edje_collection_cache_flush();
|
|
|
|
evas_image_cache_flush(e);
|
|
|
|
evas_font_cache_flush(e);
|
|
|
|
evas_render_dump(e);
|
|
|
|
}
|
|
|
|
}
|
2009-12-01 05:32:48 -08:00
|
|
|
|
2009-05-17 23:08:53 -07:00
|
|
|
/**
|
|
|
|
* @defgroup Scaling Selective Widget Scaling
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-17 23:08:53 -07:00
|
|
|
* Different widgets can be scaled independently. These functions allow you to
|
2009-07-06 23:46:51 -07:00
|
|
|
* manipulate this scaling on a per-widget basis. The object and all its
|
|
|
|
* children get their scaling factors multiplied by the scale factor set.
|
2009-05-17 23:08:53 -07:00
|
|
|
* This is multiplicative, in that if a child also has a scale size set it is
|
|
|
|
* in turn multiplied by its parent's scale size. 1.0 means “don't scale”,
|
|
|
|
* 2.0 is double size, 0.5 is half etc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the scaling factor
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-17 23:08:53 -07:00
|
|
|
* @param obj The object
|
|
|
|
* @param scale Scale factor (from 0.0 up, with 1.0 == no scaling)
|
|
|
|
* @ingroup Scaling
|
|
|
|
*/
|
2009-02-02 21:09:03 -08:00
|
|
|
EAPI void
|
|
|
|
elm_object_scale_set(Evas_Object *obj, double scale)
|
|
|
|
{
|
2009-11-29 08:02:05 -08:00
|
|
|
elm_widget_scale_set(obj, scale);
|
2009-02-02 21:09:03 -08:00
|
|
|
}
|
|
|
|
|
2009-05-17 23:08:53 -07:00
|
|
|
/**
|
|
|
|
* Get the scaling factor
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-17 23:08:53 -07:00
|
|
|
* @param obj The object
|
|
|
|
* @return The scaling factor set by elm_object_scale_set()
|
|
|
|
* @ingroup Scaling
|
|
|
|
*/
|
2009-02-02 21:09:03 -08:00
|
|
|
EAPI double
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_object_scale_get(const Evas_Object *obj)
|
2009-02-02 21:09:03 -08:00
|
|
|
{
|
|
|
|
return elm_widget_scale_get(obj);
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* @defgroup Styles Styles
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* Widgets can have different styles of look. These generic API's set
|
|
|
|
* styles of widgets, if they support them (and if the theme(s) do).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the style
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This sets the name of the style
|
|
|
|
* @param obj The object
|
|
|
|
* @param style The style name to use
|
|
|
|
* @ingroup Styles
|
|
|
|
*/
|
2009-04-22 21:03:27 -07:00
|
|
|
EAPI void
|
|
|
|
elm_object_style_set(Evas_Object *obj, const char *style)
|
|
|
|
{
|
|
|
|
elm_widget_style_set(obj, style);
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* Get the style
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This gets the style being used for that widget. Note that the string
|
2009-07-06 23:46:51 -07:00
|
|
|
* pointer is only valid as longas the object is valid and the style doesn't
|
2009-05-19 06:50:06 -07:00
|
|
|
* change.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* @param obj The object
|
|
|
|
* @return The style name
|
2009-05-19 06:53:03 -07:00
|
|
|
* @ingroup Styles
|
2009-05-19 06:50:06 -07:00
|
|
|
*/
|
2009-04-22 21:03:27 -07:00
|
|
|
EAPI const char *
|
|
|
|
elm_object_style_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_widget_style_get(obj);
|
|
|
|
}
|
|
|
|
|
2009-08-16 04:35:55 -07:00
|
|
|
/**
|
|
|
|
* Set the disable state
|
|
|
|
*
|
|
|
|
* This sets the disable state for the widget.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @param disabled The state
|
|
|
|
* @ingroup Styles
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled)
|
|
|
|
{
|
|
|
|
elm_widget_disabled_set(obj, disabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the disable state
|
|
|
|
*
|
|
|
|
* This gets the disable state for the widget.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @return True, if the widget is disabled
|
|
|
|
* @ingroup Styles
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_object_disabled_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_widget_disabled_get(obj);
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* Get the global scaling factor
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This gets the globally configured scaling factor that is applied to all
|
|
|
|
* objects.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* @return The scaling factor
|
|
|
|
* @ingroup Scaling
|
|
|
|
*/
|
2009-03-12 22:50:38 -07:00
|
|
|
EAPI double
|
|
|
|
elm_scale_get(void)
|
|
|
|
{
|
|
|
|
return _elm_config->scale;
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* Set the global scaling factor
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This sets the globally configured scaling factor that is applied to all
|
|
|
|
* objects.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* @param scale The scaling factor to set
|
|
|
|
* @ingroup Scaling
|
|
|
|
*/
|
2009-03-12 22:50:38 -07:00
|
|
|
EAPI void
|
|
|
|
elm_scale_set(double scale)
|
|
|
|
{
|
|
|
|
if (_elm_config->scale == scale) return;
|
|
|
|
_elm_config->scale = scale;
|
|
|
|
_elm_rescale();
|
|
|
|
}
|
|
|
|
|
2010-01-15 01:32:43 -08:00
|
|
|
/**
|
|
|
|
* Set the global scaling factor for all applications on the display
|
|
|
|
*
|
|
|
|
* This sets the globally configured scaling factor that is applied to all
|
|
|
|
* objects for all applications.
|
|
|
|
* @param scale The scaling factor to set
|
|
|
|
* @ingroup Scaling
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_scale_all_set(double scale)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
|
|
|
static Ecore_X_Atom atom = 0;
|
2010-03-08 23:30:48 -08:00
|
|
|
unsigned int scale_i = (unsigned int)(scale * 1000.0);
|
2010-01-15 01:32:43 -08:00
|
|
|
|
|
|
|
if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
|
|
|
|
ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
|
|
|
|
atom, &scale_i, 1);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* @defgroup Fingers Fingers
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* Elementary is designed to be finger-friendly for touchscreens, and so in
|
|
|
|
* addition to scaling for display resolution, it can also scale based on
|
2010-01-07 00:00:49 -08:00
|
|
|
* finger "resolution" (or size).
|
2009-05-19 06:50:06 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the configured finger size
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This gets the globally configured finger size in pixels
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* @return The finger size
|
|
|
|
* @ingroup Fingers
|
|
|
|
*/
|
2009-03-12 22:50:38 -07:00
|
|
|
EAPI Evas_Coord
|
|
|
|
elm_finger_size_get(void)
|
|
|
|
{
|
|
|
|
return _elm_config->finger_size;
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* Set the configured finger size
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This sets the globally configured finger size in pixels
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-09-17 15:39:18 -07:00
|
|
|
* @param size The finger size
|
2009-05-19 06:50:06 -07:00
|
|
|
* @ingroup Fingers
|
|
|
|
*/
|
2009-03-12 22:50:38 -07:00
|
|
|
EAPI void
|
|
|
|
elm_finger_size_set(Evas_Coord size)
|
|
|
|
{
|
|
|
|
if (_elm_config->finger_size == size) return;
|
|
|
|
_elm_config->finger_size = size;
|
|
|
|
_elm_rescale();
|
|
|
|
}
|
|
|
|
|
2010-01-15 01:32:43 -08:00
|
|
|
/**
|
|
|
|
* Set the configured finger size for all applications on the display
|
|
|
|
*
|
|
|
|
* This sets the globally configured finger size in pixels for all applications
|
|
|
|
* on the display
|
|
|
|
*
|
|
|
|
* @param size The finger size
|
|
|
|
* @ingroup Fingers
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_finger_size_all_set(Evas_Coord size)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_ELEMENTARY_X
|
|
|
|
static Ecore_X_Atom atom = 0;
|
2010-03-08 23:30:48 -08:00
|
|
|
unsigned int size_i = (unsigned int)size;
|
2010-01-15 01:32:43 -08:00
|
|
|
|
|
|
|
if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
|
|
|
|
ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
|
|
|
|
atom, &size_i, 1);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
2009-07-06 23:46:51 -07:00
|
|
|
* Adjust size of an element for finger usage
|
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* This takes width and height sizes (in pixels) as input and a size multiple
|
|
|
|
* (which is how many fingers you want to place within the area), and adjusts
|
|
|
|
* the size tobe large enough to accomodate finger. On return the w and h
|
|
|
|
* sizes poiner do by these parameters will be modified.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* @param times_w How many fingers should fit horizontally
|
|
|
|
* @param w Pointer to the width size to adjust
|
|
|
|
* @param times_h How many fingers should fit vertically
|
|
|
|
* @param h Pointer to the height size to adjust
|
|
|
|
* @ingroup Fingers
|
|
|
|
*/
|
2009-02-11 03:49:43 -08:00
|
|
|
EAPI void
|
|
|
|
elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h)
|
|
|
|
{
|
|
|
|
if ((w) && (*w < (_elm_config->finger_size * times_w)))
|
|
|
|
*w = _elm_config->finger_size * times_w;
|
|
|
|
if ((h) && (*h < (_elm_config->finger_size * times_h)))
|
|
|
|
*h = _elm_config->finger_size * times_h;
|
|
|
|
}
|
2009-05-19 06:50:06 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup Focus Focus
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* Objects have focus. This is what determines where the keyboard input goes to
|
2009-05-19 06:50:06 -07:00
|
|
|
* within the application window.
|
|
|
|
*/
|
|
|
|
|
2010-05-19 06:17:02 -07:00
|
|
|
/**
|
|
|
|
* Get the focus of the object
|
|
|
|
*
|
|
|
|
* This gets the focused property of the object.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @return 1 if the object is focused, 0 if not.
|
|
|
|
* @ingroup Focus
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_object_focus_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_widget_focus_get(obj);
|
|
|
|
}
|
|
|
|
|
2009-05-19 06:50:06 -07:00
|
|
|
/**
|
|
|
|
* Set the focus to the object
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2010-05-19 06:17:02 -07:00
|
|
|
* This sets the focus target for keyboard input to be the object indicated.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-19 06:50:06 -07:00
|
|
|
* @param obj The object
|
|
|
|
* @ingroup Focus
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_object_focus(Evas_Object *obj)
|
|
|
|
{
|
2009-10-22 05:08:20 -07:00
|
|
|
if (!elm_widget_can_focus_get(obj)) return;
|
2010-02-16 21:26:16 -08:00
|
|
|
elm_widget_focus_steal(obj);
|
2009-05-19 06:50:06 -07:00
|
|
|
}
|
2009-09-07 21:40:27 -07:00
|
|
|
|
2010-01-09 18:18:50 -08:00
|
|
|
/**
|
2010-05-19 06:17:02 -07:00
|
|
|
* Remove the focus from the object
|
2010-01-09 18:18:50 -08:00
|
|
|
*
|
2010-05-19 06:17:02 -07:00
|
|
|
* This removes the focus target for keyboard input from be the object
|
|
|
|
* indicated.
|
2010-01-09 18:18:50 -08:00
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @ingroup Focus
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_object_unfocus(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
if (!elm_widget_can_focus_get(obj)) return;
|
|
|
|
elm_widget_focused_object_clear(obj);
|
|
|
|
}
|
|
|
|
|
2009-10-22 01:04:34 -07:00
|
|
|
/**
|
|
|
|
* Set the ability for the object to focus
|
|
|
|
*
|
|
|
|
* This sets the ability for the object to be able to get keyboard focus or
|
|
|
|
* not. By default all objects are able to be focused.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @param enable 1 if the object can be focused, 0 if not
|
|
|
|
* @ingroup Focus
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable)
|
|
|
|
{
|
|
|
|
elm_widget_can_focus_set(obj, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the ability for the object to focus
|
|
|
|
*
|
|
|
|
* This gets the ability for the object to be able to get keyboard focus or
|
|
|
|
* not. By default all objects are able to be focused.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @return 1 if the object is allowed to be focused, 0 if not.
|
|
|
|
* @ingroup Focus
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_object_focus_allow_get(const Evas_Object *obj)
|
2009-10-22 01:04:34 -07:00
|
|
|
{
|
|
|
|
return elm_widget_can_focus_get(obj);
|
|
|
|
}
|
|
|
|
|
2009-09-07 21:40:27 -07:00
|
|
|
/**
|
|
|
|
* @defgroup Scrollhints Scrollhints
|
|
|
|
*
|
|
|
|
* Objects when inside a scroller can scroll, but this may not always be
|
|
|
|
* desireable in certain situations. This allows an object to hint to itself
|
|
|
|
* and parents to "not scroll" in one of 2 ways.
|
|
|
|
*
|
|
|
|
* 1. To hold on scrolling. This means just flicking and dragging may no
|
|
|
|
* longer scroll, but pressing/dragging near an edge of the scroller will
|
|
|
|
* still scroll. This is automastically used by the entry object when
|
|
|
|
* selecting text.
|
|
|
|
* 2. To totally freeze scrolling. This means it stops. until popped/released.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Push the scroll hold by 1
|
|
|
|
*
|
|
|
|
* This increments the scroll hold count by one. If it is more than 0 it will
|
|
|
|
* take effect on the parents of the indicated object.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @ingroup Scrollhints
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_object_scroll_hold_push(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
elm_widget_scroll_hold_push(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pop the scroll hold by 1
|
|
|
|
*
|
|
|
|
* This decrements the scroll hold count by one. If it is more than 0 it will
|
|
|
|
* take effect on the parents of the indicated object.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @ingroup Scrollhints
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_object_scroll_hold_pop(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
elm_widget_scroll_hold_pop(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Push the scroll freeze by 1
|
|
|
|
*
|
|
|
|
* This increments the scroll freeze count by one. If it is more than 0 it will
|
|
|
|
* take effect on the parents of the indicated object.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @ingroup Scrollhints
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_object_scroll_freeze_push(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
elm_widget_scroll_freeze_push(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pop the scroll freeze by 1
|
|
|
|
*
|
|
|
|
* This decrements the scroll freeze count by one. If it is more than 0 it will
|
|
|
|
* take effect on the parents of the indicated object.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @ingroup Scrollhints
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
elm_object_scroll_freeze_pop(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
elm_widget_scroll_freeze_pop(obj);
|
|
|
|
}
|
2010-03-22 14:36:59 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup WidgetNavigation Widget Tree Navigation.
|
|
|
|
*
|
|
|
|
* How to check if an Evas Object is an Elementary widget? How to get
|
|
|
|
* the first elementary widget that is parent of the given object?
|
|
|
|
* These are all covered in widget tree navigation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the given Evas Object is an Elementary widget.
|
|
|
|
*
|
|
|
|
* @param obj the object to query.
|
|
|
|
* @return @c EINA_TRUE if it is an elementary widget variant,
|
|
|
|
* @c EINA_FALSE otherwise
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_object_widget_check(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_widget_is(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the first parent of the given object that is an Elementary widget.
|
|
|
|
*
|
|
|
|
* @param obj the object to query.
|
|
|
|
* @return the parent object that is an Elementary widget, or @c NULL
|
|
|
|
* if no parent is, or no parents at all.
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_object_parent_widget_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_widget_parent_widget_get(obj);
|
|
|
|
}
|
2010-05-13 15:02:26 -07:00
|
|
|
|
2010-06-23 01:51:58 -07:00
|
|
|
/**
|
|
|
|
* Get the top level parent of an Elementary widget.
|
|
|
|
*
|
|
|
|
* @param obj The object to query.
|
|
|
|
* @return The top level Elementary widget, or @c NULL if parent cannot be
|
|
|
|
* found.
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_object_top_widget_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_widget_top_get(obj);
|
|
|
|
}
|
|
|
|
|
2010-05-13 15:02:26 -07:00
|
|
|
/**
|
|
|
|
* Get the string that represents this Elementary widget.
|
|
|
|
*
|
|
|
|
* @note Elementary is weird and exposes itself as a single
|
|
|
|
* Evas_Object_Smart_Class of type "elm_widget", so
|
|
|
|
* evas_object_type_get() always return that, making debug and
|
|
|
|
* language bindings hard. This function tries to mitigate this
|
|
|
|
* problem, but the solution is to change Elementary to use
|
|
|
|
* proper inheritance.
|
|
|
|
*
|
|
|
|
* @param obj the object to query.
|
|
|
|
* @return Elementary widget name, or @c NULL if not a valid widget.
|
|
|
|
*/
|
|
|
|
EAPI const char *
|
|
|
|
elm_object_widget_type_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_widget_type_get(obj);
|
|
|
|
}
|
2010-06-15 07:11:13 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a signal to the widget edje object.
|
|
|
|
*
|
|
|
|
* This function sends a signal to the edje object of the obj. An edje program
|
|
|
|
* can respond to a signal by specifying matching 'signal' and
|
|
|
|
* 'source' fields.
|
|
|
|
*
|
|
|
|
* @param obj The object
|
|
|
|
* @param emission The signal's name.
|
|
|
|
* @param source The signal's source.
|
|
|
|
* @ingroup General
|
|
|
|
*/
|
|
|
|
EAPI void elm_object_signal_emit(Evas_Object *obj, const char *emission, const char *source)
|
|
|
|
{
|
|
|
|
elm_widget_signal_emit(obj, emission, source);
|
|
|
|
}
|