Skip to content

Commit

Permalink
render: Don't filter 0 return from GetTimeInMillis
Browse files Browse the repository at this point in the history
In animate cursor block handler code assumes GetTimeInMillis returns
always nonzero value. This isn't true when time wraps around.

To prevent any problems in case GetTimeInMillis would return zero use
activeDevice variable to track if we have received time.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit aa8cea9)
  • Loading branch information
Pauli Nieminen authored and nwnk committed Jan 6, 2011
1 parent aec278e commit a87a5b7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions render/animcur.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,18 @@ AnimCurScreenBlockHandler (int screenNum,
ScreenPtr pScreen = screenInfo.screens[screenNum];
AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
DeviceIntPtr dev;
Bool activeDevice = FALSE;
CARD32 now = 0,
soonest = ~0; /* earliest time to wakeup again */

for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen)
{
if (!now) now = GetTimeInMillis ();
if (!activeDevice) {
now = GetTimeInMillis ();
activeDevice = TRUE;
}

if ((INT32) (now - dev->spriteInfo->anim.time) >= 0)
{
Expand Down Expand Up @@ -187,7 +191,7 @@ AnimCurScreenBlockHandler (int screenNum,
}
}

if (now)
if (activeDevice)
AdjustWaitForDelay (pTimeout, soonest - now);

Unwrap (as, pScreen, BlockHandler);
Expand Down

0 comments on commit a87a5b7

Please sign in to comment.