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.
This commit is contained in:
Carsten Haitzler 2013-12-08 15:05:51 +09:00
parent de7b7f381c
commit cc1ff31276
4 changed files with 39 additions and 1 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -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;
}
@ -1066,6 +1068,21 @@ ecore_main_loop_quit(void)
#endif
}
/**
* 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
@ -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 */

View File

@ -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);