diff src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java @ 405:cdab1354e227

Add multiscreen Share Filtering flag
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Mon, 09 Nov 2015 01:06:11 +0900
parents 73c96a1d4a3a
children da1d6d6b4981
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Sun Nov 08 01:27:18 2015 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Mon Nov 09 01:06:11 2015 +0900
@@ -71,9 +71,10 @@
     public int fixingSizeWidth;
     public int fixingSizeHeight;
 
+
     private int singleWidth = 0;
     private int singleHeight = 0;
-
+    private int shareScreenNumber;
     private DatagramSocket socket = null;
 
     private byte[] originalInitData = null;
@@ -214,8 +215,9 @@
                                     int frameSizeWidth = buf.getInt();
                                     int frameSizeHeight = buf.getInt();
                                     int port = buf.getInt();
+                                    int shareScreenNumber = buf.getInt();
                                     System.out.println("Root server change request :" + newHostName + " : " + port);
-                                    changeVNCServer(viewer, newHostName, port, frameSizeWidth, frameSizeHeight, id, is, os);
+                                    changeVNCServer(viewer, newHostName, port, frameSizeWidth, frameSizeHeight, shareScreenNumber, id, is, os);
                                 } else {
                                     continue;
                                 }
@@ -781,22 +783,24 @@
 
     /**
      * change VNCServer is called when host change.
-     *  @param vncProxyService
+     * @param vncProxyService
      * @param hostName
      *            HostAddress
      * @param width
- *            FrameWidth
+*            FrameWidth
      * @param height
 *            FrameHeight
+     * @param shareScreenNumber
      * @param newVNCServerId
      * @param is
      * @param os
      */
-    public void changeVNCServer(ViewerInterface vncProxyService, String hostName, int port, int width, int height, short newVNCServerId, Reader is, Writer os)
+    public void changeVNCServer(ViewerInterface vncProxyService, String hostName, int port, int width, int height, int shareScreenNumber, short newVNCServerId, Reader is, Writer os)
             throws IOException {
 
         this.frameSizeWidth = width;
         this.frameSizeHeight = height;
+        this.shareScreenNumber = shareScreenNumber;
         singleWidth = frameSizeWidth;
         singleHeight = frameSizeHeight;
         if (newVNCServerId == -1) {
@@ -902,6 +906,10 @@
         return singleHeight;
     }
 
+    public int getShareScreenNumber() {
+        return shareScreenNumber;
+    }
+
     public boolean hasParent() {
         return id != -1;
     }
@@ -917,7 +925,7 @@
      */
     public void exchangeDirectConnectedServer(Reader previousReader, Writer previousWriter) {
         String adr = viewer.getRfb().getMyAddress();
-        ScreenChangeRequest scr = new ScreenChangeRequest(adr, ConnectionParams.DEFAULT_VNC_ROOT, (short) -1, singleWidth, singleHeight);
+        ScreenChangeRequest scr = new ScreenChangeRequest(adr, ConnectionParams.DEFAULT_VNC_ROOT, (short) -1, singleWidth, singleHeight, shareScreenNumber);
         try {
             scr.send(previousWriter);
         } catch (TransportException e) {