From 536a3a7ff667de1d8df488fc01a0f6ff341668d5 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 18 Apr 2016 15:27:47 -0400 Subject: [PATCH] make startup/restart app exec timing protocol-specific this allows different display protocols to start their applications at different times to ensure that any initialization has completed prior to starting anything requiring a window fix T3475 --- src/bin/e_comp_x.c | 1 + src/bin/e_main.c | 4 ++-- src/bin/e_startup.c | 19 ++++++++++++++++--- src/bin/e_startup.h | 3 ++- src/modules/wl_desktop_shell/e_mod_main.c | 2 ++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c index 4c1e4192e..d2592f99f 100644 --- a/src/bin/e_comp_x.c +++ b/src/bin/e_comp_x.c @@ -5460,6 +5460,7 @@ _e_comp_x_setup(Ecore_X_Window root, int w, int h) e_comp->pointer->color = ecore_x_cursor_color_supported_get(); e_pointer_type_push(e_comp->pointer, e_comp->pointer, "default"); ecore_x_icccm_state_set(ecore_evas_window_get(e_comp->ee), ECORE_X_WINDOW_STATE_HINT_NORMAL); + e_startup(); } else e_pointer_window_add(e_comp->pointer, e_comp->root); diff --git a/src/bin/e_main.c b/src/bin/e_main.c index f4646c196..730d096f8 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1039,9 +1039,9 @@ main(int argc, char **argv) if (!nostartup) { if (after_restart) - e_startup(E_STARTUP_RESTART); + e_startup_mode_set(E_STARTUP_RESTART); else - e_startup(E_STARTUP_START); + e_startup_mode_set(E_STARTUP_START); } TS("Run Startup Apps Done"); diff --git a/src/bin/e_startup.c b/src/bin/e_startup.c index 7a8795774..c6b97fb55 100644 --- a/src/bin/e_startup.c +++ b/src/bin/e_startup.c @@ -15,9 +15,12 @@ static E_Order *startup_apps = NULL; static int start_app_pos = -1; static Ecore_Event_Handler *desktop_cache_update_handler = NULL; +static Eina_Bool started = EINA_FALSE; + /* externally accessible functions */ + E_API void -e_startup(E_Startup_Mode mode) +e_startup_mode_set(E_Startup_Mode mode) { char buf[PATH_MAX]; @@ -40,6 +43,15 @@ e_startup(E_Startup_Mode mode) e_init_undone(); } +E_API void +e_startup(void) +{ + if (desktop_cache_update_handler) + started = EINA_TRUE; + else + _e_startup(); +} + /* local subsystem functions */ static void _e_startup(void) @@ -104,13 +116,14 @@ _e_startup_event_cb(void *data, int ev_type EINA_UNUSED, void *ev) _e_startup_error_dialog("E: Efreet could not build cache. " "Please check your DBus setup"); } - ecore_event_handler_del(desktop_cache_update_handler); + E_FREE_FUNC(desktop_cache_update_handler, ecore_event_handler_del); buf = data; startup_apps = e_order_new(buf); if (startup_apps) start_app_pos = 0; free(buf); - _e_startup(); + if (started) + _e_startup(); return ECORE_CALLBACK_PASS_ON; } diff --git a/src/bin/e_startup.h b/src/bin/e_startup.h index a902aa9ed..ed20ce074 100644 --- a/src/bin/e_startup.h +++ b/src/bin/e_startup.h @@ -10,7 +10,8 @@ typedef enum _E_Startup_Mode #ifndef E_STARTUP_H #define E_STARTUP_H -E_API void e_startup(E_Startup_Mode mode); +E_API void e_startup(void); +E_API void e_startup_mode_set(E_Startup_Mode mode); #endif #endif diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index 5fb289a24..ea48f54b2 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -1507,6 +1507,8 @@ e_modapi_init(E_Module *m) return NULL; } #endif + e_startup(); + return m; }