From fe215f34816ce0bdb2aa6372558d2cbff2760c2a Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Wed, 18 May 2016 14:53:21 +0900 Subject: [PATCH] ecore_wl_input: add logic for waiting until "wl input" is ready Sometimes wl input is not ready, because it is async process to create wl input. Signed-off-by: Hosang Kim Change-Id: I8869fb51f178425830dc1ff3825c60e2b7920b68 --- src/lib/ecore_wayland/ecore_wl_input.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lib/ecore_wayland/ecore_wl_input.c b/src/lib/ecore_wayland/ecore_wl_input.c index 2d69823..0cb097e 100644 --- a/src/lib/ecore_wayland/ecore_wl_input.c +++ b/src/lib/ecore_wayland/ecore_wl_input.c @@ -399,6 +399,25 @@ ecore_wl_input_cursor_default_restore(Ecore_Wl_Input *input) EAPI Ecore_Wl_Input * ecore_wl_input_get(void) { + if (!_ecore_wl_disp) + { + ERR("Ecore_Wl_Display doesn't exist"); + return NULL; + } + if (!_ecore_wl_disp->input) + { + int loop_count = 5; + while ((!_ecore_wl_disp->input) && (loop_count > 0)) + { + if (!_ecore_wl_disp->wl.display) + { + ERR("Wayland display doesn't exist"); + return NULL; + } + wl_display_roundtrip(_ecore_wl_disp->wl.display); + loop_count--; + } + } return _ecore_wl_disp->input; } -- 2.7.4