ecore: Only dispatch if we have something to do
authormike_m <mike_m@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 5 Jul 2011 11:13:39 +0000 (11:13 +0000)
committermike_m <mike_m@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 5 Jul 2011 11:13:39 +0000 (11:13 +0000)
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@61042 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore/ecore_main.c

index e739398..ff67821 100644 (file)
@@ -485,8 +485,23 @@ _ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
 static gboolean
 _ecore_main_gsource_check(GSource *source __UNUSED__)
 {
+   gboolean ret = FALSE;
+
    in_main_loop++;
 
+   /* check if old timers expired */
+   if (ecore_idling && !_ecore_idler_exist())
+     {
+        if (_ecore_timers_exists())
+          {
+             double next_time = _ecore_timer_next_get();
+             ret = _ecore_timers_exists() && (0.0 >= next_time);
+          }
+     }
+   else
+        ret = TRUE;
+
+   /* check if fds are ready */
    ecore_fds_ready = (_ecore_main_fdh_poll_mark_active() > 0);
    _ecore_main_fd_handlers_cleanup();
 
@@ -495,7 +510,7 @@ _ecore_main_gsource_check(GSource *source __UNUSED__)
 
    in_main_loop--;
 
-   return TRUE; /* always dispatch */
+   return ret || ecore_fds_ready;
 }
 
 /* like we just came out of main_loop_select in  _ecore_main_select */