Implemented seeking to an arbitrary time point in the session file.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2511 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/rfbplayer/VncCanvas.java b/java/src/com/tightvnc/rfbplayer/VncCanvas.java
index fa4bde7..6332532 100644
--- a/java/src/com/tightvnc/rfbplayer/VncCanvas.java
+++ b/java/src/com/tightvnc/rfbplayer/VncCanvas.java
@@ -60,6 +60,11 @@
   // which decodes and loads JPEG images.
   Rectangle jpegRect;
 
+  // When we're in the seeking mode, we should not update the desktop. 
+  // This variable helps us to remember that repainting the desktop at
+  // once is necessary when the seek operation is finished.
+  boolean seekMode;
+
   //
   // The constructor.
   //
@@ -67,6 +72,7 @@
   VncCanvas(RfbPlayer player) throws IOException {
     this.player = player;
     rfb = player.rfb;
+    seekMode = false;
 
     cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF);
 
@@ -809,9 +815,19 @@
   //
 
   void scheduleRepaint(int x, int y, int w, int h) {
-    // Request repaint if not in the seeking mode.
-    if (!player.fbsStream.isSeeking())
-      repaint(player.deferScreenUpdates, x, y, w, h);
+    if (player.fbsStream.isSeeking()) {
+      // Do nothing, and remember we are seeking.
+      seekMode = true;
+    } else {
+      if (seekMode) {
+	// Full-screen immediate repaint after seeking.
+	repaint();
+      } else {
+	// Usual incremental repaint in playback mode.
+	repaint(player.deferScreenUpdates, x, y, w, h);
+      }
+      seekMode = false;
+    }
   }
 
 }