From: jh0506.yun Date: Tue, 16 Nov 2010 11:19:37 +0000 (+0900) Subject: [SVN merge 52271,53669,53703] quicklaunch works X-Git-Tag: 1.0.0+svn.51480slp2+build63~17^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dfd04598063d8127b450ddf1aa69d3139670a829;p=framework%2Fuifw%2Felementary.git [SVN merge 52271,53669,53703] quicklaunch works --- diff --git a/src/bin/quicklaunch.c b/src/bin/quicklaunch.c index 512497e..59384c7 100644 --- a/src/bin/quicklaunch.c +++ b/src/bin/quicklaunch.c @@ -176,6 +176,7 @@ main(int argc, char **argv) CRITICAL("listen(sock=%d, 4096): %s", sock, strerror(errno)); exit(-1); } + elm_quicklaunch_mode_set(EINA_TRUE); elm_quicklaunch_init(argc, argv); restart_time = ecore_time_get(); @@ -280,7 +281,7 @@ main(int argc, char **argv) handle_run(fd, bytes); } } - elm_quicklaunch_sub_shutdown(); + while (elm_quicklaunch_sub_shutdown() > 0); } elm_quicklaunch_shutdown(); diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 636ae1d..be1f109 100755 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -231,15 +231,16 @@ extern "C" { /**************************************************************************/ /* General calls */ - EAPI void elm_init(int argc, char **argv); - EAPI void elm_shutdown(void); + EAPI int elm_init(int argc, char **argv); + EAPI int elm_shutdown(void); EAPI void elm_run(void); EAPI void elm_exit(void); - EAPI void elm_quicklaunch_init(int argc, char **argv); - EAPI void elm_quicklaunch_sub_init(int argc, char **argv); - EAPI void elm_quicklaunch_sub_shutdown(void); - EAPI void elm_quicklaunch_shutdown(void); + EAPI void elm_quicklaunch_mode_set(Eina_Bool ql_on); + EAPI int elm_quicklaunch_init(int argc, char **argv); + EAPI int elm_quicklaunch_sub_init(int argc, char **argv); + EAPI int elm_quicklaunch_sub_shutdown(void); + EAPI int elm_quicklaunch_shutdown(void); EAPI void elm_quicklaunch_seed(void); EAPI Eina_Bool elm_quicklaunch_prepare(int argc, char **argv); EAPI Eina_Bool elm_quicklaunch_fork(int argc, char **argv, char *cwd, void (postfork_func) (void *data), void *postfork_data); diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index 4ad30a2..a46db87 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -19,6 +19,8 @@ #include #include "elm_priv.h" +#define SEMI_BROKEN_QUICKLAUNCH 1 + static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV }; EAPI Elm_Version *elm_version = &_version; /** @@ -306,8 +308,11 @@ int _elm_log_dom = -1; 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__) @@ -351,17 +356,20 @@ _elm_widtype_clear(void) /** * 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; } /** @@ -373,13 +381,14 @@ elm_init(int argc, char **argv) * 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 @@ -452,11 +461,19 @@ _elm_unneed_efreet(void) #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) @@ -474,11 +491,6 @@ elm_quicklaunch_init(int argc, char **argv) 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); @@ -555,39 +567,89 @@ elm_quicklaunch_init(int argc, char **argv) _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); @@ -605,11 +667,6 @@ elm_quicklaunch_shutdown(void) _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(); @@ -623,33 +680,39 @@ elm_quicklaunch_shutdown(void) _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; @@ -781,6 +844,28 @@ elm_quicklaunch_fork(int argc, char **argv, char *cwd, void (postfork_func) (voi } 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");