kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=0981a53f1bdc14bb1e7522665092fdffbcc00a4a

commit 0981a53f1bdc14bb1e7522665092fdffbcc00a4a
Author: Kim Woelders <[email protected]>
Date:   Tue Dec 30 14:42:13 2014 +0100

    Fix animation bug.
    
    If animators are added within 1 ms from a call to _AnimatorsTimer()
    in a previous event loop run, the animation timer might not be
    rescheduled properly.
---
 src/E.h         |  3 ++-
 src/animation.c | 11 +++++++----
 src/events.c    |  3 ++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/E.h b/src/E.h
index 13b9d42..9761c18 100644
--- a/src/E.h
+++ b/src/E.h
@@ -3,7 +3,7 @@
 /*****************************************************************************/
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2014 Kim Woelders
+ * Copyright (C) 2004-2015 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -352,6 +352,7 @@ typedef struct {
 #endif
    } display;
    struct {
+      unsigned int        seqn;        /* Event run sequence number */
       unsigned int        time_ms;     /* Local ms time */
       EX_Time             time;        /* Latest X event time */
       int                 cx, cy;      /* Any detected pointer movement */
diff --git a/src/animation.c b/src/animation.c
index c1939ad..7874313 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Daniel Manjarres
- * Copyright (C) 2013-2014 Kim Woelders
+ * Copyright (C) 2013-2015 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -50,10 +50,11 @@ static int          timing_engine(void);
 static struct {
    Timer              *timer;
    Idler              *idler;
-   unsigned int        time_ms;
+   unsigned int        time_ms;        /* Just use Mode.events.time_ms? */
+   unsigned int        seqn;
 } Mode_anim =
 {
-NULL, NULL, 0};
+NULL, NULL, 0, 0};
 
 static int
 _AnimatorsTimer(void *timer_call)
@@ -61,6 +62,8 @@ _AnimatorsTimer(void *timer_call)
    int                 frame_skip;
    int                 dt;
 
+   /* Remember current event run sequence number */
+   Mode_anim.seqn = Mode.events.seqn;
    /* Remember current event time */
    Mode_anim.time_ms = Mode.events.time_ms;
 
@@ -92,7 +95,7 @@ static void
 _AnimatorsIdler(void *data)
 {
    /* Don't run idler if we have just run timer */
-   if (Mode_anim.time_ms == Mode.events.time_ms)
+   if (Mode_anim.seqn == Mode.events.seqn)
       return;
 
    _AnimatorsTimer(data);
diff --git a/src/events.c b/src/events.c
index 52a8362..3f84bf8 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2014 Kim Woelders
+ * Copyright (C) 2004-2015 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -1100,6 +1100,7 @@ EventsMain(void)
        time2 = GetTimeMs();
        dtl = time2 - time1;
        Mode.events.time_ms = time1 = time2;
+       Mode.events.seqn++;
        /* dtl = time spent since we last were here */
 
        /* Run all expired timers */

-- 


Reply via email to