From 1abaff963c34d59d8c596e24d0b59dbd0103b8be Mon Sep 17 00:00:00 2001 From: enikey Date: Mon, 19 Jan 2009 11:30:27 +0000 Subject: [PATCH] [Developement] Viewer can limit mouse events transfer (see mouseMaxFreq member). 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/java/src/com/tightvnc/vncviewer/VncCanvas.java b/java/src/com/tightvnc/vncviewer/VncCanvas.java index 59e22feb..56019be9 100644 --- a/java/src/com/tightvnc/vncviewer/VncCanvas.java +++ b/java/src/com/tightvnc/vncviewer/VncCanvas.java @@ -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(); } } -- 2.39.5