diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 6c91e79d8d..dc050e021a 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -126,6 +126,11 @@ typedef struct _Ecore_Wl2_Event_Window_Configure int x, y, w, h; } Ecore_Wl2_Event_Window_Configure; +typedef struct _Ecore_Wl2_Event_Sync_Done +{ + Ecore_Wl2_Display *display; +} Ecore_Wl2_Event_Sync_Done; + typedef enum _Ecore_Wl2_Window_Type { ECORE_WL2_WINDOW_TYPE_NONE, @@ -156,6 +161,7 @@ EAPI extern int ECORE_WL2_EVENT_DATA_SOURCE_TARGET; EAPI extern int ECORE_WL2_EVENT_DATA_SOURCE_SEND; EAPI extern int ECORE_WL2_EVENT_SELECTION_DATA_READY; EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE; +EAPI extern int ECORE_WL2_EVENT_SYNC_DONE; /** * @file diff --git a/src/lib/ecore_wl2/ecore_wl2.c b/src/lib/ecore_wl2/ecore_wl2.c index c0edc56f2a..a8d328b7d0 100644 --- a/src/lib/ecore_wl2/ecore_wl2.c +++ b/src/lib/ecore_wl2/ecore_wl2.c @@ -25,6 +25,7 @@ EAPI int ECORE_WL2_EVENT_DATA_SOURCE_TARGET = 0; EAPI int ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0; EAPI int ECORE_WL2_EVENT_SELECTION_DATA_READY = 0; EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0; +EAPI int ECORE_WL2_EVENT_SYNC_DONE = 0; /* public API functions */ EAPI int @@ -75,6 +76,7 @@ ecore_wl2_init(void) ECORE_WL2_EVENT_DATA_SOURCE_SEND = ecore_event_type_new(); ECORE_WL2_EVENT_SELECTION_DATA_READY = ecore_event_type_new(); ECORE_WL2_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); + ECORE_WL2_EVENT_SYNC_DONE = ecore_event_type_new(); } return _ecore_wl2_init_count; @@ -117,6 +119,7 @@ ecore_wl2_shutdown(void) ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0; ECORE_WL2_EVENT_SELECTION_DATA_READY = 0; ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0; + ECORE_WL2_EVENT_SYNC_DONE = 0; /* shutdown Ecore_Event */ ecore_event_shutdown(); diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index f38db3b714..57f1af3bf2 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -106,6 +106,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const wl_registry_bind(registry, id, &xdg_shell_interface, 1); xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION); xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL); + EINA_INLIST_FOREACH(ewd->windows, window) _ecore_wl2_window_shell_surface_init(window); } @@ -309,12 +310,19 @@ err: static void _cb_sync_done(void *data, struct wl_callback *cb, uint32_t serial EINA_UNUSED) { + Ecore_Wl2_Event_Sync_Done *ev; Ecore_Wl2_Display *ewd; ewd = data; ewd->sync_done = EINA_TRUE; wl_callback_destroy(cb); + + ev = calloc(1, sizeof(Ecore_Wl2_Event_Sync_Done)); + if (!ev) return; + + ev->display = ewd; + ecore_event_add(ECORE_WL2_EVENT_SYNC_DONE, ev, NULL, NULL); } static const struct wl_callback_listener _sync_listener = @@ -597,24 +605,6 @@ ecore_wl2_display_connect(const char *name) while (!ewd->sync_done) wl_display_dispatch(ewd->wl.display); } - else - { - /* this client is on same pid as server so we need to iterate - * main loop until the "server" advertises it's globals - * - * NB: DO NOT REMOVE THIS !! - * - * This is NEEDED for E's internal dialogs to function because the - * "server" and "client" are on the same PID - * and thus the "server" never advertises out it's globals - * (wl_compositor, wl_shm, etc) unless we sit here and iterate the - * main loop until it's done. - * - * If we remove this, E will never show an internal dialog as it - * just sits and waits for the globals */ - while (!ewd->sync_done) - ecore_main_loop_iterate(); - } return ewd;