Fixed bug with wrong positiong of slider when it was draged by mouse.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@148 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfbplayer/rfbplayer.cxx b/rfbplayer/rfbplayer.cxx
index 6b18711..134bdee 100644
--- a/rfbplayer/rfbplayer.cxx
+++ b/rfbplayer/rfbplayer.cxx
@@ -365,7 +365,6 @@
         return 0;
       case TB_ENDTRACK: 
         setPos(Pos);
-        updatePos(Pos);
         sliderDraging = false;
         return 0;
       default:
@@ -719,6 +718,7 @@
       rewind();
       setPaused(true);
       updatePos(getTimeOffset());
+      SendMessage(posTrackBar, TBM_SETPOS, TRUE, 0);
       return;
     }
     // It's a special exception to perform backward seeking.
@@ -765,7 +765,6 @@
   SendMessage(posTrackBar, TBM_SETRANGE, 
     TRUE, MAKELONG(0, min(sessionTimeMs / 1000, MAX_POS_TRACKBAR_RANGE)));
   sliderStepMs = sessionTimeMs / SendMessage(posTrackBar, TBM_GETRANGEMAX, 0, 0);
-    
   updatePos(getTimeOffset());
 
   setPaused(!autoplay);
@@ -927,7 +926,7 @@
 void RfbPlayer::updatePos(long newPos) {
   // Update time pos in static control
   char timePos[30] = "\0";
-  double sliderPos = newPos;
+  long sliderPos = newPos;
   newPos /= 1000;
   sprintf(timePos, "%.2um:%.2us (%s)", newPos/60, newPos%60, fullSessionTime);
   SetWindowText(timeStatic, timePos);
@@ -935,7 +934,8 @@
   // Update the position of slider
   if (!sliderDraging) {
     sliderPos /= sliderStepMs;
-    SendMessage(posTrackBar, TBM_SETPOS, TRUE, sliderPos);
+    if (sliderPos > SendMessage(posTrackBar, TBM_GETPOS, 0, 0))
+      SendMessage(posTrackBar, TBM_SETPOS, TRUE, sliderPos);
   }
 }