Mercurial > hg > Applications > TreeVNC
changeset 255:a931be447973
add framebufferUpdateRecuest timer
author | oc |
---|---|
date | Tue, 18 Nov 2014 12:19:15 +0900 |
parents | 5c73114b38b1 |
children | dfec8bc1eb8e |
files | src/main/java/com/glavsoft/rfb/client/FramebufferUpdateRequestMessage.java src/main/java/com/glavsoft/rfb/protocol/Protocol.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/SendCheckDelay.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java |
diffstat | 5 files changed, 30 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/client/FramebufferUpdateRequestMessage.java Mon Nov 17 05:12:17 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/client/FramebufferUpdateRequestMessage.java Tue Nov 18 12:19:15 2014 +0900 @@ -57,7 +57,7 @@ writer.writeByte(0); sendFullScreenFlag = false; } else { - writer.writeByte(incremental ? 1 : 0); + writer.writeByte(1); } writer.writeInt16(x); writer.writeInt16(y);
--- a/src/main/java/com/glavsoft/rfb/protocol/Protocol.java Mon Nov 17 05:12:17 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/Protocol.java Tue Nov 18 12:19:15 2014 +0900 @@ -281,7 +281,7 @@ @Override public void sendRefreshMessage() { - sendMessage(new FramebufferUpdateRequestMessage(0, 0, 1920, 1080, false)); + sendMessage(new FramebufferUpdateRequestMessage(0, 0, fbWidth, fbHeight, false)); logger.fine("sent: full FB Refresh"); }
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Mon Nov 17 05:12:17 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Tue Nov 18 12:19:15 2014 +0900 @@ -44,6 +44,8 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; +import java.util.Timer; +import java.util.TimerTask; import java.util.logging.Logger; import jp.ac.u_ryukyu.treevnc.CheckDelayReply; @@ -74,8 +76,9 @@ private long checkCounter = 0; private boolean firstTime = true; public int numberOfRectangles = 0; + private Timer timer = null; - + public ReceiverTask(Reader reader, IRepaintController repaintController, ClipboardController clipboardController, DecodersContainer decoders, ProtocolContext context, @@ -94,7 +97,7 @@ if(!rfb.getCuiVersion()) renderer = repaintController.createRenderer(reader, context.getFbWidth(), context.getFbHeight(),context.getPixelFormat()); - fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(0, 0, 1920, 1080, true); + fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(0, 0, context.getFbWidth(), context.getFbHeight(), true); if(rfb.isTreeManager()) { fullscreenFbUpdateIncrementalRequest.sendFullScreenRequest(); connectionFinished(); @@ -215,11 +218,23 @@ if(numberOfRectangles != 1) System.out.println("numberofrectangle : " + numberOfRectangles); - if(rfb.isTreeManager() && firstTime && rfb.checkDelay) { - SendCheckDelay sendCheckDelay = new SendCheckDelay(rfb); - Thread sendCheckDelayThread = new Thread(sendCheckDelay, "send-check-delay"); - sendCheckDelayThread.start(); - this.firstTime = false; + if(rfb.isTreeManager() && firstTime) { + if(rfb.checkDelay) { + SendCheckDelay sendCheckDelay = new SendCheckDelay(rfb); + Thread sendCheckDelayThread = new Thread(sendCheckDelay, "send-check-delay"); + sendCheckDelayThread.start(); + this.firstTime = false; + } + + timer = new Timer(true); + timer.schedule(new TimerTask(){ + @Override + public void run() { +// context.setFbWidth(600); +// context.setFbHeight(600); + context.sendMessage(new FramebufferUpdateRequestMessage(0, 0, context.getFbWidth(), context.getFbHeight(), true)); + } + },0,100); } while (numberOfRectangles-- > 0) { @@ -244,8 +259,7 @@ renderer.decodeCursorPosition(rect); repaintController.repaintCursor(); } else if (rect.getEncodingType() == EncodingType.DESKTOP_SIZE || rect.getEncodingType() == EncodingType.INIT_DATA ) { - fullscreenFbUpdateIncrementalRequest = - new FramebufferUpdateRequestMessage(0, 0, 1920, 1080, true); + fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(0, 0, rect.width, rect.height, false); rfb.setCuiVersion(false); boolean visible = true; if (rect.getEncodingType() == EncodingType.INIT_DATA) { @@ -263,12 +277,12 @@ } synchronized (renderer.getLock()) { if(!(rfb.getCuiVersion())) - renderer = repaintController.createRenderer(reader, rect.width, rect.height,context.getPixelFormat()); + renderer = repaintController.createRenderer(reader, rect.width, rect.height, context.getPixelFormat()); } if (rect.getEncodingType() == EncodingType.INIT_DATA) { repaintController.setVisible(visible); } - context.sendMessage(new FramebufferUpdateRequestMessage(0, 0, 1920, 1080, false)); + context.sendMessage(new FramebufferUpdateRequestMessage(0, 0, rect.width, rect.height, false)); // repaintController.repaintCursor(); } else if (rect.getEncodingType() == EncodingType.CHECK_DELAY) { int checkDelaySize = 24; @@ -293,14 +307,13 @@ context.sendRefreshMessage(); logger.fine("sent: nonincremental fb update"); } else { - context.sendMessage(fullscreenFbUpdateIncrementalRequest); + context.sendMessage(new FramebufferUpdateRequestMessage(0, 0, context.getFbWidth(), context.getFbHeight(), false)); } } } private void sendCheckDelayReply(long time, int port, String address) throws UnsupportedEncodingException { context.sendMessage(new CheckDelayReply(time, port, address)); - } public synchronized void queueUpdatePixelFormat(PixelFormat pf) {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/SendCheckDelay.java Mon Nov 17 05:12:17 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/SendCheckDelay.java Tue Nov 18 12:19:15 2014 +0900 @@ -27,7 +27,7 @@ public void run() { for (;;) { - long sendTime = 10000; // send check delay timing (10 sec) + long sendTime = 5000; // send check delay timing (5 sec) try { synchronized (this) { wait(sendTime);
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Mon Nov 17 05:12:17 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Tue Nov 18 12:19:15 2014 +0900 @@ -19,6 +19,7 @@ import com.glavsoft.exceptions.TransportException; import com.glavsoft.rfb.client.ClientToServerMessage; +import com.glavsoft.rfb.client.FramebufferUpdateRequestMessage; import com.glavsoft.rfb.encoding.EncodingType; import com.glavsoft.rfb.protocol.Protocol; import com.glavsoft.rfb.protocol.ProtocolContext;