e_module: Add event handler for ECORE_WL_EVENT_INTERFACES_BOUND 48/38248/1 accepted/tizen/common/20150416.090704 accepted/tizen/mobile/20150416.024404 accepted/tizen/tv/20150416.024151 accepted/tizen/wearable/20150416.024346 submit/tizen/20150415.104259
authorDuna Oh <duna.oh@samsung.com>
Wed, 15 Apr 2015 09:52:45 +0000 (18:52 +0900)
committerDuna Oh <duna.oh@samsung.com>
Wed, 15 Apr 2015 09:54:13 +0000 (18:54 +0900)
Summary:
- Add event handler to make sure e_module_all_load() done after wayland compositor interfaces are bound
- Delete the "return" code if still loading modules, since "wl_desktop_shell" module create wl-shell and xdg-shell interfaces needed to be bound.

Test Plan:
(1) Run enlightenment on wayland
(2) If e_module attemps to make the "Error loading Module" popup window, you will see deadlock waiting for the wayland sync "done" event to be received. This means the wayland global interfaces including wl.compositor is not ready.

below is the mainloop we are blocked
---------------------------------------------------------------
_ecore_wl_init_wait(void)
{
   while (!_ecore_wl_disp->init_done)
     wl_display_dispatch(_ecore_wl_disp->wl.display);
}

Change-Id: Id1207dfdf40b0fe078ed9700c63d1203fb26ec5e
Signed-off-by: Duna Oh <duna.oh@samsung.com>
src/bin/e_comp_wl.c
src/bin/e_module.c

index 927bb87..f19f3b0 100644 (file)
@@ -83,9 +83,6 @@ _e_comp_wl_cb_module_idle(void *data)
 
    if (!(cdata = data)) return ECORE_CALLBACK_RENEW;
 
-   /* check if we are still loading modules */
-   if (e_module_loading_get()) return ECORE_CALLBACK_RENEW;
-
    if (!(mod = e_module_find("wl_desktop_shell")))
      mod = e_module_new("wl_desktop_shell");
 
index 8940c24..1040929 100644 (file)
@@ -24,6 +24,7 @@ static Ecore_Idle_Enterer *_e_module_idler = NULL;
 static Eina_List *_e_modules_delayed = NULL;
 static Eina_Bool _e_modules_initting = EINA_FALSE;
 static Eina_Bool _e_modules_init_end = EINA_FALSE;
+static Eina_Bool _e_modules_load_ready = EINA_FALSE;
 
 static Eina_List *_e_module_path_monitors = NULL;
 static Eina_List *_e_module_path_lists = NULL;
@@ -64,11 +65,35 @@ _module_main_cb(void *d, Eio_File *ls EINA_UNUSED, const Eina_File_Direct_Info *
    eina_stringshare_del(s);
 }
 
+#ifdef HAVE_WAYLAND_ONLY
+static Eina_Bool
+_module_wl_interfaces_bound(void *d EINA_UNUSED, int type, void *ev)
+{
+   if (type != ECORE_WL_EVENT_INTERFACES_BOUND) return ECORE_CALLBACK_RENEW;
+
+   if (_e_modules_load_ready) return ECORE_CALLBACK_RENEW;
+   _e_modules_load_ready = EINA_TRUE;
+   e_module_all_load();
+   if (!_e_modules_init_end)
+     {
+        ecore_event_add(E_EVENT_MODULE_INIT_END, NULL, NULL, NULL);
+        _e_modules_init_end = EINA_TRUE;
+     }
+
+   return ECORE_CALLBACK_RENEW;
+}
+#endif
+
 static void
 _module_done_cb(void *d EINA_UNUSED, Eio_File *ls)
 {
    _e_module_path_lists = eina_list_remove(_e_module_path_lists, ls);
    if (_e_module_path_lists) return;
+#ifdef HAVE_WAYLAND_ONLY
+   E_LIST_HANDLER_APPEND(handlers, ECORE_WL_EVENT_INTERFACES_BOUND,
+                         _module_wl_interfaces_bound, NULL);
+#endif
+   if (!_e_modules_load_ready) return;
    if (_e_modules_initting) e_module_all_load();
    else if (!_e_modules_init_end)
      {
@@ -747,12 +772,7 @@ _e_module_dialog_disable_show(const char *title, const char *body, E_Module *m)
 
    printf("MODULE ERR:\n%s\n", body);
 
-   /* FIXME: Stupid hack for ELM_WIN_DIALOG_BASIC not working in wayland */
-#warning REMOVE STUPID ELM HACK FOR WAYLAND BEFORE RELEASE
-   if (e_comp && e_comp->comp_type != E_PIXMAP_TYPE_WL)
-     dia = e_dialog_new(NULL, "E", "_module_unload_dialog");
-   else
-     dia = e_dialog_normal_win_new(NULL, "E", "_module_unload_dialog");
+   dia = e_dialog_new(NULL, "E", "_module_unload_dialog");
 
    EINA_SAFETY_ON_NULL_RETURN(dia);