Mercurial > hg > Applications > TreeVNC
changeset 178:34b7558aeffa
remove TreeTask, StartTreeHandling
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 22 Jun 2014 19:05:04 +0900 |
parents | 8019a393875a |
children | c1b91dd27a13 |
files | src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java src/main/java/com/glavsoft/rfb/protocol/Protocol.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/com/glavsoft/rfb/protocol/TreeTask.java src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java src/main/java/jp/ac/u_ryukyu/treevnc/client/FindRoot.java src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java |
diffstat | 10 files changed, 27 insertions(+), 104 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java Sun Jun 22 19:05:04 2014 +0900 @@ -27,7 +27,7 @@ rfb.readSendData(dataLen, reader); // reader is reseted read again - if (! rfb.isRoot()) { + if (rfb.hasViewer()) { reader.reset(); // decode data when it is a client reader.readBytes(8);
--- a/src/main/java/com/glavsoft/rfb/protocol/Protocol.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/Protocol.java Sun Jun 22 19:05:04 2014 +0900 @@ -37,6 +37,7 @@ import com.glavsoft.rfb.protocol.state.ProtocolState; import com.glavsoft.transport.Reader; import com.glavsoft.transport.Writer; + import java.util.logging.Logger; import jp.ac.u_ryukyu.treevnc.MyRfbProto; @@ -77,6 +78,7 @@ state = new HandshakeState(this); logger = Logger.getLogger(getClass().getName()); } + @Override public void changeStateTo(ProtocolState state) { @@ -338,60 +340,13 @@ IRepaintController repaintController, ClipboardController clipboardController, MyRfbProto rfb) { - receiverTask = new TreeTask( + receiverTask = new ReceiverTask( reader, repaintController, clipboardController, decoders, this, rfb); startNormalHandling1(rfbSessionListener, repaintController, clipboardController); } - public void startTreeClientHandling(IRfbSessionListener rfbSessionListener, - IRepaintController repaintController, - ClipboardController clipboardController, MyRfbProto rfb) { - this.repaintController = repaintController; - settings.addListener(repaintController); - receiverTask = new TreeTask( - reader, repaintController, - clipboardController, - decoders, this, rfb); - startTreeClientHandling(rfbSessionListener, clipboardController, rfb); - } - - public void setScreenSizeRetina(int fbWidth, int fbHeight) { - isRetina = true; - this.fbWidth = fbWidth; - this.fbHeight = fbHeight; - } - - public void startTreeClientHandling(IRfbSessionListener rfbSessionListener, - ClipboardController clipboardController, MyRfbProto rfb) { - this.rfbSessionListener = rfbSessionListener; -// if (settings.getBitsPerPixel() == 0) { -// settings.setBitsPerPixel(pixelFormat.bitsPerPixel); // the same the server sent when not initialized yet -// } - serverPixelFormat = pixelFormat; - serverPixelFormat.trueColourFlag = 1; // correct flag - we don't support color maps - setPixelFormat(createPixelFormat(settings)); - sendMessage(new SetPixelFormatMessage(pixelFormat)); - logger.fine("sent: "+pixelFormat); - - sendSupportedEncodingsMessage(settings); - settings.addListener(this); // to support pixel format (color depth), and encodings changes - - sendRefreshMessage(); - senderTask = new SenderTask(messageQueue, writer, this); - senderThread = new Thread(senderTask, "SenderTask"); - senderThread.start(); - decoders.resetDecoders(); - if (receiverTask==null) { - receiverTask = new TreeTask( - reader, null, - clipboardController, - decoders, this, rfb); - } - receiverThread = new Thread(receiverTask, "TreeTask"); - receiverThread.start(); - } @Override public void resetDecoder() {
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sun Jun 22 19:05:04 2014 +0900 @@ -81,8 +81,14 @@ this.clipboardController = clipboardController; this.context = context; this.decoders = decoders; + + Decoder decoder = new ZRLEESender(rfb); + decoders.setDecoderByType(EncodingType.ZLIB, decoder); + decoders.setDecoderByType(EncodingType.ZRLE, decoder); + decoders.setDecoderByType(EncodingType.ZRLEE, decoder); + if(!rfb.getCuiVersion()) - renderer = repaintController.createRenderer(reader, context.getFbWidth(), context.getFbHeight(),context.getPixelFormat()); + renderer = repaintController.createRenderer(reader, context.getFbWidth(), context.getFbHeight(),context.getPixelFormat()); fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(0, 0, context.getFbWidth(), context.getFbHeight(), true); if(rfb.isRoot()) { fullscreenFbUpdateIncrementalRequest.sendFullScreenRequest();
--- a/src/main/java/com/glavsoft/rfb/protocol/TreeTask.java Sun Jun 22 16:48:38 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -package com.glavsoft.rfb.protocol; - -import jp.ac.u_ryukyu.treevnc.MyRfbProto; - -import com.glavsoft.rfb.ClipboardController; -import com.glavsoft.rfb.IRepaintController; -import com.glavsoft.rfb.encoding.EncodingType; -import com.glavsoft.rfb.encoding.decoder.Decoder; -import com.glavsoft.rfb.encoding.decoder.DecodersContainer; -import com.glavsoft.transport.Reader; -import com.glavsoft.rfb.encoding.decoder.ZRLEESender; - -public class TreeTask extends ReceiverTask { - //final static String versionMsg_3_855 = "RFB 003.855\n"; - final static String versionMsg_3_856 = "RFB 003.856\n"; - - public TreeTask(Reader reader, IRepaintController repaintController, - ClipboardController clipboardController, - DecodersContainer decoders, ProtocolContext context, MyRfbProto rfb) { - super(reader, repaintController, clipboardController, decoders, context, rfb); - //super(reader, new NullRepaintController(), clipboardController, decoders,context, true); - Decoder decoder = new ZRLEESender(rfb); - decoders.setDecoderByType(EncodingType.ZLIB, decoder); - decoders.setDecoderByType(EncodingType.ZRLE, decoder); - decoders.setDecoderByType(EncodingType.ZRLEE, decoder); - } - - /* public void framebufferUpdateMessage() throws CommonException { - * - * (non-Javadoc) - * proxy - * no Repaint - * decoder!=0 ZRLE -> ZRLEE - * readSendData(); - * client - * Repaint - * no context.send(); - * if necessary ZRLEE -> ZRLE - * readSendData(); - * - */ -}
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Sun Jun 22 19:05:04 2014 +0900 @@ -55,6 +55,7 @@ private boolean firstTime = true; private TreeRootFinderListener getCast; private CreateConnectionParam cp; + private boolean hasViewer = false; public MyRfbProto() { @@ -649,7 +650,7 @@ } public void initRoot(ViewerInterface vncProxyService, String hostName) { - treeManager = new TreeManagement(hostName, ConnectionParams.DEFAULT_VNC_ROOT,this); + treeManager = new TreeManagement(hostName, ConnectionParams.DEFAULT_VNC_ROOT); vncProxyService.initRootViewer(hostName); createConnectionAndStart(vncProxyService); } @@ -666,5 +667,13 @@ return cp; } + public boolean hasViewer() { + return hasViewer; + } + + public void setHasViewer(boolean b) { + hasViewer = b; + } + }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/FindRoot.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/FindRoot.java Sun Jun 22 19:05:04 2014 +0900 @@ -10,8 +10,6 @@ import java.net.Socket; import java.nio.ByteBuffer; import java.nio.ByteOrder; - -import com.glavsoft.rfb.protocol.ProtocolContext; import com.glavsoft.rfb.protocol.ProtocolContext.TreeCommand; import com.glavsoft.viewer.swing.ConnectionParams;
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java Sun Jun 22 19:05:04 2014 +0900 @@ -4,21 +4,16 @@ import java.io.IOException; import java.util.LinkedList; -import jp.ac.u_ryukyu.treevnc.MyRfbProto; import jp.ac.u_ryukyu.treevnc.client.TreeVncProtocol; public class TreeManagement { private LinkedList<TreeVNCNode> nodeList = new LinkedList<TreeVNCNode>(); boolean runflag = false; private final int treebranch = 2; - // private final int intv_time = 100; avoid too frequent reconnection - private MyRfbProto rfb; - - public TreeManagement(String hostName, int vncport, MyRfbProto myRfb) { + public TreeManagement(String hostName, int vncport) { TreeVNCNode me = new TreeVNCNode(hostName, vncport,"localhost"); me.setTreeNum(0); nodeList.add(me); - rfb = myRfb; } //
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Sun Jun 22 19:05:04 2014 +0900 @@ -24,6 +24,7 @@ vps = new VncProxyService(); vps.setNoConnection(noConnection); vps.proxyStart(args,width,height); + vps.getRfb().setHasViewer(false); if (!permitChangeScreen ) vps.getRfb().setPermitChangeScreen(false); vps.getRfb().getAcceptThread().waitForShutdown(); return; @@ -34,6 +35,7 @@ if (treeProxy) { v.setNoConnection(noConnection); v.proxyStart(args,width,height); + v.getRfb().setHasViewer(true); if (!permitChangeScreen ) v.getRfb().setPermitChangeScreen(false); v.getRfb().getAcceptThread().waitForShutdown(); } else {
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jun 22 19:05:04 2014 +0900 @@ -291,6 +291,7 @@ public void startTreeViewer(String hostName,boolean cui) { MyRfbProtoClient rfb = new MyRfbProtoClient(); rfb.setCuiVersion(cui); + rfb.setHasViewer(true); rfb.createConnectionAndStart(this); CreateConnectionParam cp = new CreateConnectionParam(rfb); if (hostName!=null) {
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Sun Jun 22 16:48:38 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Sun Jun 22 19:05:04 2014 +0900 @@ -46,7 +46,6 @@ import java.util.logging.Logger; import jp.ac.u_ryukyu.treevnc.MyRfbProto; -import jp.ac.u_ryukyu.treevnc.client.MyRfbProtoClient; /** * @author dime at tightvnc.com @@ -123,9 +122,9 @@ else if(!myRfb.isRoot()) { myRfb.setProtocolContext(workingProtocol); if(!myRfb.getCuiVersion()) - workingProtocol.startTreeClientHandling(this, viewerWindow.getSurface(), clipboardController,myRfb); + workingProtocol.startNormalHandling(this, viewerWindow.getSurface(), clipboardController,myRfb); else - workingProtocol.startTreeClientHandling(this,clipboardController,myRfb); + workingProtocol.startNormalHandling(this,null,clipboardController,myRfb); } else { workingProtocol.startNormalHandling(this, viewerWindow.getSurface(), clipboardController); }