]> source.dussan.org Git - tigervnc.git/commitdiff
[Developement] Viewer can limit mouse events transfer (see mouseMaxFreq member).
authorenikey <enikey@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Mon, 19 Jan 2009 11:30:27 +0000 (11:30 +0000)
committerenikey <enikey@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Mon, 19 Jan 2009 11:30:27 +0000 (11:30 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3559 3789f03b-4d11-0410-bbf8-ca57d06f2519

java/src/com/tightvnc/vncviewer/VncCanvas.java

index 59e22febfe38210d99ed69442df5f9adb2460ee1..56019be97dc76fbcae81a09ec4243ad0a4091c57 100644 (file)
@@ -95,6 +95,10 @@ class VncCanvas extends Canvas
   // True if was no one auto resize of canvas
   boolean isFirstSizeAutoUpdate = true;
 
+  // Members for limiting sending mouse events to server
+  long lastMouseEventSendTime = System.currentTimeMillis();
+  long mouseMaxFreq = 20;
+
   //
   // The constructors.
   //
@@ -813,7 +817,10 @@ class VncCanvas extends Canvas
     if (viewer.rfb != null && rfb.inNormalProtocol) {
       if (!inSelectionMode) {
         if (inputEnabled) {
-          sendMouseEvent(evt, moved);
+          if (System.currentTimeMillis() - lastMouseEventSendTime >=
+              (1000 / mouseMaxFreq)) {
+            sendMouseEvent(evt, moved);
+          }
         }
       } else {
         handleSelectionMouseEvent(evt);
@@ -837,6 +844,7 @@ class VncCanvas extends Canvas
         e.printStackTrace();
       }
       rfb.notify();
+      lastMouseEventSendTime = System.currentTimeMillis();
     }
   }