#include <Elementary.h>
#include "elm_priv.h"
+#define SEMI_BROKEN_QUICKLAUNCH 1
+
static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
EAPI Elm_Version *elm_version = &_version;
/**
EAPI int ELM_EVENT_POLICY_CHANGED = 0;
static int _elm_init_count = 0;
+static int _elm_sub_init_count = 0;
+static int _elm_ql_init_count = 0;
static int _elm_policies[ELM_POLICY_LAST];
static Ecore_Event_Handler *_elm_exit_handler = NULL;
+static Eina_Bool quicklaunch_on = 0;
static Eina_Bool
_elm_signal_exit(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
/**
* Inititalise Elementary
*
+ * @return The init counter value.
+ *
* This call is exported only for use by the ELM_MAIN() macro. There is no
* need to use this if you use this macro (which is highly advisable).
* @ingroup General
*/
-EAPI void
+EAPI int
elm_init(int argc, char **argv)
{
_elm_init_count++;
- if (_elm_init_count != 1) return;
+ if (_elm_init_count > 1) return _elm_init_count;
elm_quicklaunch_init(argc, argv);
elm_quicklaunch_sub_init(argc, argv);
+ return _elm_init_count;
}
/**
* on an exit without this call.
* @ingroup General
*/
-EAPI void
+EAPI int
elm_shutdown(void)
{
_elm_init_count--;
- if (_elm_init_count != 0) return;
+ if (_elm_init_count > 0) return _elm_init_count;
elm_quicklaunch_sub_shutdown();
elm_quicklaunch_shutdown();
+ return _elm_init_count;
}
#ifdef ELM_EDBUS
#endif
}
-EAPI void
+EAPI void
+elm_quicklaunch_mode_set(Eina_Bool ql_on)
+{
+ quicklaunch_on = ql_on;
+}
+
+EAPI int
elm_quicklaunch_init(int argc, char **argv)
{
char buf[PATH_MAX], *s;
+ _elm_ql_init_count++;
+ if (_elm_ql_init_count > 1) return _elm_ql_init_count;
eina_init();
_elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
if (!_elm_log_dom)
ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
ecore_file_init();
- evas_init();
- edje_init();
- ecore_evas_init(); // FIXME: check errors
- ecore_imf_init();
- _elm_module_init();
_elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
_elm_lib_dir = eina_stringshare_add("/");
_elm_config_init();
+ return _elm_ql_init_count;
}
-EAPI void
+EAPI int
elm_quicklaunch_sub_init(int argc, char **argv)
{
- ecore_app_args_set(argc, (const char **)argv);
- _elm_config_sub_init();
+ _elm_sub_init_count++;
+ if (_elm_sub_init_count > 1) return _elm_sub_init_count;
+ if (quicklaunch_on)
+ {
+#ifdef SEMI_BROKEN_QUICKLAUNCH
+ return _elm_sub_init_count;
+#endif
+ }
+ if (!quicklaunch_on)
+ {
+ ecore_app_args_set(argc, (const char **)argv);
+ evas_init();
+ edje_init();
+ _elm_config_sub_init();
+ 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
+ ecore_x_init(NULL);
+#endif
+ }
+ ecore_evas_init(); // FIXME: check errors
+ ecore_imf_init();
+ _elm_module_init();
+ }
+ return _elm_sub_init_count;
}
-EAPI void
+EAPI int
elm_quicklaunch_sub_shutdown(void)
{
- _elm_win_shutdown();
- 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) ||
- (_elm_config->engine == ELM_SOFTWARE_SDL) ||
- (_elm_config->engine == ELM_SOFTWARE_16_SDL) ||
- (_elm_config->engine == ELM_OPENGL_SDL) ||
- (_elm_config->engine == ELM_SOFTWARE_WIN32) ||
- (_elm_config->engine == ELM_SOFTWARE_16_WINCE))
- {
+ _elm_sub_init_count--;
+ if (_elm_sub_init_count > 0) return _elm_sub_init_count;
+ if (quicklaunch_on)
+ {
+#ifdef SEMI_BROKEN_QUICKLAUNCH
+ return _elm_sub_init_count;
+#endif
+ }
+ if (!quicklaunch_on)
+ {
+ _elm_win_shutdown();
+ _elm_module_shutdown();
+ ecore_imf_shutdown();
+ ecore_evas_shutdown();
+ 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
- ecore_x_disconnect();
-#endif
- evas_cserve_disconnect();
- }
+ ecore_x_disconnect();
+#endif
+ }
+ 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) ||
+ (_elm_config->engine == ELM_SOFTWARE_SDL) ||
+ (_elm_config->engine == ELM_SOFTWARE_16_SDL) ||
+ (_elm_config->engine == ELM_OPENGL_SDL) ||
+ (_elm_config->engine == ELM_SOFTWARE_WIN32) ||
+ (_elm_config->engine == ELM_SOFTWARE_16_WINCE))
+ evas_cserve_disconnect();
+ edje_shutdown();
+ evas_shutdown();
+ }
+ return _elm_sub_init_count;
}
-EAPI void
+EAPI int
elm_quicklaunch_shutdown(void)
{
+ _elm_ql_init_count--;
+ if (_elm_ql_init_count > 0) return _elm_ql_init_count;
eina_stringshare_del(_elm_data_dir);
_elm_data_dir = NULL;
eina_stringshare_del(_elm_lib_dir);
_elm_unneed_efreet();
_elm_unneed_e_dbus();
_elm_unneed_ethumb();
- _elm_module_shutdown();
- ecore_imf_shutdown();
- ecore_evas_shutdown();
- edje_shutdown();
- evas_shutdown();
ecore_file_shutdown();
ecore_shutdown();
eet_shutdown();
_elm_widtype_clear();
eina_shutdown();
+ return _elm_ql_init_count;
}
EAPI void
elm_quicklaunch_seed(void)
{
- Evas_Object *win, *bg, *bt;
-
- 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
- ecore_x_sync();
+#ifndef SEMI_BROKEN_QUICKLAUNCH
+ if (quicklaunch_on)
+ {
+ Evas_Object *win, *bg, *bt;
+
+ 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
+ ecore_x_sync();
+# endif
+ }
+ ecore_main_loop_iterate();
+ }
#endif
- }
- ecore_main_loop_iterate();
}
static void *qr_handle = NULL;
}
if (postfork_func) postfork_func(postfork_data);
+ if (quicklaunch_on)
+ {
+#ifdef SEMI_BROKEN_QUICKLAUNCH
+ ecore_app_args_set(argc, (const char **)argv);
+ evas_init();
+ edje_init();
+ _elm_config_sub_init();
+ 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
+ ecore_x_init(NULL);
+# endif
+ }
+ ecore_evas_init(); // FIXME: check errors
+ ecore_imf_init();
+ _elm_module_init();
+#endif
+ }
+
setsid();
if (chdir(cwd) != 0)
perror("could not chdir");