add code to check return value of wl_display_dispatch_queue 59/311259/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Fri, 17 May 2024 02:18:17 +0000 (11:18 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Fri, 17 May 2024 02:20:51 +0000 (11:20 +0900)
Change-Id: Ifa52a5df24764e485d55977fee4e3460435c5574

src/efl_util.c

index 91ced99..4821b39 100644 (file)
@@ -718,6 +718,7 @@ efl_util_set_notification_window_level(Evas_Object *window,
    struct wl_surface *surface;
    Efl_Util_Wl_Surface_Lv_Info *lv_info;
    Ecore_Wl2_Window_Type wl_type;
+   int ret_dispatch = 0;
 
    res = _wl_init();
    EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -733,8 +734,8 @@ efl_util_set_notification_window_level(Evas_Object *window,
                                         EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
      }
 
-   while (!_eflutil.wl.policy.proto)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while (!_eflutil.wl.policy.proto && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    surface = ecore_wl2_window_surface_get(wlwin);
    EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
@@ -771,10 +772,11 @@ efl_util_set_notification_window_level(Evas_Object *window,
    if (lv_info->wait_for_done)
      {
         int count = 0;
-        while (lv_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT))
+        ret_dispatch = 0;
+        while (lv_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT) && (ret_dispatch != -1))
           {
              ecore_wl2_display_flush(_eflutil.wl.wl2_display);
-             wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+             ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
              count++;
           }
 
@@ -808,6 +810,7 @@ efl_util_get_notification_window_level(Evas_Object *window,
    struct wl_surface *surface;
    Efl_Util_Wl_Surface_Lv_Info *lv_info;
    Ecore_Wl2_Window_Type wl_type;
+   int ret_dispatch = 0;
 
    res = _wl_init();
    EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -823,8 +826,8 @@ efl_util_get_notification_window_level(Evas_Object *window,
                                         EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
      }
 
-   while (!_eflutil.wl.policy.proto)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while (!_eflutil.wl.policy.proto && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    surface = ecore_wl2_window_surface_get(wlwin);
    EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
@@ -836,10 +839,11 @@ efl_util_get_notification_window_level(Evas_Object *window,
         if (lv_info->wait_for_done)
           {
              int count = 0;
-             while ((lv_info->wait_for_done) && (count < NUM_EVENT_WAIT_DONE_COUNT))
+             ret_dispatch = 0;
+             while ((lv_info->wait_for_done) && (count < NUM_EVENT_WAIT_DONE_COUNT) && (ret_dispatch != -1))
                {
                   ecore_wl2_display_flush(_eflutil.wl.wl2_display);
-                  wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+                  ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
                   count++;
                }
 
@@ -920,6 +924,7 @@ efl_util_set_window_screen_mode(Evas_Object *window,
    struct wl_surface *surface;
    Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
    Eina_Bool res;
+   int ret_dispatch = 0;
 
    res = _wl_init();
    EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -927,8 +932,8 @@ efl_util_set_window_screen_mode(Evas_Object *window,
    wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
    if (wlwin)
      {
-        while (!_eflutil.wl.policy.proto)
-          wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+        while (!_eflutil.wl.policy.proto && (ret_dispatch != -1))
+          ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
         surface = ecore_wl2_window_surface_get(wlwin);
         EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
@@ -961,10 +966,11 @@ efl_util_set_window_screen_mode(Evas_Object *window,
         if (scr_mode_info->wait_for_done)
           {
              int count = 0;
-             while (scr_mode_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT))
+             ret_dispatch = 0;
+             while (scr_mode_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT) && (ret_dispatch != -1))
                {
                   ecore_wl2_display_flush(_eflutil.wl.wl2_display);
-                  wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+                  ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
                   count++;
                }
 
@@ -998,6 +1004,7 @@ efl_util_get_window_screen_mode(Evas_Object *window,
    struct wl_surface *surface;
    Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
    Eina_Bool res;
+   int ret_dispatch = 0;
 
    res = _wl_init();
    EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -1005,8 +1012,8 @@ efl_util_get_window_screen_mode(Evas_Object *window,
    wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
    if (wlwin)
      {
-        while (!_eflutil.wl.policy.proto)
-          wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+        while (!_eflutil.wl.policy.proto && (ret_dispatch != -1))
+          ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
         surface = ecore_wl2_window_surface_get(wlwin);
         EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
@@ -1017,10 +1024,11 @@ efl_util_get_window_screen_mode(Evas_Object *window,
           {
              if (scr_mode_info->wait_for_done)
                {
-                  while (scr_mode_info->wait_for_done)
+                  ret_dispatch = 0;
+                  while (scr_mode_info->wait_for_done && (ret_dispatch != -1))
                     {
                        ecore_wl2_display_flush(_eflutil.wl.wl2_display);
-                       wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+                       ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
                     }
                }
 
@@ -1050,6 +1058,7 @@ efl_util_set_window_brightness(Evas_Object *window, int brightness)
    struct wl_surface *surface;
    Efl_Util_Wl_Surface_Brightness_Info *brightness_info;
    Eina_Bool res;
+   int ret_dispatch = 0;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
    EINA_SAFETY_ON_FALSE_RETURN_VAL(brightness <= 100, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -1060,8 +1069,8 @@ efl_util_set_window_brightness(Evas_Object *window, int brightness)
    wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
    if (wlwin)
      {
-        while (!_eflutil.wl.display_policy.proto)
-          wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+        while (!_eflutil.wl.display_policy.proto  && (ret_dispatch != -1))
+          ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
         surface = ecore_wl2_window_surface_get(wlwin);
         EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
@@ -1094,10 +1103,11 @@ efl_util_set_window_brightness(Evas_Object *window, int brightness)
          if (brightness_info->wait_for_done)
            {
               int count = 0;
-              while (brightness_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT))
+              ret_dispatch = 0;
+              while (brightness_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT) && (ret_dispatch != -1))
                 {
                    ecore_wl2_display_flush(_eflutil.wl.wl2_display);
-                   wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+                   ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
                    count++;
                 }
 
@@ -1126,6 +1136,7 @@ efl_util_get_window_brightness(Evas_Object *window, int *brightness)
    struct wl_surface *surface;
    Efl_Util_Wl_Surface_Brightness_Info *brightness_info;
    Eina_Bool res;
+   int ret_dispatch = 0;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
    EINA_SAFETY_ON_NULL_RETURN_VAL(brightness, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -1136,8 +1147,8 @@ efl_util_get_window_brightness(Evas_Object *window, int *brightness)
    wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
    if (!wlwin) return EFL_UTIL_ERROR_INVALID_PARAMETER;
 
-   while (!_eflutil.wl.display_policy.proto)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while (!_eflutil.wl.display_policy.proto && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    surface = ecore_wl2_window_surface_get(wlwin);
    EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
@@ -1148,10 +1159,11 @@ efl_util_get_window_brightness(Evas_Object *window, int *brightness)
      {
         if (brightness_info->wait_for_done)
           {
-             while (brightness_info->wait_for_done)
+             ret_dispatch = 0;
+             while (brightness_info->wait_for_done && (ret_dispatch != -1))
                {
                   ecore_wl2_display_flush(_eflutil.wl.wl2_display);
-                  wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+                  ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
                }
           }
          *brightness = brightness_info->brightness;
@@ -1243,6 +1255,7 @@ _efl_util_input_create_inputgen(unsigned int dev_type, const char *name, int *re
 {
    efl_util_inputgen_h inputgen_h = NULL;
    unsigned int clas = 0x0;
+   int ret_dispatch = 0;
 
    if (!dev_type ||
         dev_type & ~(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN
@@ -1281,8 +1294,8 @@ _efl_util_input_create_inputgen(unsigned int dev_type, const char *name, int *re
    if (dev_type & EFL_UTIL_INPUT_DEVTYPE_POINTER)
      clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE;
 
-   while (!_eflutil.wl.devmgr.devicemgr)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while (!_eflutil.wl.devmgr.devicemgr && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    if (with_name == 2)
       tizen_input_device_manager_init_generator_with_sync(_eflutil.wl.devmgr.devicemgr, clas, inputgen_h->name);
@@ -1291,9 +1304,9 @@ _efl_util_input_create_inputgen(unsigned int dev_type, const char *name, int *re
    else
       tizen_input_device_manager_init_generator(_eflutil.wl.devmgr.devicemgr, clas);
 
-
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   ret_dispatch = 0;
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    *ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;
@@ -1356,6 +1369,7 @@ API int
 efl_util_input_set_touch_count(int max_count)
 {
    int ret = EFL_UTIL_ERROR_NONE;
+   int ret_dispatch = 0;
 
    ret = _wl_init();
    if (ret == (int)EINA_FALSE)
@@ -1363,16 +1377,17 @@ efl_util_input_set_touch_count(int max_count)
         return EFL_UTIL_ERROR_INVALID_PARAMETER;
      }
 
-   while (!_eflutil.wl.devmgr.devicemgr)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while (!_eflutil.wl.devmgr.devicemgr && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    if (_eflutil.wl.devmgr.max_touch_count >= max_count)
      return EFL_UTIL_ERROR_NONE;
 
    tizen_input_device_manager_set_touch_count(_eflutil.wl.devmgr.devicemgr, max_count);
 
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   ret_dispatch = 0;
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;
@@ -1390,6 +1405,7 @@ efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h)
 {
    int ret = EFL_UTIL_ERROR_NONE;
    unsigned int clas = 0x0;
+   int ret_dispatch = 0;
    EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
 
    if (inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
@@ -1409,8 +1425,8 @@ efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h)
 
    tizen_input_device_manager_deinit_generator(_eflutil.wl.devmgr.devicemgr, clas);
 
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;
@@ -1422,6 +1438,7 @@ API int
 efl_util_input_generate_key(efl_util_inputgen_h inputgen_h, const char *key_name, int pressed)
 {
    int ret = EFL_UTIL_ERROR_NONE;
+   int ret_dispatch = 0;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
    EINA_SAFETY_ON_NULL_RETURN_VAL(key_name, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -1432,8 +1449,8 @@ efl_util_input_generate_key(efl_util_inputgen_h inputgen_h, const char *key_name
 
    tizen_input_device_manager_generate_key(_eflutil.wl.devmgr.devicemgr, key_name, pressed);
 
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;
@@ -1446,6 +1463,7 @@ efl_util_input_generate_touch(efl_util_inputgen_h inputgen_h, int idx,
                               efl_util_input_touch_type_e touch_type, int x, int y)
 {
    int ret;
+   int ret_dispatch = 0;
    enum tizen_input_device_manager_pointer_event_type type;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -1454,8 +1472,9 @@ efl_util_input_generate_touch(efl_util_inputgen_h inputgen_h, int idx,
    EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, EFL_UTIL_ERROR_NO_SUCH_DEVICE);
 
    if (_eflutil.wl.devmgr.request_touch_count != 0 &&
-       _eflutil.wl.devmgr.max_touch_count != _eflutil.wl.devmgr.request_touch_count)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+       _eflutil.wl.devmgr.max_touch_count != _eflutil.wl.devmgr.request_touch_count &&
+       (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    if (idx >= _eflutil.wl.devmgr.max_touch_count)
      return EFL_UTIL_ERROR_INVALID_PARAMETER;
@@ -1479,8 +1498,9 @@ efl_util_input_generate_touch(efl_util_inputgen_h inputgen_h, int idx,
 
    tizen_input_device_manager_generate_touch(_eflutil.wl.devmgr.devicemgr, type, x, y, idx);
 
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   ret_dispatch = 0;
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;
@@ -1492,11 +1512,12 @@ static int
 _efl_util_input_generate_touch_axis_send(unsigned int type, double value)
 {
    int ret;
+   int ret_dispatch = 0;
 
    tizen_input_device_manager_generate_axis(_eflutil.wl.devmgr.devicemgr, type, wl_fixed_from_double(value));
 
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;
@@ -1583,6 +1604,7 @@ efl_util_input_generate_touch_axis(efl_util_inputgen_h inputgen_h, int idx,
                                    double pressure, double angle, double palm)
 {
    int ret, version;
+   int ret_dispatch = 0;
    enum tizen_input_device_manager_pointer_event_type type;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -1618,8 +1640,8 @@ efl_util_input_generate_touch_axis(efl_util_inputgen_h inputgen_h, int idx,
 
    tizen_input_device_manager_generate_touch(_eflutil.wl.devmgr.devicemgr, type, x, y, idx);
 
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;
@@ -1632,6 +1654,7 @@ API int
 efl_util_input_generate_pointer(efl_util_inputgen_h inputgen_h, int buttons, efl_util_input_pointer_type_e pointer_type, int x, int y)
 {
    int ret;
+   int ret_dispatch = 0;
    enum tizen_input_device_manager_pointer_event_type type;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -1658,8 +1681,8 @@ efl_util_input_generate_pointer(efl_util_inputgen_h inputgen_h, int buttons, efl
 
    tizen_input_device_manager_generate_pointer(_eflutil.wl.devmgr.devicemgr, type, x, y, buttons);
 
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;
@@ -1671,6 +1694,7 @@ API int
 efl_util_input_generate_wheel(efl_util_inputgen_h inputgen_h, efl_util_input_pointer_wheel_type_e wheel_type, int value)
 {
    int ret, version;
+   int ret_dispatch = 0;
    enum tizen_input_device_manager_pointer_event_type type;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
@@ -1694,8 +1718,8 @@ efl_util_input_generate_wheel(efl_util_inputgen_h inputgen_h, efl_util_input_poi
 
    tizen_input_device_manager_generate_axis(_eflutil.wl.devmgr.devicemgr, type, wl_fixed_from_int(value));
 
-   while (_eflutil.wl.devmgr.request_notified == -1)
-     wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+   while ((_eflutil.wl.devmgr.request_notified == -1) && (ret_dispatch != -1))
+     ret_dispatch = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
 
    ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
    _eflutil.wl.devmgr.request_notified = -1;