ecore_wl_input: add logic for waiting until "wl input" is ready 08/70108/2
authorHosang Kim <hosang12.kim@samsung.com>
Wed, 18 May 2016 05:53:21 +0000 (14:53 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Wed, 18 May 2016 07:41:24 +0000 (16:41 +0900)
Sometimes wl input is not ready, because it is async process to create
wl input.
Signed-off-by: Hosang Kim <hosang12.kim@samsung.com>
Change-Id: I8869fb51f178425830dc1ff3825c60e2b7920b68

src/lib/ecore_wayland/ecore_wl_input.c

index 2d69823..0cb097e 100644 (file)
@@ -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;
 }