Mercurial > hg > Applications > TreeVNC
changeset 65:ffd7537cebfc
cuiversion
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java Mon Jan 27 16:35:20 2014 +0900 @@ -32,7 +32,11 @@ reader.readUInt16();// numberOfRectangle rect.fill(reader);// fill Decoder decoder = new ZRLEDecoder(); - decoder.decode(reader,renderer,rect); + int zippedLength = (int) reader.readUInt32(); + if(!rfb.getCuiVersion()) + decoder.decode(reader,renderer,rect); + else + reader.readBytes(zippedLength);System.out.println("path"); } }
--- a/src/main/java/com/glavsoft/rfb/protocol/Protocol.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/Protocol.java Mon Jan 27 16:35:20 2014 +0900 @@ -395,4 +395,32 @@ this.fbWidth = fbWidth; this.fbHeight = fbHeight; } + + public void startTreeClientHandling(IRfbSessionListener rfbSessionListener, + ClipboardController clipboardController, MyRfbProto rfb) { + this.rfbSessionListener = rfbSessionListener; +// if (settings.getBitsPerPixel() == 0) { +// settings.setBitsPerPixel(pixelFormat.bitsPerPixel); // the same the server sent when not initialized yet +// } + serverPixelFormat = pixelFormat; + serverPixelFormat.trueColourFlag = 1; // correct flag - we don't support color maps + setPixelFormat(createPixelFormat(settings)); + sendMessage(new SetPixelFormatMessage(pixelFormat)); + logger.fine("sent: "+pixelFormat); + + sendSupportedEncodingsMessage(settings); + settings.addListener(this); // to support pixel format (color depth), and encodings changes + + sendRefreshMessage(); + senderTask = new SenderTask(messageQueue, writer, this); + senderThread = new Thread(senderTask); + senderThread.start(); + decoders.resetDecoders(); + receiverTask = new TreeTask( + reader, null, + clipboardController, + decoders, this, rfb); + receiverThread = new Thread(receiverTask); + receiverThread.start(); + } }
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Mon Jan 27 16:35:20 2014 +0900 @@ -67,13 +67,21 @@ protected PixelFormat pixelFormat; protected boolean needSendPixelFormat; private MyRfbProto rfb; + private boolean cuiVersion; public ReceiverTask(Reader reader, IRepaintController repaintController, ClipboardController clipboardController, DecodersContainer decoders, ProtocolContext context, MyRfbProto _rfb) { - this(reader,repaintController,clipboardController,decoders,context); rfb = _rfb; + this.reader = reader; + this.repaintController = repaintController; + this.clipboardController = clipboardController; + this.context = context; + this.decoders = decoders; + if(!rfb.getCuiVersion()) + renderer = repaintController.createRenderer(reader, context.getFbWidth(), context.getFbHeight(),context.getPixelFormat()); + fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(0, 0, context.getFbWidth(), context.getFbHeight(), true); if(!(rfb instanceof MyRfbProtoClient)) { fullscreenFbUpdateIncrementalRequest.sendFullScreenRequest(); connectionFinished(); @@ -197,10 +205,14 @@ logger.finest(rect.toString() + (0 == numberOfRectangles ? "\n---" : "")); if (decoder != null) { decoder.decode(reader, renderer, rect); - repaintController.repaintBitmap(rect); + if(!(rfb.getCuiVersion())) + repaintController.repaintBitmap(rect); + else + System.out.println("cuiversion"); } else if (rect.getEncodingType() == EncodingType.RICH_CURSOR) { RichCursorDecoder.getInstance().decode(reader, renderer, rect); - repaintController.repaintCursor(); + if(repaintController!=null) + repaintController.repaintCursor(); } else if (rect.getEncodingType() == EncodingType.CURSOR_POS) { renderer.decodeCursorPosition(rect); repaintController.repaintCursor(); @@ -208,8 +220,8 @@ fullscreenFbUpdateIncrementalRequest = new FramebufferUpdateRequestMessage(0, 0, rect.width, rect.height, true); synchronized (renderer.getLock()) { - renderer = repaintController.createRenderer(reader, rect.width, rect.height, - context.getPixelFormat()); + if(!(rfb.getCuiVersion())) + renderer = repaintController.createRenderer(reader, rect.width, rect.height,context.getPixelFormat()); } context.sendMessage(new FramebufferUpdateRequestMessage(0, 0, rect.width, rect.height, false)); // repaintController.repaintCursor(); @@ -243,4 +255,5 @@ private void connectionFinished() { rfb.setReadyReconnect(true); } + }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Mon Jan 27 16:35:20 2014 +0900 @@ -16,6 +16,7 @@ import com.glavsoft.transport.Reader; import com.glavsoft.transport.Writer; import com.glavsoft.viewer.Viewer; +import com.glavsoft.viewer.ViewerImpl; public class MyRfbProto { final static int FramebufferUpdateRequest = 3; @@ -31,7 +32,8 @@ private EchoClient echo; private String proxyAddr; public int acceptPort; - protected boolean readyReconnect; + protected boolean readyReconnect; + private boolean cuiVersion; public MyRfbProto() { rThread = new RequestScreenThread(this); @@ -151,6 +153,7 @@ continue; else if (header.get(0) == CheckDelay) { writeToClient(os, bufs, inputIndex); + //System.out.println("*********checkdelay****************"); continue; } else if (header.get(0) == FramebufferUpdate) { //System.out.println("client "+ myId); @@ -337,10 +340,14 @@ echo = _echo; } - public void setViewer(Viewer v) { + public void setViewer(ViewerImpl v) { echo.setViewer(v); } + public ViewerImpl getViewer() { + return echo.getViewer(); + } + public EchoClient getEcho() { return echo; } @@ -372,5 +379,15 @@ } public void setReadyReconnect(boolean ready) { + } + + + public boolean getCuiVersion() { + return cuiVersion; } + + public void setCuiVersion(boolean flag) { + cuiVersion = flag; + } + }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/EchoClient.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/EchoClient.java Mon Jan 27 16:35:20 2014 +0900 @@ -4,6 +4,7 @@ import java.net.*; import com.glavsoft.viewer.Viewer; +import com.glavsoft.viewer.ViewerImpl; public class EchoClient { private String proxyName; @@ -14,7 +15,7 @@ private WaitReply waitReply; private Socket clientSocket = null; private int echoPort = 9999; - public Viewer client; + public ViewerImpl client; private String parentAddress; public String parentNum; public String treeNum; @@ -245,9 +246,13 @@ } } - public void setViewer(Viewer v) { + public void setViewer(ViewerImpl v) { client = v; } + + public ViewerImpl getViewer() { + return client; + } public String getMyAddress() { return myAddress;
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java Mon Jan 27 16:35:20 2014 +0900 @@ -313,8 +313,20 @@ blen.flip(); bufs.addFirst(blen); bufs.addFirst(header); - //if(header.getShort(4)<1920) - multicastqueue.put(bufs); + /* + if(header.getShort(4)>1920) { + LinkedList<ByteBuffer> check = new LinkedList<ByteBuffer>(); + ByteBuffer test = ByteBuffer.allocate(4); + ByteBuffer header2 = ByteBuffer.allocate(16); + header2.put((byte)11); + test.putInt(100); + test.flip(); + check.addFirst(test); + check.addFirst(header2); + multicastqueue.put(check); + } + */ + multicastqueue.put(bufs); // is.reset(); return; }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Mon Jan 27 16:35:20 2014 +0900 @@ -245,7 +245,6 @@ Socket echoSocket = new Socket(client, 10001); DataOutputStream os = new DataOutputStream( echoSocket.getOutputStream()); - System.out.println(client); os.writeBytes("reconnection\n"); if(counter++ < aClient.getTreeBranch()) os.writeBytes(port + "\n");
--- a/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Mon Jan 27 16:35:20 2014 +0900 @@ -28,6 +28,7 @@ import com.glavsoft.utils.Strings; import com.glavsoft.viewer.mvp.Presenter; import com.glavsoft.viewer.swing.ConnectionParams; +import com.glavsoft.viewer.swing.SwingNetworkConnectionWorker; import com.glavsoft.viewer.swing.WrongParameterException; import com.glavsoft.viewer.swing.gui.ConnectionView; import com.glavsoft.viewer.swing.gui.ConnectionsHistory; @@ -65,6 +66,7 @@ private NetworkConnectionWorker networkConnectionWorker; private boolean needReconnection = true; private boolean isTreeVNC = false; + private boolean cuiVersion; public ConnectionPresenter(boolean hasSshSupport, boolean allowInteractive) { this.hasSshSupport = hasSshSupport; @@ -127,7 +129,10 @@ private void connect() { final ConnectionParams connectionParams = (ConnectionParams) getModel(CONNECTION_PARAMS_MODEL); // TODO check connectionWorkerFactory is init - networkConnectionWorker = connectionWorkerFactory.createNetworkConnectionWorker(); +// if(!cuiVersion) + networkConnectionWorker = connectionWorkerFactory.createNetworkConnectionWorker(); +// else +// networkConnectionWorker = new SwingNetworkConnectionWorker(null); networkConnectionWorker.setConnectionParams(connectionParams); networkConnectionWorker.setPresenter(this); networkConnectionWorker.setHasSshSupport(hasSshSupport); @@ -298,4 +303,8 @@ public void setIsTreeVNC(boolean flag) { isTreeVNC = flag; } + + public void setCuiVersion(boolean b) { + cuiVersion = b; + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Mon Jan 27 16:35:20 2014 +0900 @@ -0,0 +1,269 @@ +package com.glavsoft.viewer; + +import com.glavsoft.rfb.protocol.ProtocolSettings; +import com.glavsoft.viewer.cli.Parser; +import com.glavsoft.viewer.mvp.View; +import com.glavsoft.viewer.swing.ConnectionParams; +import com.glavsoft.viewer.swing.ParametersHandler; +import com.glavsoft.viewer.swing.SwingConnectionWorkerFactory; +import com.glavsoft.viewer.swing.SwingViewerWindowFactory; +import com.glavsoft.viewer.swing.gui.ConnectionView; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.io.IOException; +import java.io.InputStream; +import java.net.Socket; +import java.util.jar.Attributes; +import java.util.jar.Manifest; +import java.util.logging.*; + +import jp.ac.u_ryukyu.treevnc.AcceptThread; +import jp.ac.u_ryukyu.treevnc.CreateConnectionParam; +import jp.ac.u_ryukyu.treevnc.MyRfbProto; +import jp.ac.u_ryukyu.treevnc.client.GetDataClient; +import jp.ac.u_ryukyu.treevnc.client.GetHostClient; +import jp.ac.u_ryukyu.treevnc.client.MyRfbProtoClient; + +public class CuiViewer implements Runnable, WindowListener, ViewerImpl { + + private Logger logger; + private int paramsMask; + private boolean allowAppletInteractiveConnections; + + public final ConnectionParams connectionParams; + protected String passwordFromParams; + boolean isSeparateFrame = true; + protected boolean isApplet = true; + private final ProtocolSettings settings; + protected UiSettings uiSettings; + private volatile boolean isAppletStopped = false; + private ConnectionPresenter connectionPresenter; + private boolean isTreeVNC = false; + protected MyRfbProto myRfb; + private boolean cuiVersion; + + public static void main(String[] args) { + Parser parser = new Parser(); + ParametersHandler.completeParserOptions(parser); + + parser.parse(args); + if (parser.isSet(ParametersHandler.ARG_HELP)) { + printUsage(parser.optionsUsage()); + System.exit(0); + } + CuiViewer viewer = new CuiViewer(parser); + SwingUtilities.invokeLater(viewer); + } + + public static void printUsage(String additional) { + System.out + .println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]?n" + + " or?n" + + " java -jar (progfilename) [Options]?n" + + " or?n java -jar (progfilename) -help?n to view this help?n?n" + + "Where Options are:?n" + + additional + + "?nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes?n" + + "Both option name and option value are case insensitive."); + } + + public CuiViewer() { + logger = Logger.getLogger(getClass().getName()); + connectionParams = new ConnectionParams(); + settings = ProtocolSettings.getDefaultSettings(); + uiSettings = new UiSettings(); + } + + private CuiViewer(Parser parser) { + this(); + setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE + : parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER + : Level.INFO); + + paramsMask = ParametersHandler.completeSettingsFromCLI(parser, + connectionParams, settings, uiSettings); + passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD); + logger.info("TightVNC Viewer version " + ver()); + isApplet = false; + } + + private void setLoggingLevel(Level levelToSet) { + final Logger appLogger = Logger.getLogger("com.glavsoft"); + appLogger.setLevel(levelToSet); + ConsoleHandler ch = null; + for (Handler h : appLogger.getHandlers()) { + if (h instanceof ConsoleHandler) { + ch = (ConsoleHandler) h; + break; + } + } + if (null == ch) { + ch = new ConsoleHandler(); + appLogger.addHandler(ch); + } + // ch.setFormatter(new SimpleFormatter()); + ch.setLevel(levelToSet); + } + + @Override + public void windowClosing(WindowEvent e) { + if (e != null && e.getComponent() != null) { + final Window w = e.getWindow(); + if (w != null) { + w.setVisible(false); + w.dispose(); + } + } + closeApp(); + } + + /** + * Closes App(lication) or stops App(let). + */ + public void closeApp() { + /* nop */ + } + + private boolean checkJsch() { + try { + Class.forName("com.jcraft.jsch.JSch"); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } + + @Override + public void run() { + final boolean hasJsch = checkJsch(); + final boolean allowInteractive = allowAppletInteractiveConnections + || !isApplet; + 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); + connectionPresenter.startConnection(settings, uiSettings, paramsMask); + } + + @Override + public void windowOpened(WindowEvent e) { /* nop */ + } + + @Override + public void windowClosed(WindowEvent e) { /* nop */ + } + + @Override + public void windowIconified(WindowEvent e) { /* nop */ + } + + @Override + public void windowDeiconified(WindowEvent e) { /* nop */ + } + + @Override + public void windowActivated(WindowEvent e) { /* nop */ + } + + @Override + public void windowDeactivated(WindowEvent e) { /* nop */ + } + + public static String ver() { + final InputStream mfStream = Viewer.class.getClassLoader() + .getResourceAsStream("META-INF/MANIFEST.MF"); + if (null == mfStream) { + System.out.println("No Manifest file found."); + return "-1"; + } + try { + Manifest mf = new Manifest(); + mf.read(mfStream); + Attributes atts = mf.getMainAttributes(); + return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION); + } catch (IOException e) { + return "-2"; + } + } + + public void setType(TreeConnectionManager treeConnectionManager, + MyRfbProtoClient myRfbProtoClient) { + // must write + } + + public void setSocket(Socket soc) { + setConnectionParam(soc.getInetAddress().getHostAddress(), soc.getPort()); + // Thread accThread = new Thread(new AcceptThread(myRfb, + // soc.getPort())); + // accThread.start(); + } + + public void setOpenPort(int parseInt) { + // TODO Auto-generated method stub + + } + + public void setTeminationType(boolean b) { + myRfb.setTerminationType(b); + } + + public void startViewer() { + CuiViewer viewer = new CuiViewer(); + MyRfbProtoClient rfb = new MyRfbProtoClient(); + CreateConnectionParam cp = new CreateConnectionParam(rfb); + cp.communicationToProxy(); + cp.createConnectionParam(viewer); + viewer.isTreeVNC = true; + rfb.setViewer(viewer); + viewer.myRfb = rfb; + SwingUtilities.invokeLater(viewer); + } + + public void startViewer(String hostName, boolean cui) { + CuiViewer viewer = new CuiViewer(); + viewer.cuiVersion = cui; + MyRfbProtoClient rfb = new MyRfbProtoClient(); + CreateConnectionParam cp = new CreateConnectionParam(rfb); + cp.setHostName(hostName); + cp.createConnectionParam(viewer); + viewer.isTreeVNC = true; + rfb.setViewer(viewer); + rfb.setCuiVersion(true); + viewer.myRfb = rfb; + SwingUtilities.invokeLater(viewer); + } + + public void setConnectionParam(String hostName, int port) { + connectionParams.setHostName(hostName); + connectionParams.setPortNumber(port); + } + + public void setIsTreeVNC(boolean flag) { + isTreeVNC = flag; + } + + public MyRfbProto getRfb() { + return myRfb; + } + + public boolean getCuiVersion() { + return cuiVersion; + } +}
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Mon Jan 27 16:35:20 2014 +0900 @@ -6,8 +6,10 @@ public class TreeViewer { private boolean treeProxy; private boolean viewer; - private int width; + private int width; private int height; + private String hostName = null; + private boolean cuiVersion = true; // temp value.after remove. public static void main(String[] args) { new TreeViewer().vncStart(args); @@ -22,10 +24,14 @@ Viewer v = new Viewer(); v.startViewer(); } else { - //MyVncClient mvc = new MyVncClient(); - //mvc.startClient(args); - Viewer v = new Viewer(); - v.startViewer(); + if(hostName!=null) { + CuiViewer v = new CuiViewer(); + v.startViewer(hostName,true); + } else { + Viewer v = new Viewer(); + v.startViewer(); + } + } } @@ -44,11 +50,14 @@ treeProxy = true; if(getParameter(args,i)) i = i + 2; + }else if ("-h".equals(args[i])) { + hostName = args[++i]; } else { System.out.println("(default) TreeVNCClient\n" + "-p: TreeVNCProxy\n" + "-v: VNCViewer\n" + "-r: TreeVNCProxy for RemoteHost. you should input parameter host and port\n" + + "-h: set host name\n" + "-retina whidth heght: TreeVNC proxy for retina.this mode can select screen range."); } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Mon Jan 27 16:35:20 2014 +0900 @@ -52,7 +52,7 @@ import jp.ac.u_ryukyu.treevnc.client.MyRfbProtoClient; @SuppressWarnings("serial") -public class Viewer extends JApplet implements Runnable, WindowListener { +public class Viewer extends JApplet implements Runnable, WindowListener , ViewerImpl{ private Logger logger; private int paramsMask; @@ -66,8 +66,9 @@ protected UiSettings uiSettings; private volatile boolean isAppletStopped = false; private ConnectionPresenter connectionPresenter; - private boolean isTreeVNC = false; + boolean isTreeVNC = false; protected MyRfbProto myRfb; + private boolean cuiVersion; public static void main(String[] args) { Parser parser = new Parser(); @@ -276,8 +277,6 @@ } public void setSocket(Socket soc) { - System.out.println("----------------------------"+soc.getInetAddress().getHostAddress()); - System.out.println("----------------------------"+soc.getPort()); setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort()); //Thread accThread = new Thread(new AcceptThread(myRfb, soc.getPort())); //accThread.start(); @@ -302,9 +301,24 @@ rfb.setViewer(viewer); viewer.myRfb = rfb; SwingUtilities.invokeLater(viewer); - } + public void startViewer(String hostName,boolean cui) { + Viewer viewer = new Viewer(); + viewer.cuiVersion = cui; + MyRfbProtoClient rfb = new MyRfbProtoClient(); + CreateConnectionParam cp = new CreateConnectionParam(rfb); + cp.setHostName(hostName); + cp.createConnectionParam(viewer); + viewer.isTreeVNC = true; + rfb.setViewer(viewer); + viewer.myRfb = rfb; + SwingUtilities.invokeLater(viewer); + } + + + + public void setConnectionParam(String hostName, int port) { connectionParams.setHostName(hostName); connectionParams.setPortNumber(port); @@ -317,6 +331,10 @@ public MyRfbProto getRfb() { return myRfb; } + + public boolean getCuiVersion() { + return cuiVersion; + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerImpl.java Mon Jan 27 16:35:20 2014 +0900 @@ -0,0 +1,26 @@ +package com.glavsoft.viewer; + +import java.net.Socket; + +import jp.ac.u_ryukyu.treevnc.MyRfbProto; +import jp.ac.u_ryukyu.treevnc.server.MyRfbProtoProxy; + +public interface ViewerImpl { + + public boolean getCuiVersion(); + + public MyRfbProto getRfb(); + + public void closeApp(); + + public void setConnectionParam(String parentsAddress, int portNumber); + + public void setSocket(Socket soc); + + public void run(); + + public void setOpenPort(int parseInt); + + public void setTeminationType(boolean b); + +}
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/ClipboardControllerImpl.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/ClipboardControllerImpl.java Mon Jan 27 16:35:20 2014 +0900 @@ -49,11 +49,12 @@ private boolean isEnabled; private final ProtocolContext context; private Charset charset; - + public ClipboardControllerImpl(ProtocolContext context, String charsetName) { this.context = context; try { - clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + if(!"cui".equals(charsetName)) + clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); updateSavedClipboardContent(); // prevent onstart clipboard content sending } catch (AccessControlException e) { /*nop*/ }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingConnectionWorkerFactory.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingConnectionWorkerFactory.java Mon Jan 27 16:35:20 2014 +0900 @@ -60,7 +60,7 @@ @Override public RfbConnectionWorker createRfbConnectionWorker() { - return new SwingRfbConnectionWorker(predefinedPassword, presenter, parentWindow, viewerWindowFactory, myRfb); + return new SwingRfbConnectionWorker(predefinedPassword, presenter, parentWindow, viewerWindowFactory, myRfb); } @Override
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingNetworkConnectionWorker.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingNetworkConnectionWorker.java Mon Jan 27 16:35:20 2014 +0900 @@ -53,6 +53,7 @@ logger = Logger.getLogger(getClass().getName()); } + @Override public Socket doInBackground() throws Exception { String s = "<b>" +connectionParams.hostName + "</b>:" + connectionParams.getPortNumber();
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Mon Jan 27 16:35:20 2014 +0900 @@ -109,24 +109,31 @@ try { get(); presenter.showMessage("Handshake established"); - ClipboardControllerImpl clipboardController = - new ClipboardControllerImpl(workingProtocol, rfbSettings.getRemoteCharsetName()); + ClipboardControllerImpl clipboardController; + if(!myRfb.getCuiVersion()) + clipboardController = new ClipboardControllerImpl(workingProtocol, rfbSettings.getRemoteCharsetName()); + else + clipboardController = new ClipboardControllerImpl(workingProtocol, "cui"); clipboardController.setEnabled(rfbSettings.isAllowClipboardTransfer()); rfbSettings.addListener(clipboardController); - viewerWindow = viewerWindowFactory.createViewerWindow( - workingProtocol, rfbSettings, uiSettings, connectionString, presenter); + if(!myRfb.getCuiVersion()) + viewerWindow = viewerWindowFactory.createViewerWindow(workingProtocol, rfbSettings, uiSettings, connectionString, presenter); if(myRfb instanceof MyRfbProtoProxy) workingProtocol.startNormalHandling(this, viewerWindow.getSurface(), clipboardController, myRfb); else if(myRfb instanceof MyRfbProtoClient) { myRfb.setProtocolContext(workingProtocol); myRfb.notProxy(); - workingProtocol.startTreeClientHandling(this, viewerWindow.getSurface(), clipboardController,myRfb); + if(!myRfb.getCuiVersion()) + workingProtocol.startTreeClientHandling(this, viewerWindow.getSurface(), clipboardController,myRfb); + else + workingProtocol.startTreeClientHandling(this,clipboardController,myRfb); } else { workingProtocol.startNormalHandling(this, viewerWindow.getSurface(), clipboardController); } presenter.showMessage("Started"); - presenter.successfulRfbConnection(); + if(!myRfb.getCuiVersion()) + presenter.successfulRfbConnection(); } catch (CancellationException e) { logger.info("Cancelled"); presenter.showMessage("Cancelled");
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Mon Jan 27 16:35:20 2014 +0900 @@ -34,6 +34,7 @@ import com.glavsoft.viewer.ConnectionPresenter; import com.glavsoft.viewer.UiSettings; import com.glavsoft.viewer.Viewer; +import com.glavsoft.viewer.ViewerImpl; import com.glavsoft.viewer.swing.gui.OptionsDialog; import javax.swing.*; @@ -68,7 +69,7 @@ private Surface surface; private boolean isSeparateFrame; private final boolean isApplet; - private Viewer viewer; + private ViewerImpl viewer; private String connectionString; private ConnectionPresenter presenter; private Rectangle oldContainerBounds; @@ -85,7 +86,7 @@ private List<JComponent> kbdButtons; public SwingViewerWindow(Protocol workingProtocol, ProtocolSettings rfbSettings, UiSettings uiSettings, Surface surface, - boolean isSeparateFrame, boolean isApplet, Viewer viewer, String connectionString, + boolean isSeparateFrame, boolean isApplet, ViewerImpl viewer, String connectionString, ConnectionPresenter presenter) { this.workingProtocol = workingProtocol; this.rfbSettings = rfbSettings; @@ -96,10 +97,13 @@ this.viewer = viewer; this.connectionString = connectionString; this.presenter = presenter; - createContainer(surface, isApplet, viewer); + if(viewer instanceof Viewer) + createContainer(surface, isApplet, (Viewer)viewer); + if (uiSettings.showControls) { - createButtonsPanel(workingProtocol, isSeparateFrame? frame: viewer); + if(viewer instanceof Viewer) + createButtonsPanel(workingProtocol, isSeparateFrame? frame: (Viewer)viewer); if (isSeparateFrame) registerResizeListener(frame); updateZoomButtonsState(); } @@ -167,7 +171,7 @@ // frame.pack(); outerPanel.setSize(surface.getPreferredSize()); internalPack(null); - if(viewer.getRfb() instanceof MyRfbProtoProxy) + if(viewer.getRfb() instanceof MyRfbProtoProxy || viewer.getCuiVersion()) frame.setVisible(false); else frame.setVisible(true);
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindowFactory.java Sat Jan 25 21:19:52 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindowFactory.java Mon Jan 27 16:35:20 2014 +0900 @@ -5,6 +5,7 @@ import com.glavsoft.viewer.ConnectionPresenter; import com.glavsoft.viewer.UiSettings; import com.glavsoft.viewer.Viewer; +import com.glavsoft.viewer.ViewerImpl; /** * @author dime at tightvnc.com @@ -13,9 +14,9 @@ private final boolean isSeparateFrame; private final boolean isApplet; - private final Viewer viewer; + private final ViewerImpl viewer; - public SwingViewerWindowFactory(boolean isSeparateFrame, boolean isApplet, Viewer viewer) { + public SwingViewerWindowFactory(boolean isSeparateFrame, boolean isApplet, ViewerImpl viewer) { this.isSeparateFrame = isSeparateFrame; this.isApplet = isApplet; this.viewer = viewer;