summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-12-11 11:24:32 -0500
committerChris Michael <cp.michael@samsung.com>2015-12-11 11:24:32 -0500
commit8c85a89303db1eb878655a91f90021b32d04b76a (patch)
tree43fd161f09b7f7e264351276ca041ae007ab0fe6 /src/lib
parentf6804ac1c683c561cc1c2ffab3d316c41348e275 (diff)
ecore-wl2: Add new event for sync done
This removes the usage of ecore_main_loop_iterate inside of the display_connect function. It creates a new event type for when display sync is done, this was we can defer surface creation and EE showing until the compositor has had a chance to synchronize globals. We need this for Enlightenment so that it does not try to create error dialogs too early and thus crash due to not having sync'd globals yet @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h6
-rw-r--r--src/lib/ecore_wl2/ecore_wl2.c3
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c26
3 files changed, 17 insertions, 18 deletions
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
126 int x, y, w, h; 126 int x, y, w, h;
127} Ecore_Wl2_Event_Window_Configure; 127} Ecore_Wl2_Event_Window_Configure;
128 128
129typedef struct _Ecore_Wl2_Event_Sync_Done
130{
131 Ecore_Wl2_Display *display;
132} Ecore_Wl2_Event_Sync_Done;
133
129typedef enum _Ecore_Wl2_Window_Type 134typedef enum _Ecore_Wl2_Window_Type
130{ 135{
131 ECORE_WL2_WINDOW_TYPE_NONE, 136 ECORE_WL2_WINDOW_TYPE_NONE,
@@ -156,6 +161,7 @@ EAPI extern int ECORE_WL2_EVENT_DATA_SOURCE_TARGET;
156EAPI extern int ECORE_WL2_EVENT_DATA_SOURCE_SEND; 161EAPI extern int ECORE_WL2_EVENT_DATA_SOURCE_SEND;
157EAPI extern int ECORE_WL2_EVENT_SELECTION_DATA_READY; 162EAPI extern int ECORE_WL2_EVENT_SELECTION_DATA_READY;
158EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE; 163EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE;
164EAPI extern int ECORE_WL2_EVENT_SYNC_DONE;
159 165
160/** 166/**
161 * @file 167 * @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;
25EAPI int ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0; 25EAPI int ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0;
26EAPI int ECORE_WL2_EVENT_SELECTION_DATA_READY = 0; 26EAPI int ECORE_WL2_EVENT_SELECTION_DATA_READY = 0;
27EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0; 27EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0;
28EAPI int ECORE_WL2_EVENT_SYNC_DONE = 0;
28 29
29/* public API functions */ 30/* public API functions */
30EAPI int 31EAPI int
@@ -75,6 +76,7 @@ ecore_wl2_init(void)
75 ECORE_WL2_EVENT_DATA_SOURCE_SEND = ecore_event_type_new(); 76 ECORE_WL2_EVENT_DATA_SOURCE_SEND = ecore_event_type_new();
76 ECORE_WL2_EVENT_SELECTION_DATA_READY = ecore_event_type_new(); 77 ECORE_WL2_EVENT_SELECTION_DATA_READY = ecore_event_type_new();
77 ECORE_WL2_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); 78 ECORE_WL2_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
79 ECORE_WL2_EVENT_SYNC_DONE = ecore_event_type_new();
78 } 80 }
79 81
80 return _ecore_wl2_init_count; 82 return _ecore_wl2_init_count;
@@ -117,6 +119,7 @@ ecore_wl2_shutdown(void)
117 ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0; 119 ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0;
118 ECORE_WL2_EVENT_SELECTION_DATA_READY = 0; 120 ECORE_WL2_EVENT_SELECTION_DATA_READY = 0;
119 ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0; 121 ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0;
122 ECORE_WL2_EVENT_SYNC_DONE = 0;
120 123
121 /* shutdown Ecore_Event */ 124 /* shutdown Ecore_Event */
122 ecore_event_shutdown(); 125 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
106 wl_registry_bind(registry, id, &xdg_shell_interface, 1); 106 wl_registry_bind(registry, id, &xdg_shell_interface, 1);
107 xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION); 107 xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION);
108 xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL); 108 xdg_shell_add_listener(ewd->wl.xdg_shell, &_xdg_shell_listener, NULL);
109
109 EINA_INLIST_FOREACH(ewd->windows, window) 110 EINA_INLIST_FOREACH(ewd->windows, window)
110 _ecore_wl2_window_shell_surface_init(window); 111 _ecore_wl2_window_shell_surface_init(window);
111 } 112 }
@@ -309,12 +310,19 @@ err:
309static void 310static void
310_cb_sync_done(void *data, struct wl_callback *cb, uint32_t serial EINA_UNUSED) 311_cb_sync_done(void *data, struct wl_callback *cb, uint32_t serial EINA_UNUSED)
311{ 312{
313 Ecore_Wl2_Event_Sync_Done *ev;
312 Ecore_Wl2_Display *ewd; 314 Ecore_Wl2_Display *ewd;
313 315
314 ewd = data; 316 ewd = data;
315 ewd->sync_done = EINA_TRUE; 317 ewd->sync_done = EINA_TRUE;
316 318
317 wl_callback_destroy(cb); 319 wl_callback_destroy(cb);
320
321 ev = calloc(1, sizeof(Ecore_Wl2_Event_Sync_Done));
322 if (!ev) return;
323
324 ev->display = ewd;
325 ecore_event_add(ECORE_WL2_EVENT_SYNC_DONE, ev, NULL, NULL);
318} 326}
319 327
320static const struct wl_callback_listener _sync_listener = 328static const struct wl_callback_listener _sync_listener =
@@ -597,24 +605,6 @@ ecore_wl2_display_connect(const char *name)
597 while (!ewd->sync_done) 605 while (!ewd->sync_done)
598 wl_display_dispatch(ewd->wl.display); 606 wl_display_dispatch(ewd->wl.display);
599 } 607 }
600 else
601 {
602 /* this client is on same pid as server so we need to iterate
603 * main loop until the "server" advertises it's globals
604 *
605 * NB: DO NOT REMOVE THIS !!
606 *
607 * This is NEEDED for E's internal dialogs to function because the
608 * "server" and "client" are on the same PID
609 * and thus the "server" never advertises out it's globals
610 * (wl_compositor, wl_shm, etc) unless we sit here and iterate the
611 * main loop until it's done.
612 *
613 * If we remove this, E will never show an internal dialog as it
614 * just sits and waits for the globals */
615 while (!ewd->sync_done)
616 ecore_main_loop_iterate();
617 }
618 608
619 return ewd; 609 return ewd;
620 610