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.
This commit is contained in:
parent
3584d11e80
commit
0981a53f1b
3
src/E.h
3
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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue