This patch add the possibility to delay a timer and to know the

pending time before the next wake up.

They should not affect any current code using the timer.

--
Cedric BAIL


SVN revision: 34250
This commit is contained in:
Carsten Haitzler 2008-04-11 23:39:55 +00:00
parent 0afa61a56a
commit 57ecfa2b1f
2 changed files with 56 additions and 2 deletions

View File

@ -606,7 +606,7 @@ if test "x$have_ecore_fb" = "xyes" -a "x$have_ecore_evas" = "xyes"; then
AC_MSG_RESULT($want_ecore_evas_fb)
if test "x$want_ecore_evas_fb" = "xyes"; then
PKG_CHECK_MODULES(EVAS_FRAMEBUFFER, evas-framebuffer,
PKG_CHECK_MODULES(EVAS_FB, evas-fb,
[
AC_DEFINE(BUILD_ECORE_EVAS_FB, 1, [Support for Linux FB in Ecore_Evas])
have_ecore_evas_fb="yes"

View File

@ -97,7 +97,61 @@ ecore_timer_interval_set(Ecore_Timer *timer, double in)
}
/**
*
* Add some delay for the next occurence of a timer.
* This doesn't affect the interval of a timer.
*
* @param timer The timer to change.
* @param add The dalay to add to the next iteration.
* @ingroup Ecore_Time_Group
*/
EAPI void
ecore_timer_delay(Ecore_Timer *timer, double add)
{
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
{
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
"ecore_timer_delay");
return;
}
if (timer->frozen)
{
timer->pending += add;
}
else
{
timers = _ecore_list2_remove(timers, timer);
_ecore_timer_set(timer, timer->at + add, timer->in, timer->func, timer->data);
}
}
/**
* Get the pending time regarding a timer.
*
* @param timer The timer to learn from.
* @ingroup Ecore_Time_Group
*/
EAPI double
ecore_timer_pending_get(Ecore_Timer *timer)
{
double now;
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
{
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
"ecore_timer_pending_get");
return 0;
}
now = ecore_time_get();
if (timer->frozen)
return timer->pending;
return timer->at - now;
}
/**
*
*
*/
EAPI void