# HG changeset patch # User innparusu # Date 1439198232 -32400 # Node ID bc5624e3e9c5ef87766613727413d47297393c4d # Parent 1eaaa650b4d043704cc9a2a44299758e5a3c80b4 Add newVNCConnection method to Viewer diff -r 1eaaa650b4d0 -r bc5624e3e9c5 TreeVNC.iml --- a/TreeVNC.iml Thu Aug 06 20:11:28 2015 +0900 +++ b/TreeVNC.iml Mon Aug 10 18:17:12 2015 +0900 @@ -6,19 +6,18 @@ + - + - - + - - + \ No newline at end of file diff -r 1eaaa650b4d0 -r bc5624e3e9c5 src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java --- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Thu Aug 06 20:11:28 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Mon Aug 10 18:17:12 2015 +0900 @@ -136,21 +136,8 @@ final boolean hasJsch = checkJsch(); final boolean allowInteractive = allowAppletInteractiveConnections || !isApplet; - connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive); + ConnectionPresenter connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive); connectionPresenter.addModel("ConnectionParamsModel", connectionParams); - - - /* - * SwingViewerWindowFactory viewerWindowFactory = new - * SwingViewerWindowFactory( isSeparateFrame, isApplet, this); - * - * connectionPresenter.setConnectionWorkerFactory(new - * SwingConnectionWorkerFactory( connectionView.getFrame(), - * passwordFromParams, connectionPresenter, viewerWindowFactory, - * myRfb)); - */ - - connectionPresenter.setConnectionWorkerFactory( new SwingConnectionWorkerFactory(null, passwordFromParams, connectionPresenter, null, myRfb)); connectionPresenter.setCuiVersion(true); @@ -158,6 +145,11 @@ } @Override + public synchronized void newVNCConnection(ConnectionPresenter presenter) { + connectionPresenter = presenter; + } + + @Override public void windowOpened(WindowEvent e) { /* nop */ } diff -r 1eaaa650b4d0 -r bc5624e3e9c5 src/viewer_swing/java/com/glavsoft/viewer/Viewer.java --- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Thu Aug 06 20:11:28 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Mon Aug 10 18:17:12 2015 +0900 @@ -224,7 +224,7 @@ public void run() { final boolean hasJsch = checkJsch(); final boolean allowInteractive = allowAppletInteractiveConnections || ! isApplet; - connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive); + ConnectionPresenter connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive); connectionPresenter.setNoConnection(noConnection); connectionPresenter.addModel("ConnectionParamsModel", connectionParams); ConnectionView connectionView = new ConnectionView( @@ -249,6 +249,11 @@ } @Override + public synchronized void newVNCConnection(ConnectionPresenter presenter) { + connectionPresenter = presenter; + } + + @Override public void windowOpened(WindowEvent e) { /* nop */ } @Override public void windowClosed(WindowEvent e) { /* nop */ } @@ -458,6 +463,7 @@ return rectangles; } + @Override public void setFitScreen() { SwingViewerWindow v = connectionPresenter.getViewer(); diff -r 1eaaa650b4d0 -r bc5624e3e9c5 src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java --- a/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java Thu Aug 06 20:11:28 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java Mon Aug 10 18:17:12 2015 +0900 @@ -50,4 +50,6 @@ public void setFitScreen(); public ArrayList getScreenRectangles(); + + void newVNCConnection(ConnectionPresenter presenter); } diff -r 1eaaa650b4d0 -r bc5624e3e9c5 src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java --- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Thu Aug 06 20:11:28 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Mon Aug 10 18:17:12 2015 +0900 @@ -108,6 +108,9 @@ try { get(); presenter.showMessage("Handshake established"); + if(myRfb.hasViewer()) { + myRfb.getViewer().newVNCConnection(presenter); + } ClipboardControllerImpl clipboardController; if(!myRfb.getCuiVersion()) clipboardController = new ClipboardControllerImpl(workingProtocol, rfbSettings.getRemoteCharsetName());