comparison src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java @ 304:d2a56d7d4b2d

send initData secound
author oc
date Tue, 20 Jan 2015 16:40:30 +0900
parents 7ef19658eb41
children 0ee520f535c9
comparison
equal deleted inserted replaced
303:1526c99f5d21 304:d2a56d7d4b2d
175 byte[] byteAddress = new byte[length]; 175 byte[] byteAddress = new byte[length];
176 buf.get(byteAddress); 176 buf.get(byteAddress);
177 String newHostName = new String(byteAddress, "UTF-8"); 177 String newHostName = new String(byteAddress, "UTF-8");
178 int frameSizeWidth = buf.getInt(); 178 int frameSizeWidth = buf.getInt();
179 int frameSizeHeight = buf.getInt(); 179 int frameSizeHeight = buf.getInt();
180 // send single display widht other node.
181 sendSingleDisplaySize(frameSizeWidth, frameSizeWidth);
182 System.out.println("Root server change request :" + newHostName); 180 System.out.println("Root server change request :" + newHostName);
183 // please remove these numbers. 181 // please remove these numbers.
184 if (viewer != null) { 182 if (viewer != null) {
185 changeVNCServer(viewer, newHostName, frameSizeWidth, frameSizeHeight, id); 183 changeVNCServer(viewer, newHostName, frameSizeWidth, frameSizeHeight, id);
186 } 184 }
480 478
481 public void sendDesktopSizeChange(short id) { 479 public void sendDesktopSizeChange(short id) {
482 LinkedList<ByteBuffer> desktopSize = new LinkedList<ByteBuffer>(); 480 LinkedList<ByteBuffer> desktopSize = new LinkedList<ByteBuffer>();
483 int width = context.getFbWidth(); 481 int width = context.getFbWidth();
484 int height = context.getFbHeight(); 482 int height = context.getFbHeight();
485 desktopSize.add(new ChengeDesktopSize(width, height, EncodingType.INIT_DATA, context.getInitData(),id).getMessage()); 483 byte[] initData = null;
484
485 if (filterSingleDisplay) {
486 width = singleWidth;
487 height = singleHeight;
488 TreeVncCommandChannelListener hoge = new TreeVncCommandChannelListener(this, acceptPort);
489 initData = hoge.createOriginalInitData(width, height, context.getRemoteDesktopName());
490 // byte[] initData = createOriginalInitData(width, height, context.getRemoteDesktopName());
491 }
492 desktopSize.add(new ChengeDesktopSize(width, height, EncodingType.INIT_DATA, initData,id).getMessage());
486 addSerialNumber(desktopSize); 493 addSerialNumber(desktopSize);
487 multicastqueue.put(desktopSize); 494 multicastqueue.put(desktopSize);
488 } 495 }
489 496
490 497
740 public void changeVNCServer(ViewerInterface vncProxyService, String hostName, int width, int height, short id) 747 public void changeVNCServer(ViewerInterface vncProxyService, String hostName, int width, int height, short id)
741 throws UnknownHostException, IOException, InterruptedException { 748 throws UnknownHostException, IOException, InterruptedException {
742 749
743 this.frameSizeWidth = width; 750 this.frameSizeWidth = width;
744 this.frameSizeHeight = height; 751 this.frameSizeHeight = height;
745
746 singleWidth = frameSizeWidth; 752 singleWidth = frameSizeWidth;
747 singleHeight = frameSizeHeight; 753 singleHeight = frameSizeHeight;
748 754 if (filterSingleDisplay) {
749 // send single display width to other node. 755 // send single display width to other node.
750 sendSingleDisplaySize(singleWidth, singleHeight); 756 sendSingleDisplaySize(singleWidth, singleHeight);
751 757 }
752 // stop reader stop 758 // stop reader stop
753 stopReceiverTask(); 759 stopReceiverTask();
754 reconnectingId = id; 760 reconnectingId = id;
755 vncProxyService.inhelitClients(vncProxyService, hostName); 761 vncProxyService.inhelitClients(vncProxyService, hostName);
756 // after connecting VNC server, rfb send SEND_INIT_DATA command and wakes me up if necessary 762 // after connecting VNC server, rfb send SEND_INIT_DATA command and wakes me up if necessary