From: Cedric BAIL Date: Fri, 24 Jun 2016 23:45:22 +0000 (-0700) Subject: elementary: return an exit code at exit with the new EFL_MAIN macro. X-Git-Tag: upstream/1.20.0~5515 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12703b3fe7c54bbdbe1881b6dc7858b71ae56c0b;p=platform%2Fupstream%2Fefl.git elementary: return an exit code at exit with the new EFL_MAIN macro. --- diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index d6da4ba..0543c33 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -1036,9 +1036,9 @@ efl_main(void *data EINA_UNUSED, /* if called with a single argument try to autorun a test with * the same name as the given param * ex: elementary_test "Box Vert 2" */ - if (eina_array_count(arge->argv) == 2) + if (eina_array_count(arge->argv) == 1) { - if (!strcmp(eina_array_data_get(arge->argv, 1), "--help")) + if (!strcmp(eina_array_data_get(arge->argv, 0), "--help")) { printf("Usages:\n" "$ elementary_test\n" @@ -1046,19 +1046,20 @@ efl_main(void *data EINA_UNUSED, "$ elementary_test -to [TEST_NAME]\n\n" "Examples:\n" "$ elementary_test -to Button\n\n"); - return; + efl_loop_quit(ev->object, 1); + return ; } - autorun = eina_array_data_get(arge->argv, 1); + autorun = eina_array_data_get(arge->argv, 0); } - else if (eina_array_count(arge->argv) == 3) + else if (eina_array_count(arge->argv) == 2) { /* Just a workaround to make the shot module more * useful with elementary test. */ - if ((!strcmp(eina_array_data_get(arge->argv, 1), "--test-win-only")) || - (!strcmp(eina_array_data_get(arge->argv, 1), "-to"))) + if ((!strcmp(eina_array_data_get(arge->argv, 0), "--test-win-only")) || + (!strcmp(eina_array_data_get(arge->argv, 0), "-to"))) { test_win_only = EINA_TRUE; - autorun = eina_array_data_get(arge->argv, 2); + autorun = eina_array_data_get(arge->argv, 1); } } diff --git a/src/lib/elementary/elm_general.h b/src/lib/elementary/elm_general.h index fb2eb6a..7eb4b4b 100644 --- a/src/lib/elementary/elm_general.h +++ b/src/lib/elementary/elm_general.h @@ -71,14 +71,14 @@ extern EAPI double _elm_startup_time; #ifndef ELM_LIB_QUICKLAUNCH #define ELM_MAIN() int main(int argc, char **argv) { int ret; _elm_startup_time = ecore_time_unix_get(); elm_init(argc, argv); ret = elm_main(argc, argv); elm_shutdown(); return ret; } /**< macro to be used after the elm_main() function */ -#define EFL_MAIN() int main(int argc, char **argv) { int ret = 0; _elm_startup_time = ecore_time_unix_get(); elm_init(argc, argv); eo_event_callback_add(ecore_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL); elm_run(); elm_shutdown(); return ret; } +#define EFL_MAIN() int main(int argc, char **argv) { int ret = 0; _elm_startup_time = ecore_time_unix_get(); elm_init(argc, argv); eo_event_callback_add(ecore_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL); ret = efl_loop_begin(ecore_main_loop_get()); elm_shutdown(); return ret; } #else /** @deprecated macro to be used after the elm_main() function. * Do not define ELM_LIB_QUICKLAUNCH * Compile your programs with -fpie and -pie -rdynamic instead, to generate a single binary (linkable executable). */ #define ELM_MAIN() int main(int argc, char **argv) { int ret; _elm_startup_time = ecore_time_unix_get(); ret = elm_quicklaunch_fallback(argc, argv); elm_shutdown(); return ret; } -#define EFL_MAIN() int main(int argc, char **argv) { int ret = 0; _elm_startup_time = ecore_time_unix_get(); efl_quicklaunch_fallback(argc, argv); elm_shutdown(); return ret; } +#define EFL_MAIN() int main(int argc, char **argv) { int ret = 0; _elm_startup_time = ecore_time_unix_get(); ret = efl_quicklaunch_fallback(argc, argv); elm_shutdown(); return ret; } #endif /**************************************************************************/ @@ -234,7 +234,7 @@ EAPI int elm_quicklaunch_fallback(int argc, char **argv); /** * Exposed symbol used only by macros and should not be used by apps */ -EAPI Eina_Bool efl_quicklaunch_fallback(int argc, char **argv); +EAPI int efl_quicklaunch_fallback(int argc, char **argv); /** diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index d8bf9d5..3f7e152 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -1124,11 +1124,12 @@ elm_quicklaunch_fork(int argc, if (qre_main) { + int ret = 0; + eo_event_callback_add(ecore_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, qre_main, NULL); - elm_run(); + ret = efl_loop_begin(ecore_main_loop_get()); elm_shutdown(); - // FIXME: get value back from the main loop quit ? - exit(0); + exit(ret); } else { @@ -1173,7 +1174,7 @@ elm_quicklaunch_fallback(int argc, return ret; } -EAPI Eina_Bool +EAPI int efl_quicklaunch_fallback(int argc, char **argv) { @@ -1184,12 +1185,10 @@ efl_quicklaunch_fallback(int argc, if (efl_quicklaunch_prepare(argc, argv, getcwd(cwd, sizeof(cwd)))) { eo_event_callback_add(ecore_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, qre_main, NULL); - elm_run(); - // FIXME: get value back from the main loop quit ? - return EINA_TRUE; + return efl_loop_begin(ecore_main_loop_get()); } - return EINA_FALSE; + return 255; } EAPI char *