raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=cc1ff312768c3915516e1d8c36e6d4c382de830a

commit cc1ff312768c3915516e1d8c36e6d4c382de830a
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Sun Dec 8 15:05:51 2013 +0900

    ecore loop + animator - add call to get if an animator cb has run this iter
    
    this adds a simple call and infra to get if an animator has run this
    iteration. it's simple and not really useful other than internally to
    efl.
---
 src/lib/ecore/Ecore_Common.h  |  1 +
 src/lib/ecore/ecore_anim.c    | 14 ++++++++++++++
 src/lib/ecore/ecore_main.c    | 23 ++++++++++++++++++++++-
 src/lib/ecore/ecore_private.h |  2 ++
 4 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore/Ecore_Common.h b/src/lib/ecore/Ecore_Common.h
index 39feead..2fad5c1 100644
--- a/src/lib/ecore/Ecore_Common.h
+++ b/src/lib/ecore/Ecore_Common.h
@@ -73,6 +73,7 @@ EAPI void ecore_main_loop_glib_always_integrate_disable(void);
 
 EAPI void ecore_main_loop_begin(void);
 EAPI void ecore_main_loop_quit(void);
+EAPI Eina_Bool ecore_main_loop_animator_ticked_get(void);
 
 /**
  * @typedef Ecore_Cb Ecore_Cb
diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c
index dd76daf..2bdd8d1 100644
--- a/src/lib/ecore/ecore_anim.c
+++ b/src/lib/ecore/ecore_anim.c
@@ -53,6 +53,7 @@ static Ecore_Cb begin_tick_cb = NULL;
 static const void *begin_tick_data = NULL;
 static Ecore_Cb end_tick_cb = NULL;
 static const void *end_tick_data = NULL;
+static Eina_Bool animator_ran = EINA_FALSE;
 
 static void
 _begin_tick(void)
@@ -114,6 +115,7 @@ _do_tick(void)
             (!animator->suspended) && 
             (!animator->just_added))
           {
+             animator_ran = EINA_TRUE;
              if (!_ecore_call_task_cb(animator->func, animator->data))
                {
                   animator->delete_me = EINA_TRUE;
@@ -657,6 +659,18 @@ _ecore_animator_shutdown(void)
      }
 }
 
+void
+_ecore_animator_run_reset(void)
+{
+   animator_ran = EINA_FALSE;
+}
+
+Eina_Bool
+_ecore_animator_run_get(void)
+{
+   return animator_ran;
+}
+
 static Eina_Bool
 _ecore_animator_run(void *data)
 {
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index 045ccb1..44fb957 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -707,6 +707,7 @@ _ecore_main_gsource_dispatch(GSource    *source EINA_UNUSED,
 
    if (ecore_idling && events_ready)
      {
+        _ecore_animator_run_reset();
         _ecore_idle_exiter_call();
         ecore_idling = 0;
      }
@@ -723,6 +724,7 @@ _ecore_main_gsource_dispatch(GSource    *source EINA_UNUSED,
 
         if (ecore_fds_ready || events_ready || timers_ready)
           {
+             _ecore_animator_run_reset();
              _ecore_idle_exiter_call();
              ecore_idling = 0;
           }
@@ -1067,6 +1069,21 @@ ecore_main_loop_quit(void)
 }
 
 /**
+ * Returns if an animator has ticked off during this loop iteration
+ *
+ * @return EINA_TRUE if an animator has been called, EINA_FALSE otherwise.
+ *
+ * There should be little need for anyone to use this - ever.
+ *
+ * @since 1.9
+ */
+EAPI Eina_Bool
+ecore_main_loop_animator_ticked_get(void)
+{
+   return _ecore_animator_run_get();
+}
+
+/**
  * Sets the function to use when monitoring multiple file descriptors,
  * and waiting until one of more of the file descriptors before ready
  * for some class of I/O operation.
@@ -2002,7 +2019,11 @@ start_loop: 
/***************************************************************/
 process_all: /***********************************************************/
 
    /* we came out of our "wait state" so idle has exited */
-   if (!once_only) _ecore_idle_exiter_call();
+   if (!once_only)
+     {
+        _ecore_animator_run_reset();
+        _ecore_idle_exiter_call();
+     }
    /* call the fd handler per fd that became alive... */
    /* this should read or write any data to the monitored fd and then */
    /* post events onto the ecore event pipe if necessary */
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index 1c7f53e..f6a2d55 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -219,6 +219,8 @@ void       _ecore_exe_event_del_free(void *data,
 #endif
 
 void _ecore_animator_shutdown(void);
+void _ecore_animator_run_reset(void);
+Eina_Bool _ecore_animator_run_get(void);
 
 void _ecore_poller_shutdown(void);
 

-- 


Reply via email to