changeset 442:614057b86122

presenter
author one
date Thu, 16 Jun 2016 21:50:53 +0900
parents cee43ceac9b3
children 967aa1f24ba4
files src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/ChangeDesktopSize.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java
diffstat 3 files changed, 19 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java	Thu Jun 16 21:08:19 2016 +0900
+++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java	Thu Jun 16 21:50:53 2016 +0900
@@ -293,9 +293,9 @@
 
                     if (rect.getEncodingType() == EncodingType.INIT_DATA) {
                         // VNCServer is changed, initiarize new screen.
-                        int length = reader.readInt32();
+                        int length = reader.readInt32() - 2;
                         short id = reader.readInt16();
-                        byte[] initData = new byte[length-2];
+                        byte[] initData = new byte[length];
                         reader.read(initData);
                         String name = new String(initData, 24, length - 24, "UTF-8");
                         context.setRemoteDesktopName(name);
@@ -308,7 +308,7 @@
                         reader.reset();
                         // All children multicastqueue should be discarded here.
 //                        rfb.clearChildrenTransmission();
-                        rfb.readSendData(length + 20, reader, null, rect); // size of UpdateRectangleMessage with initData.
+                        rfb.readSendData(length + 20 + 2, reader, null, rect); // size of UpdateRectangleMessage with initData.
                         visible = (id != rfb.getId());
                     }
                     synchronized (renderer.getLock()) {
@@ -320,7 +320,12 @@
                         repaintController.setVisible(visible);
                     }
                     if (rfb.hasViewer()){
-                        rfb.getViewer().setFitScreen();
+                        ViewerInterface v = rfb.getViewer();
+                        v.getConnectionPresenter().setX(rfb.getX());
+                        v.getConnectionPresenter().setY(rfb.getY());
+                        v.getConnectionPresenter().setFrameSizeWidth(rfb.frameSizeWidth);
+                        v.getConnectionPresenter().setFrameSizeHeight(rfb.frameSizeHeight);
+                        v.setFitScreen();
                     }
                     if (rfb.isTreeManager()) {
                         context.sendMessage(new FramebufferUpdateRequestMessage(rect.x, rect.y, rect.width, rect.height, false));
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/ChangeDesktopSize.java	Thu Jun 16 21:08:19 2016 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/ChangeDesktopSize.java	Thu Jun 16 21:50:53 2016 +0900
@@ -11,7 +11,7 @@
 
     public ChangeDesktopSize(int width, int height,
                              int x, int y, EncodingType desktopSize, byte[] initData, short id) {
-        msg = ByteBuffer.allocate(16+4+initData.length).order(ByteOrder.BIG_ENDIAN);
+        msg = ByteBuffer.allocate(16+4+initData.length+2).order(ByteOrder.BIG_ENDIAN);
         msg.put((byte) 0); // FrameBufferUpdate
         msg.put((byte) 0); // padding
         msg.putShort((short) 1); // number of rectangle
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java	Thu Jun 16 21:08:19 2016 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java	Thu Jun 16 21:50:53 2016 +0900
@@ -1020,13 +1020,15 @@
         final int thatScreenY = presenter.getY();
         final int thatScreenWidth = presenter.getFrameSizeWidth()*presenter.getRetinaScale();
         final int thatScreenHeight = presenter.getFrameSizeHeight()*presenter.getRetinaScale();
-            //System.out.println("thatScreenX:" + thatScreenX);
-            //System.out.println("thatScreenY:" + thatScreenY);
-            //System.out.println("thatScreenWidth:" + thatScreenWidth);
-            //System.out.println("thatScreenHeight:" + thatScreenHeight);
-            //System.out.println("getMaximum:" + scroller.getHorizontalScrollBar().getMaximum());
-            //System.out.println("getMinmum:" + scroller.getHorizontalScrollBar().getMinimum());
-            // uiSettings.zoomToFit(2*thatScreenWidth, 2*thatScreenHeight, thisScreenWidth, thisScreenHeight);
+            System.out.println("thatScreenX:" + thatScreenX);
+            System.out.println("thatScreenY:" + thatScreenY);
+            System.out.println("thisScreenWidth:" + thisScreenWidth);
+            System.out.println("thisScreenHeight:" + thisScreenHeight);
+            System.out.println("thatScreenWidth:" + thatScreenWidth);
+            System.out.println("thatScreenHeight:" + thatScreenHeight);
+            System.out.println("getMaximum:" + scroller.getHorizontalScrollBar().getMaximum());
+            System.out.println("getMinmum:" + scroller.getHorizontalScrollBar().getMinimum());
+
         frame.setSize(thisScreenWidth, thisScreenHeight);
         uiSettings.fitScreen(thisScreenWidth, thisScreenHeight, thatScreenWidth, thatScreenHeight);
         // final Rectangle visible = new Rectangle(thatScreenX,thatScreenY,thatScreenWidth,thatScreenHeight);