summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2013-10-28 14:46:40 -0200
committerRafael Antognolli <rafael.antognolli@intel.com>2013-10-28 14:46:40 -0200
commitad731e8b213ff38fed95f069a3ba79aba339925a (patch)
treebae2bdb1c2367f7206f5d70d439d6dc4c4ede0d3 /src/lib/ecore_wayland
parentb87afd1b943b260c92f8493647b7d9cae327656e (diff)
Revert "change init done bindings."
This reverts commit b87afd1b943b260c92f8493647b7d9cae327656e. Wrong branch, wrong commit.
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r--src/lib/ecore_wayland/Ecore_Wayland.h6
-rw-r--r--src/lib/ecore_wayland/ecore_wl.c65
2 files changed, 16 insertions, 55 deletions
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h
index 15c59405e9..30545b7343 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -120,8 +120,6 @@ struct _Ecore_Wl_Display
120 struct wl_list outputs; 120 struct wl_list outputs;
121 struct wl_list globals; /** @since 1.7.6 */ 121 struct wl_list globals; /** @since 1.7.6 */
122 122
123 Eina_Bool init_done;
124
125 struct 123 struct
126 { 124 {
127 struct xkb_context *context; 125 struct xkb_context *context;
@@ -368,10 +366,6 @@ struct _Ecore_Wl_Event_Interfaces_Bound
368 Eina_Bool compositor : 1; 366 Eina_Bool compositor : 1;
369 Eina_Bool shm : 1; 367 Eina_Bool shm : 1;
370 Eina_Bool shell : 1; 368 Eina_Bool shell : 1;
371 Eina_Bool output : 1;
372 Eina_Bool seat : 1;
373 Eina_Bool data_device_manager : 1;
374 Eina_Bool subcompositor : 1;
375}; 369};
376 370
377/** 371/**
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index 8766834e7e..ee614e0e4b 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -22,7 +22,6 @@ static void _ecore_wl_animator_callback(void *data, struct wl_callback *callback
22static Eina_Bool _ecore_wl_animator_window_add(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED); 22static Eina_Bool _ecore_wl_animator_window_add(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED);
23static void _ecore_wl_signal_exit(void); 23static void _ecore_wl_signal_exit(void);
24static void _ecore_wl_signal_exit_free(void *data EINA_UNUSED, void *event); 24static void _ecore_wl_signal_exit_free(void *data EINA_UNUSED, void *event);
25static void _ecore_wl_init_callback(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED);
26 25
27/* local variables */ 26/* local variables */
28static int _ecore_wl_init_count = 0; 27static int _ecore_wl_init_count = 0;
@@ -41,11 +40,6 @@ static const struct wl_callback_listener _ecore_wl_sync_listener =
41 _ecore_wl_sync_callback 40 _ecore_wl_sync_callback
42}; 41};
43 42
44static const struct wl_callback_listener _ecore_wl_init_sync_listener =
45{
46 _ecore_wl_init_callback
47};
48
49static const struct wl_callback_listener _ecore_wl_anim_listener = 43static const struct wl_callback_listener _ecore_wl_anim_listener =
50{ 44{
51 _ecore_wl_animator_callback 45 _ecore_wl_animator_callback
@@ -72,40 +66,9 @@ EAPI int ECORE_WL_EVENT_SELECTION_DATA_READY = 0;
72EAPI int ECORE_WL_EVENT_DATA_SOURCE_CANCELLED = 0; 66EAPI int ECORE_WL_EVENT_DATA_SOURCE_CANCELLED = 0;
73EAPI int ECORE_WL_EVENT_INTERFACES_BOUND = 0; 67EAPI int ECORE_WL_EVENT_INTERFACES_BOUND = 0;
74 68
75static void
76_ecore_wl_init_callback(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED)
77{
78 Ecore_Wl_Display *ewd = data;
79 Ecore_Wl_Event_Interfaces_Bound *ev;
80
81 wl_callback_destroy(callback);
82 ewd->init_done = EINA_TRUE;
83
84 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Interfaces_Bound))))
85 return;
86
87 ev->compositor = (ewd->wl.compositor != NULL);
88 ev->shm = (ewd->wl.shm != NULL);
89 ev->shell = (ewd->wl.shell != NULL);
90 ev->output = (ewd->output != NULL);
91 ev->seat = (ewd->input != NULL);
92 ev->data_device_manager = (ewd->wl.data_device_manager != NULL);
93 ev->subcompositor = (ewd->wl.subcompositor != NULL);
94
95 ecore_event_add(ECORE_WL_EVENT_INTERFACES_BOUND, ev, NULL, NULL);
96}
97
98static void
99_ecore_wl_init_wait(void)
100{
101 while (!_ecore_wl_disp->init_done)
102 wl_display_dispatch(_ecore_wl_disp->wl.display);
103}
104
105EAPI int 69EAPI int
106ecore_wl_init(const char *name) 70ecore_wl_init(const char *name)
107{ 71{
108 struct wl_callback *callback;
109 LOGFN(__FILE__, __LINE__, __FUNCTION__); 72 LOGFN(__FILE__, __LINE__, __FUNCTION__);
110 73
111 if (++_ecore_wl_init_count != 1) return _ecore_wl_init_count; 74 if (++_ecore_wl_init_count != 1) return _ecore_wl_init_count;
@@ -218,10 +181,6 @@ ecore_wl_init(const char *name)
218 _ecore_wl_window_init(); 181 _ecore_wl_window_init();
219 _ecore_wl_events_init(); 182 _ecore_wl_events_init();
220 183
221 callback = wl_display_sync(_ecore_wl_disp->wl.display);
222 wl_callback_add_listener(callback, &_ecore_wl_init_sync_listener,
223 _ecore_wl_disp);
224
225 return _ecore_wl_init_count; 184 return _ecore_wl_init_count;
226} 185}
227 186
@@ -253,9 +212,6 @@ EAPI struct wl_shm *
253ecore_wl_shm_get(void) 212ecore_wl_shm_get(void)
254{ 213{
255 if (!_ecore_wl_disp) return NULL; 214 if (!_ecore_wl_disp) return NULL;
256
257 _ecore_wl_init_wait();
258
259 return _ecore_wl_disp->wl.shm; 215 return _ecore_wl_disp->wl.shm;
260} 216}
261 217
@@ -272,9 +228,6 @@ ecore_wl_globals_get(void)
272{ 228{
273 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) 229 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display))
274 return NULL; 230 return NULL;
275
276 _ecore_wl_init_wait();
277
278 return &(_ecore_wl_disp->globals); 231 return &(_ecore_wl_disp->globals);
279} 232}
280 233
@@ -283,7 +236,6 @@ ecore_wl_registry_get(void)
283{ 236{
284 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) 237 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display))
285 return NULL; 238 return NULL;
286
287 return _ecore_wl_disp->wl.registry; 239 return _ecore_wl_disp->wl.registry;
288} 240}
289 241
@@ -297,7 +249,8 @@ ecore_wl_screen_size_get(int *w, int *h)
297 249
298 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return; 250 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return;
299 251
300 _ecore_wl_init_wait(); 252 if (!_ecore_wl_disp->output)
253 ecore_wl_sync();
301 254
302 if (!_ecore_wl_disp->output) return; 255 if (!_ecore_wl_disp->output) return;
303 256
@@ -592,6 +545,20 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
592 ewd->wl.data_device_manager = 545 ewd->wl.data_device_manager =
593 wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1); 546 wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1);
594 } 547 }
548
549 if ((ewd->wl.compositor) && (ewd->wl.shm) && (ewd->wl.shell))
550 {
551 Ecore_Wl_Event_Interfaces_Bound *ev;
552
553 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Interfaces_Bound))))
554 return;
555
556 ev->compositor = (ewd->wl.compositor != NULL);
557 ev->shm = (ewd->wl.shm != NULL);
558 ev->shell = (ewd->wl.shell != NULL);
559
560 ecore_event_add(ECORE_WL_EVENT_INTERFACES_BOUND, ev, NULL, NULL);
561 }
595} 562}
596 563
597static void 564static void