Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 167:1d3fa20b86bb
update remoteDesktopName.
author | oc |
---|---|
date | Thu, 19 Jun 2014 18:51:06 +0900 |
parents | 26bc52699cf3 |
children | 2ade64eba46f |
files | Todo.txt src/main/java/com/glavsoft/rfb/IRepaintController.java src/main/java/com/glavsoft/rfb/protocol/NullRepaintController.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/com/glavsoft/rfb/protocol/state/InitState.java src/viewer_swing/java/com/glavsoft/viewer/swing/Surface.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 7 files changed, 29 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Todo.txt Thu Jun 19 17:19:59 2014 +0900 +++ b/Todo.txt Thu Jun 19 18:51:06 2014 +0900 @@ -3,7 +3,7 @@ Share Button を押した際に、JFrameのTitleを更新する。 SwingViewerWindow.javaのsetRemoteDesktopName メソッドを呼べば解決するはず。 - サーバが切り替わった際、画面のサイズ等の情報を送信する (INIT_DATA) + サーバが切り替わった際、画面のサイズ等の情報を送信する。(INIT_DATA) Done -dオプションでviewerを別にあげるのをやめる。 2つめのviewerの表示が滞るのをデバッグする
--- a/src/main/java/com/glavsoft/rfb/IRepaintController.java Thu Jun 19 17:19:59 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/IRepaintController.java Thu Jun 19 18:51:06 2014 +0900 @@ -27,6 +27,7 @@ import com.glavsoft.drawing.Renderer; import com.glavsoft.rfb.encoding.PixelFormat; import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle; +import com.glavsoft.rfb.protocol.ProtocolContext; import com.glavsoft.transport.Reader; /** @@ -39,4 +40,5 @@ void updateCursorPosition(short x, short y); Renderer createRenderer(Reader reader, int width, int height, PixelFormat pixelFormat); void setPixelFormat(PixelFormat pixelFormat); + void updateRemoteDesktopName(ProtocolContext context); } \ No newline at end of file
--- a/src/main/java/com/glavsoft/rfb/protocol/NullRepaintController.java Thu Jun 19 17:19:59 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/NullRepaintController.java Thu Jun 19 18:51:06 2014 +0900 @@ -45,4 +45,9 @@ } + @Override + public void updateRemoteDesktopName(ProtocolContext context) { + + } + }
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jun 19 17:19:59 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jun 19 18:51:06 2014 +0900 @@ -34,15 +34,18 @@ 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; @@ -219,7 +222,7 @@ clipboardController.updateSystemClipboard(reader.readBytes(length)); } - public void framebufferUpdateMessage() throws CommonException { + public void framebufferUpdateMessage() throws CommonException, UnsupportedEncodingException { reader.readByte(); // padding int numberOfRectangles = reader.readUInt16(); while (numberOfRectangles-- > 0) { @@ -247,7 +250,11 @@ int length = reader.readInt32(); byte[] initData = new byte[length]; reader.read(initData); + String name = new String(initData, 24, length - 24, "US-ASCII"); + rfb.getContext().setRemoteDesktopName(name); + rfb.getContext().setInitData(initData); + repaintController.updateRemoteDesktopName(rfb.getContext()); reader.reset(); rfb.readSendData(length + 20, reader); // size of UpdateRectangleMessage with initData. }
--- a/src/main/java/com/glavsoft/rfb/protocol/state/InitState.java Thu Jun 19 17:19:59 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/state/InitState.java Thu Jun 19 18:51:06 2014 +0900 @@ -74,7 +74,7 @@ completeContextData(serverInitMessage); } - protected void completeContextData(ServerInitMessage serverInitMessage) { + public void completeContextData(ServerInitMessage serverInitMessage) { context.setPixelFormat(serverInitMessage.getPixelFormat()); context.setFbWidth(serverInitMessage.getFrameBufferWidth()); context.setFbHeight(serverInitMessage.getFrameBufferHeight());
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/Surface.java Thu Jun 19 17:19:59 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/Surface.java Thu Jun 19 18:51:06 2014 +0900 @@ -247,4 +247,10 @@ } } + @Override + public void updateRemoteDesktopName(ProtocolContext context) { + viewerWindow.setRemoteDesktopName(context.getRemoteDesktopName()); + + } + }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Jun 19 17:19:59 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Jun 19 18:51:06 2014 +0900 @@ -53,6 +53,7 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Logger; +import jp.ac.u_ryukyu.treevnc.MyRfbProto; import jp.ac.u_ryukyu.treevnc.ScreenChangeRequest; public class SwingViewerWindow implements IChangeSettingsListener { @@ -217,6 +218,11 @@ public void setRemoteDesktopName(String name) { remoteDesktopName = name; + MyRfbProto rfb = viewer.getRfb(); + if (rfb!=null) { + int port = rfb.getAcceptPort(); + remoteDesktopName += ":" + port; + } updateWindowTitle(); }