From: Hosang Kim Date: Tue, 22 Mar 2016 10:47:16 +0000 (+0900) Subject: ecore_wl: add logic for waiting until keyrouter interface is ready. X-Git-Tag: submit/tizen/20160323.021528^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F63178%2F1;p=platform%2Fupstream%2Fefl.git ecore_wl: add logic for waiting until keyrouter interface is ready. Sometimes keyrouter interface is not ready. Signed-off-by: Hosang Kim Change-Id: I22ca3c74295b5a4e2b22676cf57ba43ef43b0a9b --- diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c index c5e8336..586d373 100644 --- a/src/lib/ecore_wayland/ecore_wl.c +++ b/src/lib/ecore_wayland/ecore_wl.c @@ -1146,7 +1146,18 @@ ecore_wl_window_keygrab_set(Ecore_Wl_Window *win, const char *key, int mod EINA_ LOGFN(__FILE__, __LINE__, __FUNCTION__); - if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.keyrouter)) return EINA_FALSE; + if (!_ecore_wl_disp) return EINA_FALSE; + if (!_ecore_wl_disp->wl.keyrouter) + { + int loop_count = 5; + INF("Wait until keyrouter interface is ready"); + while((!_ecore_wl_disp->wl.keyrouter) && (loop_count > 0)) + { + wl_display_roundtrip(_ecore_wl_disp->wl.display); + loop_count--; + } + if (!_ecore_wl_disp->wl.keyrouter) return EINA_FALSE; + } if (!key) return EINA_FALSE; if ((grab_mode < ECORE_WL_WINDOW_KEYGRAB_UNKNOWN) || (grab_mode > ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE)) return EINA_FALSE;