Mercurial > hg > Applications > TreeVNC
changeset 169:8ab1f6905db4
Try to hide root frame
line wrap: on
line diff
--- a/Todo.txt Thu Jun 19 19:05:25 2014 +0900 +++ b/Todo.txt Thu Jun 19 20:25:19 2014 +0900 @@ -1,6 +1,6 @@ Thu Jun 19 08:12:02 JST 2014 - Share Button を押した際に、JFrameのTitleを更新する。 + Share Button を押した際に、JFrameのTitleを更新する。 Done SwingViewerWindow.javaのsetRemoteDesktopName メソッドを呼べば解決するはず。 サーバが切り替わった際、画面のサイズ等の情報を送信する。(INIT_DATA) Done @@ -11,6 +11,7 @@ shareしたTreeVNCのパネルをinvisibleにする。 shareする画面の大きさをHDサイズに限定するのをdefaultにする。 fullサイズを転送するオプションに。 + checkdelayの機能を。 Fri Jun 13 17:29:02 JST 2014
--- a/src/main/java/com/glavsoft/rfb/IRepaintController.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/IRepaintController.java Thu Jun 19 20:25:19 2014 +0900 @@ -41,4 +41,5 @@ Renderer createRenderer(Reader reader, int width, int height, PixelFormat pixelFormat); void setPixelFormat(PixelFormat pixelFormat); void updateRemoteDesktopName(ProtocolContext context); + void setVisible(boolean b); } \ No newline at end of file
--- a/src/main/java/com/glavsoft/rfb/protocol/NullRepaintController.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/NullRepaintController.java Thu Jun 19 20:25:19 2014 +0900 @@ -50,4 +50,9 @@ } + @Override + public void setVisible(boolean b) { + + } + }
--- a/src/main/java/com/glavsoft/rfb/protocol/ProtocolContext.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ProtocolContext.java Thu Jun 19 20:25:19 2014 +0900 @@ -27,11 +27,9 @@ import com.glavsoft.rfb.IPasswordRetriever; import com.glavsoft.rfb.client.ClientToServerMessage; import com.glavsoft.rfb.encoding.PixelFormat; -import com.glavsoft.rfb.protocol.ProtocolContext.TreeCommand; import com.glavsoft.rfb.protocol.state.ProtocolState; import com.glavsoft.transport.Reader; import com.glavsoft.transport.Writer; -// import java.util.logging.Logger; public interface ProtocolContext {
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jun 19 20:25:19 2014 +0900 @@ -34,19 +34,16 @@ import com.glavsoft.rfb.client.SetPixelFormatMessage; import com.glavsoft.rfb.encoding.EncodingType; import com.glavsoft.rfb.encoding.PixelFormat; -import com.glavsoft.rfb.encoding.ServerInitMessage; import com.glavsoft.rfb.encoding.decoder.Decoder; import com.glavsoft.rfb.encoding.decoder.DecodersContainer; import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle; import com.glavsoft.rfb.encoding.decoder.RichCursorDecoder; import com.glavsoft.rfb.encoding.decoder.ZRLEESender; -import com.glavsoft.rfb.protocol.state.InitState; import com.glavsoft.transport.Reader; import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; -import java.nio.ByteBuffer; import java.util.logging.Logger; import jp.ac.u_ryukyu.treevnc.MyRfbProto; @@ -257,6 +254,9 @@ repaintController.updateRemoteDesktopName(rfb.getContext()); reader.reset(); rfb.readSendData(length + 20, reader); // size of UpdateRectangleMessage with initData. + short id = (short) rect.x; + repaintController.setVisible(id == rfb.getId()); + } synchronized (renderer.getLock()) { if(!(rfb.getCuiVersion()))
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Thu Jun 19 20:25:19 2014 +0900 @@ -46,6 +46,7 @@ private Inflater inflater = new Inflater(); private Deflater deflater = new Deflater(); VncProxyService viewer; + private short id; public MyRfbProto() { @@ -366,7 +367,7 @@ LinkedList<ByteBuffer> desktopSize = new LinkedList<ByteBuffer>(); int width = context.getFbWidth(); int height = context.getFbHeight(); - desktopSize.add(new UpdateRectangleMessage(width, height, EncodingType.INIT_DATA, context.getInitData()).getMessage()); + desktopSize.add(new UpdateRectangleMessage(width, height, EncodingType.INIT_DATA, context.getInitData(),id).getMessage()); addSerialNumber(desktopSize); multicastqueue.put(desktopSize); } @@ -573,5 +574,13 @@ } + public void setId(short id) { + this.id = id; + } + + public short getId() { + return id; + } + }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java Thu Jun 19 20:25:19 2014 +0900 @@ -18,13 +18,15 @@ Reader is; private TreeCommand command ; private Socket connection; + private short value; - public TreeVncCommand(MyRfbProto rfb,String myHostName, TreeCommand command, int port, String hostname) { + public TreeVncCommand(MyRfbProto rfb,String myHostName, TreeCommand command, int port, String hostname, short value) { this.rfb = rfb; this.myHostName = myHostName; this.hostname = hostname; this.port = port; this.command = command; + this.value = value; } public TreeVncCommand(MyRfbProto rfb, String myHostAddress, TreeCommand newNode, @@ -43,10 +45,10 @@ handleFindRootReply(port,hostname,myHostName); break; case CONNECT_TO_AS_LEADER : - handleConnectTo( port,hostname,myHostName,true); + handleConnectTo( port,hostname,myHostName,true,this.value); break; case CONNECT_TO : - handleConnectTo( port,hostname,myHostName,false); + handleConnectTo( port,hostname,myHostName,false,this.value); break; case FIND_ROOT : // this is a multicast message, it is handled in FindRootListener @@ -83,14 +85,16 @@ * @param port * @param hostname * @param leader + * @param id * @throws IOException * @throws SocketException * @throws UnknownHostException */ - void handleConnectTo(int port, String hostname, String myHostName, boolean leader) { + void handleConnectTo(int port, String hostname, String myHostName, boolean leader, short id) { if (rfb.isRoot()) { return; // we don't have parent } + rfb.setId(id); try { rfb.treeProtocol.connectToParenet(port, hostname, myHostName, leader); } catch (IOException e) {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommandChannelListener.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommandChannelListener.java Thu Jun 19 20:25:19 2014 +0900 @@ -129,7 +129,8 @@ TreeVncCommand treeVncCommand(byte[] b, Reader is, Writer os, String myHostName) throws TransportException, IOException { ByteBuffer buf = ByteBuffer.wrap(b); TreeCommand command = TreeCommand.create(buf.get()&0xff); // make it unsigned - buf.position(buf.position()+3); + buf.get(); + short value = buf.getShort(); int length = buf.getInt(); int port = buf.getInt(); String hostname = null; @@ -146,7 +147,7 @@ } hostname = new String(namebuf); } - return new TreeVncCommand(rfb, myHostName, command, port, hostname); + return new TreeVncCommand(rfb, myHostName, command, port, hostname, value); }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java Thu Jun 19 20:25:19 2014 +0900 @@ -26,12 +26,12 @@ } public UpdateRectangleMessage(int width, int height, - EncodingType desktopSize, byte[] initData) { + EncodingType desktopSize, byte[] initData, short id) { msg = ByteBuffer.allocate(16+4+initData.length).order(ByteOrder.BIG_ENDIAN); msg.put((byte) 0); // FrameBufferUpdate msg.put((byte) 0); // padding msg.putShort((short) 1); // number of rectangle - msg.putShort((short) 0); + msg.putShort((short) id); msg.putShort((short) 0); msg.putShort((short) width); msg.putShort((short) height);
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/TreeVncProtocol.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/TreeVncProtocol.java Thu Jun 19 20:25:19 2014 +0900 @@ -45,23 +45,23 @@ } public void findRootReply(int port) throws IOException { - sendWithHostAndPort(TreeCommand.FIND_ROOT_REPLY, null, port); + sendWithHostAndPort(TreeCommand.FIND_ROOT_REPLY, null, port, (short) 0); } public void whereToConnect(String hostname, int port) throws IOException { - sendWithHostAndPort(TreeCommand.WHERE_TO_CONNECT, hostname, port); + sendWithHostAndPort(TreeCommand.WHERE_TO_CONNECT, hostname, port, (short) 0); } - public void connectTo(String hostname, int port,int leaderFlag) throws IOException{ + public void connectTo(String hostname, int port,int leaderFlag, short yourId) throws IOException{ TreeCommand command = leaderFlag == 1 ? TreeCommand.CONNECT_TO_AS_LEADER : TreeCommand.CONNECT_TO; - sendWithHostAndPort(command , hostname, port); + sendWithHostAndPort(command , hostname, port, yourId); } public void lostParent(String hostname, int port) throws IOException { - sendWithHostAndPort(TreeCommand.LOST_PARENT, hostname, port); + sendWithHostAndPort(TreeCommand.LOST_PARENT, hostname, port, (short) 0); } - public void sendWithHostAndPort(TreeCommand command, String hostname, int port) + public void sendWithHostAndPort(TreeCommand command, String hostname, int port, short value) throws IOException { openport(); if (hostname == null) { @@ -76,8 +76,7 @@ buf.put((byte) command.cmd); buf.put((byte) 0); - buf.put((byte) 0); - buf.put((byte) 0); + buf.putShort(value); buf.putInt(4+hostname.length()); // length buf.putInt(port); buf.put(hostname.getBytes(), 0, hostname.length());
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java Thu Jun 19 20:25:19 2014 +0900 @@ -85,7 +85,8 @@ TreeVNCNode n = nodeList.get(newparent.getTreeNum()+i) ; TreeVncProtocol vc = new TreeVncProtocol(n.getHostname(),n.getPort()); try { - vc.connectTo(newparent.getHostname(), newparent.getPort(), isLeader(newparent)); + short nodeId = (short) n.getTreeNum(); + vc.connectTo(newparent.getHostname(), newparent.getPort(), isLeader(newparent), nodeId); } catch (IOException e) { // log } @@ -120,10 +121,10 @@ if (nodeList.size() >= treebranch + 1) { TreeVNCNode parent = getParentNode(node.getTreeNum()); checkParameter(parent.getTreeNum(), nodeList.size(), isLeader(node)); - treeProtocol.connectTo(parent.getHostname(),parent.getPort(),isLeader(node)); + treeProtocol.connectTo(parent.getHostname(),parent.getPort(),isLeader(node), (short) node.getTreeNum()); } else { // connect to me - treeProtocol.connectTo(localhostname,rfb.getAcceptPort(),isLeader(node)); + treeProtocol.connectTo(localhostname,rfb.getAcceptPort(),isLeader(node), (short) node.getTreeNum()); } } catch (IOException e) { // log
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/Surface.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/Surface.java Thu Jun 19 20:25:19 2014 +0900 @@ -252,5 +252,10 @@ viewerWindow.setRemoteDesktopName(context.getRemoteDesktopName()); } + + @Override + public void setVisible(boolean b){ + viewerWindow.setVisible(b); + } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Jun 19 19:05:25 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Jun 19 20:25:19 2014 +0900 @@ -25,7 +25,6 @@ package com.glavsoft.viewer.swing; import com.glavsoft.core.SettingsChangedEvent; -import com.glavsoft.exceptions.TransportException; import com.glavsoft.rfb.IChangeSettingsListener; import com.glavsoft.rfb.client.KeyEventMessage; import com.glavsoft.rfb.protocol.Protocol; @@ -935,4 +934,9 @@ infoDialog.setModalityType(Dialog.ModalityType.MODELESS); infoDialog.setVisible(true); } + + public void setVisible(boolean b) { + frame.setVisible(b); + } + } \ No newline at end of file