changeset 192:aa00e4b2fc27

fix root viewer.
author oc
date Wed, 25 Jun 2014 20:54:26 +0900
parents 971b4ea361e8
children 5e652f5404e3
files src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java src/viewer_swing/java/com/glavsoft/viewer/RfbConnectionWorker.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java
diffstat 7 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java	Wed Jun 25 19:48:03 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java	Wed Jun 25 20:54:26 2014 +0900
@@ -352,6 +352,9 @@
 	    if (ready && reconnecting) {
 	        sendDesktopSizeChange(reconnectingId);
 	        reconnecting = false;
+	        if (reconnectingId == 0) {
+	        	viewer.setVisible(false);
+	        }
 	    } 
 	    if (reconnectingId!=0) {
 	        readyReconnect = ready;
@@ -623,6 +626,7 @@
     		throws UnknownHostException, IOException, InterruptedException {
     	// stop reader stop
         stopReceiverTask();
+        reconnectingId = id;
     	vncProxyService.inhelitClients(vncProxyService, hostName);
         // after connecting VNC server, rfb send SEND_INIT_DATA command and wakes me up if necessary 
     	reconnecting = true;
--- a/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java	Wed Jun 25 19:48:03 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java	Wed Jun 25 20:54:26 2014 +0900
@@ -29,6 +29,7 @@
 import com.glavsoft.viewer.mvp.Presenter;
 import com.glavsoft.viewer.swing.ConnectionParams;
 import com.glavsoft.viewer.swing.SwingNetworkConnectionWorker;
+import com.glavsoft.viewer.swing.SwingViewerWindow;
 import com.glavsoft.viewer.swing.WrongParameterException;
 import com.glavsoft.viewer.swing.gui.ConnectionView;
 import com.glavsoft.viewer.swing.gui.ConnectionsHistory;
@@ -310,4 +311,11 @@
 	public void setCuiVersion(boolean b) {
 		cuiVersion = b;
 	}
+
+	public SwingViewerWindow getViewer() {
+		if (rfbConnectionWorker != null) {
+			return rfbConnectionWorker.getViewer();
+		}
+		return null;
+	}
 }
--- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java	Wed Jun 25 19:48:03 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java	Wed Jun 25 20:54:26 2014 +0900
@@ -266,4 +266,8 @@
         
     }
 
+	@Override
+	public void setVisible(boolean b) {
+	}
+
 }
--- a/src/viewer_swing/java/com/glavsoft/viewer/RfbConnectionWorker.java	Wed Jun 25 19:48:03 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/RfbConnectionWorker.java	Wed Jun 25 20:54:26 2014 +0900
@@ -25,6 +25,7 @@
 package com.glavsoft.viewer;
 
 import com.glavsoft.rfb.protocol.ProtocolSettings;
+import com.glavsoft.viewer.swing.SwingViewerWindow;
 
 import java.net.Socket;
 
@@ -41,4 +42,6 @@
 
     void setConnectionString(String connectionString);
 
+	SwingViewerWindow getViewer();
+
 }
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java	Wed Jun 25 19:48:03 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java	Wed Jun 25 20:54:26 2014 +0900
@@ -30,6 +30,7 @@
 import com.glavsoft.viewer.swing.ConnectionParams;
 import com.glavsoft.viewer.swing.ParametersHandler;
 import com.glavsoft.viewer.swing.SwingConnectionWorkerFactory;
+import com.glavsoft.viewer.swing.SwingViewerWindow;
 import com.glavsoft.viewer.swing.SwingViewerWindowFactory;
 import com.glavsoft.viewer.swing.gui.ConnectionView;
 
@@ -356,8 +357,10 @@
         connectionParams.setConnectionParam(hostName, vncport);
         isApplet = true;
         this.setNoConnection(false);
+        if (myRfb.isRoot()) {
+        	setVisible(false);
+        }
         run();
-        myRfb.createConnectionAndStart(this);
     }
 
     public void proxyStart(String[] argv, int width, int height, boolean showTree) {
@@ -401,5 +404,12 @@
         myRfbProto.setReconnecting(true);
         run();
     }
+    
+    @Override
+    public void setVisible(boolean b) {
+    	SwingViewerWindow v = connectionPresenter.getViewer();
+    	if (v != null) 
+    		v.setVisible(b);
+    }
 
 }
--- a/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java	Wed Jun 25 19:48:03 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java	Wed Jun 25 20:54:26 2014 +0900
@@ -33,4 +33,6 @@
 
     public void setNoConnection(boolean noConnection);
 
+	public void setVisible(boolean b);
+
 }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java	Wed Jun 25 19:48:03 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java	Wed Jun 25 20:54:26 2014 +0900
@@ -280,4 +280,9 @@
             return passwordDialog.getPassword();
         }
     }
+
+	@Override
+	public SwingViewerWindow getViewer() {
+		return viewerWindow;
+	}
 }