changeset 304:d2a56d7d4b2d

send initData secound
author oc
date Tue, 20 Jan 2015 16:40:30 +0900
parents 1526c99f5d21
children 0ee520f535c9
files src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommandChannelListener.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java
diffstat 3 files changed, 18 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Tue Jan 20 11:40:16 2015 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Tue Jan 20 16:40:30 2015 +0900
@@ -177,8 +177,6 @@
                                     String newHostName = new String(byteAddress, "UTF-8");                                    
                                     int frameSizeWidth = buf.getInt();
                                     int frameSizeHeight = buf.getInt();
-                                    // send single display widht other node.
-                                    sendSingleDisplaySize(frameSizeWidth, frameSizeWidth);
                                     System.out.println("Root server change request :" + newHostName);
                                     // please remove these numbers.
                                     if (viewer != null) {
@@ -482,7 +480,16 @@
         LinkedList<ByteBuffer> desktopSize = new LinkedList<ByteBuffer>();
         int width = context.getFbWidth();
         int height = context.getFbHeight();
-        desktopSize.add(new ChengeDesktopSize(width, height, EncodingType.INIT_DATA, context.getInitData(),id).getMessage());
+        byte[] initData = null;
+
+        if (filterSingleDisplay) {
+            width = singleWidth;
+            height = singleHeight;
+            TreeVncCommandChannelListener hoge = new TreeVncCommandChannelListener(this, acceptPort);
+            initData = hoge.createOriginalInitData(width, height, context.getRemoteDesktopName());
+//            byte[] initData = createOriginalInitData(width, height, context.getRemoteDesktopName());
+        }
+        desktopSize.add(new ChengeDesktopSize(width, height, EncodingType.INIT_DATA, initData,id).getMessage());
         addSerialNumber(desktopSize);
         multicastqueue.put(desktopSize);
     }
@@ -742,13 +749,12 @@
 
         this.frameSizeWidth = width;
         this.frameSizeHeight = height;
-
         singleWidth = frameSizeWidth;
         singleHeight = frameSizeHeight;
-
-        // send single display width to other node.
-        sendSingleDisplaySize(singleWidth, singleHeight);
-
+        if (filterSingleDisplay) {
+            // send single display width to other node.
+            sendSingleDisplaySize(singleWidth, singleHeight);
+        }
         // stop reader stop
         stopReceiverTask();
         reconnectingId = id;
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommandChannelListener.java	Tue Jan 20 11:40:16 2015 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommandChannelListener.java	Tue Jan 20 16:40:30 2015 +0900
@@ -220,12 +220,12 @@
     }
 
     void sendInitData(Writer os) throws TransportException {
-        int width = rfb.singleWidth;
-        int height = rfb.singleHeight;
         ProtocolContext context = rfb.context;
         if (context != null) {
-            byte[] initData = createOriginalInitData(width, height, context.getRemoteDesktopName());
             if (rfb.filterSingleDisplay) {
+                int width = rfb.singleWidth;
+                int height = rfb.singleHeight;
+                byte[] initData = createOriginalInitData(width, height, context.getRemoteDesktopName());
                 os.write(initData);
             } else {
                 os.write(context.getInitData());
@@ -241,7 +241,7 @@
         }
     }
 
-    private byte[] createOriginalInitData(int width, int height, String desktopName) {
+    public byte[] createOriginalInitData(int width, int height, String desktopName) {
         byte[] titleBytes = null;
         int titleLength = 0;
         byte[] pixelFormat = {32, 24, 0, 1, 0, -1, 0, -1, 0, -1, 16, 8, 0, 0, 0, 0, 0, 0, 0};
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java	Tue Jan 20 11:40:16 2015 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java	Tue Jan 20 16:40:30 2015 +0900
@@ -858,10 +858,6 @@
                 int singleHeight = (int) rectangles.get(leftScreenNumber).getHeight();
                 viewer.getRfb().singleWidth = singleWidth;
                 viewer.getRfb().singleHeight = singleHeight;
-
-                singleWidth = 600;
-                singleHeight = 600;
-
                 /*
                 // show share sound dialog.
                 boolean setShareSound = presenter.showShareSoundDialog();
@@ -875,7 +871,6 @@
                     }
                 }
                 */
-
                 if (viewer.getRfb().isTreeManager()) {
                     changeVncServer(viewer, singleWidth, singleHeight, viewer.getRfb().getId());
                     return;