Mercurial > hg > Applications > TreeVNC
changeset 279:dce00f9ac98c
add encodingType SEND_SINGLE_DISPLAY_WIDTH.
author | oc |
---|---|
date | Sat, 10 Jan 2015 18:51:25 +0900 |
parents | 69e821effec6 |
children | 9c5874d0f37e |
files | src/main/java/com/glavsoft/rfb/encoding/EncodingType.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/SendSingleDisplayWidth.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 4 files changed, 60 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/EncodingType.java Sat Jan 10 18:08:40 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/EncodingType.java Sat Jan 10 18:51:25 2015 +0900 @@ -70,6 +70,11 @@ CHECK_DELAY(17, "CHECK_DELAY"), /** + * TreeVNC single display width size. + */ + SEND_SINGLE_DISPLAY_WIDTH(18, "SEND_SINGLE_DISPLAY_WIDTH"), + + /** * Transmit initial data of new display */ INIT_DATA(0xFFFFFF10, "InitData"),
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sat Jan 10 18:08:40 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sat Jan 10 18:51:25 2015 +0900 @@ -40,15 +40,11 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; -import java.util.LinkedList; import java.util.Timer; import java.util.TimerTask; import java.util.logging.Logger; -import jp.ac.u_ryukyu.treevnc.CheckDelayReply; -import jp.ac.u_ryukyu.treevnc.SendCheckDelay; -import jp.ac.u_ryukyu.treevnc.TreeRFBProto; -import jp.ac.u_ryukyu.treevnc.TreeVncProtocol; +import jp.ac.u_ryukyu.treevnc.*; public class ReceiverTask implements Runnable { @@ -237,10 +233,13 @@ FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle(); rect.fill(reader); - if(rfb.singleWidth == 0 && firstTime) { - rfb.singleWidth = rect.width; + if(rfb.filterSingleDisplay && firstTime) { + if (rfb.singleWidth == 0) { + rfb.singleWidth = rect.width; + } // ここにsingleWidthを送信する処理を書く -// sendSingleWidth(rect.width); + SendSingleDisplayWidth sendSingleDisplayWidth = new SendSingleDisplayWidth(rfb, rfb.singleWidth); + sendSingleDisplayWidth.sendSingleDisplayWidth(); this.firstTime = false; } @@ -301,8 +300,8 @@ int port = rfb.acceptPort; String address = rfb.getMyAddress(); sendCheckDelayReply(rect.time, port, address); -// } else if (rect.getEncodingType() == EncodingType.SET_SINGLE_WIDTH) { -// rfb.singleWidth = rect.singleWidth; + } else if (rect.getEncodingType() == EncodingType.SEND_SINGLE_DISPLAY_WIDTH) { + rfb.singleWidth = rect.width; } else throw new CommonException("Unprocessed encoding: " + rect.toString()); } @@ -328,13 +327,6 @@ context.sendMessage(new CheckDelayReply(time, port, address)); } - /* - private void sendSingleWidth(int singleWidth) { - LinkedList<ByteBuffer> sendSingleWidth = new LinkedList<ByteBuffer>(); - rfb.multicastqueue.put(sendSingleWidth); - } - */ - public synchronized void queueUpdatePixelFormat(PixelFormat pf) { pixelFormat = pf; needSendPixelFormat = true;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/SendSingleDisplayWidth.java Sat Jan 10 18:51:25 2015 +0900 @@ -0,0 +1,45 @@ +package jp.ac.u_ryukyu.treevnc; + +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.LinkedList; +import com.glavsoft.rfb.encoding.EncodingType; + +/** + * Created by OcBookPro on 15/01/10. + */ +public class SendSingleDisplayWidth { + + private ByteBuffer msg; + private TreeRFBProto rfb; + private int singleDisplayWidth; + + public SendSingleDisplayWidth(TreeRFBProto rfb, int singleWidth) { + this.rfb = rfb; + this.singleDisplayWidth = singleWidth; + } + + public void sendSingleDisplayWidth() throws UnsupportedEncodingException { + LinkedList<ByteBuffer> linkedListSendSingleDisplayWidth = new LinkedList<ByteBuffer>(); + linkedListSendSingleDisplayWidth.add(singleDisplayWidth(0, 0, this.singleDisplayWidth, 0)); + this.rfb.addSerialNumber(linkedListSendSingleDisplayWidth); + this.rfb.multicastqueue.put(linkedListSendSingleDisplayWidth); + System.out.println(this.singleDisplayWidth + " : send single display width"); + } + + public ByteBuffer singleDisplayWidth(int i, int j, int singleDisplayWidth, int height) throws UnsupportedEncodingException { + msg = ByteBuffer.allocate(24).order(ByteOrder.BIG_ENDIAN); + msg.put((byte) 0); // FrameBufferUpdate + msg.put((byte) 0); // padding + msg.putShort((short) 1); // number of rectangle + msg.putShort((short) i); + msg.putShort((short) j); + msg.putShort((short) singleDisplayWidth); + msg.putShort((short) height); + msg.putInt(EncodingType.SEND_SINGLE_DISPLAY_WIDTH.getId()); + msg.flip(); + return msg; + } + +}
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Sat Jan 10 18:08:40 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Sat Jan 10 18:51:25 2015 +0900 @@ -53,6 +53,7 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Logger; +import jp.ac.u_ryukyu.treevnc.SendSingleDisplayWidth; import jp.ac.u_ryukyu.treevnc.TreeRFBProto; import jp.ac.u_ryukyu.treevnc.ScreenChangeRequest;