Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 170:2c36ea3f93da
send id in initData message and changeServer.
author | oc |
---|---|
date | Fri, 20 Jun 2014 18:04:23 +0900 |
parents | 8ab1f6905db4 |
children | fab76dd9c3cd |
files | src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 5 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jun 19 20:25:19 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Fri Jun 20 18:04:23 2014 +0900 @@ -255,7 +255,7 @@ reader.reset(); rfb.readSendData(length + 20, reader); // size of UpdateRectangleMessage with initData. short id = (short) rect.x; - repaintController.setVisible(id == rfb.getId()); + repaintController.setVisible(id != rfb.getId()); } synchronized (renderer.getLock()) {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Thu Jun 19 20:25:19 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Fri Jun 20 18:04:23 2014 +0900 @@ -138,6 +138,7 @@ if (permitChangeScreen()) { ByteBuffer buf = ByteBuffer.wrap(b); buf.order(ByteOrder.BIG_ENDIAN); + short id = buf.getShort(2); int length = buf.getInt(4); if (length == 0) continue; @@ -145,7 +146,7 @@ System.out.println("Root server change request :" + newHostName); // please remove these numbers. if (viewer != null) { - viewer.changeVNCServer(newHostName, 3200, 1980); + viewer.changeVNCServer(newHostName, 3200, 1980, id); } } else { continue; @@ -363,7 +364,7 @@ } - public void sendDesktopSizeChange() { + public void sendDesktopSizeChange(short id) { LinkedList<ByteBuffer> desktopSize = new LinkedList<ByteBuffer>(); int width = context.getFbWidth(); int height = context.getFbHeight();
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java Thu Jun 19 20:25:19 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java Fri Jun 20 18:04:23 2014 +0900 @@ -20,9 +20,11 @@ */ public class ScreenChangeRequest implements ClientToServerMessage { final String bytes; + private short id; - public ScreenChangeRequest(String adr) { + public ScreenChangeRequest(String adr, short id) { this.bytes = adr; + this.id = id; System.out.println("Client send change screen server request :" + adr); } @@ -32,7 +34,7 @@ out.order(ByteOrder.BIG_ENDIAN); out.put(SERVER_CHANGE_REQUEST); out.put((byte)0); - out.putShort((byte)0); // padding + out.putShort(id); // padding out.putInt(bytes.length()); out.put(bytes.getBytes()); writer.write(out.array(), 0, out.position());
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Thu Jun 19 20:25:19 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Fri Jun 20 18:04:23 2014 +0900 @@ -165,14 +165,15 @@ * FrameWidth * @param height * FrameHeight + * @param id * @throws InterruptedException */ - public void changeVNCServer(String hostName, int width, int height) + public void changeVNCServer(String hostName, int width, int height, short id) throws UnknownHostException, IOException, InterruptedException { // stop reader stop myRfb.stopReceiverTask(); inhelitClients(this, hostName); - orderRecconection(hostName); + orderRecconection(hostName, id); } @Override @@ -184,9 +185,9 @@ firstTime = flag; } - public void orderRecconection(String hostName) throws UnknownHostException, IOException, InterruptedException { + public void orderRecconection(String hostName, short id) throws UnknownHostException, IOException, InterruptedException { myRfb.waitForReady(this); - myRfb.sendDesktopSizeChange(); + myRfb.sendDesktopSizeChange(id); } public LinkedList<TreeVNCNode> clientList() {
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Jun 19 20:25:19 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Fri Jun 20 18:04:23 2014 +0900 @@ -834,7 +834,7 @@ // should be stopped. viewer.setCuiVersion(true); String adr = viewer.getRfb().getMyAddress(); - context.sendMessage(new ScreenChangeRequest(adr)); + context.sendMessage(new ScreenChangeRequest(adr, viewer.getRfb().getId())); } }); kbdButtons.add(screenButton);