Rob Shearman : comctl32: Support seeking to a particular frame.

Alexandre Julliard julliard at winehq.org
Wed Jan 16 13:19:36 CST 2008


Module: wine
Branch: master
Commit: 1030d412791bfa6471538e3d6144050eddae92c3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1030d412791bfa6471538e3d6144050eddae92c3

Author: Rob Shearman <rob at codeweavers.com>
Date:   Wed Jan 16 14:03:26 2008 +0000

comctl32: Support seeking to a particular frame.

In this case just draw the frame without starting the timer thread of 
setting a timer and without sending any notifications.

---

 dlls/comctl32/animate.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c
index d4283a1..931f279 100644
--- a/dlls/comctl32/animate.c
+++ b/dlls/comctl32/animate.c
@@ -145,6 +145,8 @@ static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName)
 
 static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
 {
+    BOOL stopped = FALSE;
+
     EnterCriticalSection(&infoPtr->cs);
 
     /* should stop playing */
@@ -167,15 +169,18 @@ static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
         CloseHandle( handle );
         CloseHandle( infoPtr->hStopEvent );
         infoPtr->hStopEvent = 0;
+        stopped = TRUE;
     }
     if (infoPtr->uTimer) {
 	KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
 	infoPtr->uTimer = 0;
+	stopped = TRUE;
     }
 
     LeaveCriticalSection(&infoPtr->cs);
 
-    ANIMATE_Notify(infoPtr, ACN_STOP);
+    if (stopped)
+        ANIMATE_Notify(infoPtr, ACN_STOP);
 
     return TRUE;
 }
@@ -429,12 +434,20 @@ static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WOR
     TRACE("(repeat=%d from=%d to=%d);\n",
 	  infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);
 
-    if (infoPtr->nFromFrame >= infoPtr->nToFrame ||
+    if (infoPtr->nFromFrame > infoPtr->nToFrame ||
 	infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
 	return FALSE;
 
     infoPtr->currFrame = infoPtr->nFromFrame;
 
+    /* seek - doesn't need to start a thread or set a timer and neither
+     * does it send a notification */
+    if (infoPtr->nFromFrame == infoPtr->nToFrame)
+    {
+        ANIMATE_DrawFrame(infoPtr);
+        return TRUE;
+    }
+
     if (infoPtr->dwStyle & ACS_TIMER) 
     {
 	TRACE("Using a timer\n");




More information about the wine-cvs mailing list