Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 524:ef2f70aee45a
separate Reader in FrameBufferUpdateRectangle
author | k.fukuda |
---|---|
date | Sun, 03 Mar 2019 18:56:42 +0900 |
parents | dca83cc39438 |
children | fea7651ca24f |
files | src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/BroadcastRFBListener.java |
diffstat | 2 files changed, 11 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sun Feb 24 16:47:30 2019 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sun Mar 03 18:56:42 2019 +0900 @@ -125,7 +125,7 @@ switch (messageId) { case FRAMEBUFFER_UPDATE: // logger.fine("Server message: FramebufferUpdate (0)"); - framebufferUpdateMessage(); + framebufferUpdateMessage(reader); break; case SET_COLOR_MAP_ENTRIES: logger.severe("Server message SetColorMapEntries is not implemented. Skip."); @@ -239,15 +239,15 @@ clipboardController.updateSystemClipboard(reader.readBytes(length)); } - public void framebufferUpdateMessage() throws Exception { + public void framebufferUpdateMessage(Reader reader) throws Exception { + int numberOfRectangles; try { reader.readByte(); // padding - this.numberOfRectangles = reader.readUInt16(); - if(numberOfRectangles > 2) { + numberOfRectangles = this.reader.readUInt16(); + if(numberOfRectangles > 3) { System.out.println("numberofrectangle : " + numberOfRectangles); if (rfb.getViewer().getUseMulticast()){ - return; // Discard invalid packet } } @@ -314,6 +314,7 @@ context.setFbHeight(rect.height); repaintController.updateRemoteDesktopName(context); reader.reset(); + System.out.println("INIT_DATA: "+rect); // request one screen fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(rect.x, rect.y, singleWidth, singleHeight, false); // All children multicastqueue should be discarded here. @@ -361,6 +362,8 @@ e.getMessage(); e.printStackTrace(); reader.close(); + } catch (Exception e) { + System.out.println("FrameBufferUpdate: "+e); } sendFrameBufferUpdateRequest();
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/BroadcastRFBListener.java Sun Feb 24 16:47:30 2019 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/BroadcastRFBListener.java Sun Mar 03 18:56:42 2019 +0900 @@ -1,9 +1,7 @@ package jp.ac.u_ryukyu.treevnc; -import com.glavsoft.rfb.protocol.ProtocolContext.TreeCommand; import com.glavsoft.rfb.protocol.ReceiverTask; import com.glavsoft.transport.Reader; -import com.glavsoft.viewer.ViewerInterface; import com.glavsoft.viewer.swing.ConnectionParams; import java.io.ByteArrayInputStream; @@ -66,13 +64,13 @@ int len = recvPacket.getLength(); boolean isTreeRoot = rfb.isTreeManager(); if (receiverTask != null) { - receiverTask.setReader(new Reader(new ByteArrayInputStream(reply))); + Reader reader = new Reader(new ByteArrayInputStream(reply)); if (receiverTask.getMessageId() == FRAMEBUFFER_UPDATE) { - receiverTask.framebufferUpdateMessage(); + receiverTask.framebufferUpdateMessage(reader); } } } catch (Exception e) { - System.out.println("broadcast-rfb-listener :" + e.getMessage()); + System.out.println("broadcast-rfb-listener : " + e.getMessage()); } } }