diff options
author | Brian P. Hinz <bphinz@users.sf.net> | 2019-11-21 22:35:40 -0500 |
---|---|---|
committer | Brian P. Hinz <bphinz@users.sf.net> | 2019-11-21 22:37:22 -0500 |
commit | 23c646bd8b4b1945a727f1728b31bedfd1247b87 (patch) | |
tree | be82aabb903640c73f924f909c07389989e6753f /java/com | |
parent | b408d0a2dbc9a76937c76e783ffb08d8e5f1ada9 (diff) | |
download | tigervnc-23c646bd8b4b1945a727f1728b31bedfd1247b87.tar.gz tigervnc-23c646bd8b4b1945a727f1728b31bedfd1247b87.zip |
Remove old Java applet support
Diffstat (limited to 'java/com')
-rw-r--r-- | java/com/tigervnc/vncviewer/CConn.java | 7 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/DesktopWindow.java | 20 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/OptionsDialog.java | 26 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/Parameters.java | 51 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/Viewport.java | 7 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/VncViewer.java | 150 |
6 files changed, 17 insertions, 244 deletions
diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java index 08a82b32..11b6da44 100644 --- a/java/com/tigervnc/vncviewer/CConn.java +++ b/java/com/tigervnc/vncviewer/CConn.java @@ -482,7 +482,6 @@ public class CConn extends CConnection implements // close() shuts down the socket, thus waking up the RFB thread. public void close() { if (closeListener != null) { - embed.setParam(true); JFrame f = (JFrame)SwingUtilities.getAncestorOfClass(JFrame.class, desktop); if (f != null) @@ -504,12 +503,6 @@ public class CConn extends CConnection implements writer().writeClientCutText(str, len); } - // this is a special ActionListener passed in by the - // Java Plug-in software to control applet's close behavior - public void setCloseListener(ActionListener cl) { - closeListener = cl; - } - public void actionPerformed(ActionEvent e) {} public Socket getSocket() { diff --git a/java/com/tigervnc/vncviewer/DesktopWindow.java b/java/com/tigervnc/vncviewer/DesktopWindow.java index 416031f2..1f4bb4f8 100644 --- a/java/com/tigervnc/vncviewer/DesktopWindow.java +++ b/java/com/tigervnc/vncviewer/DesktopWindow.java @@ -1,5 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright (C) 2011-2016 Brian P. Hinz + * Copyright (C) 2011-2019 Brian P. Hinz * Copyright (C) 2012-2013 D. R. Commander. All Rights Reserved. * * This is free software; you can redistribute it and/or modify @@ -219,19 +219,13 @@ public class DesktopWindow extends JFrame { if (firstUpdate) { pack(); - if (embed.getValue()) { - scroll.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED); - scroll.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_AS_NEEDED); - VncViewer.setupEmbeddedFrame(scroll); - } else { - if (fullScreen.getValue()) - fullscreen_on(); - else - setVisible(true); + if (fullScreen.getValue()) + fullscreen_on(); + else + setVisible(true); - if (maximize.getValue()) - setExtendedState(JFrame.MAXIMIZED_BOTH); - } + if (maximize.getValue()) + setExtendedState(JFrame.MAXIMIZED_BOTH); if (cc.server.supportsSetDesktopSize && !desktopSize.getValue().equals("")) { // Hack: Wait until we're in the proper mode and position until diff --git a/java/com/tigervnc/vncviewer/OptionsDialog.java b/java/com/tigervnc/vncviewer/OptionsDialog.java index f0d4cb00..9893fa1a 100644 --- a/java/com/tigervnc/vncviewer/OptionsDialog.java +++ b/java/com/tigervnc/vncviewer/OptionsDialog.java @@ -1,5 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright (C) 2011-2016 Brian P. Hinz + * Copyright (C) 2011-2019 Brian P. Hinz * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -260,15 +260,6 @@ class OptionsDialog extends Dialog { this.dispose(); } - public void setEmbeddedFeatures(boolean s) { - fullScreenCheckbox.setEnabled(s); - fullScreenAllMonitorsCheckbox.setEnabled(s); - scalingFactorInput.setEnabled(s); - Enumeration<AbstractButton> e = sizingGroup.getElements(); - while (e.hasMoreElements()) - e.nextElement().setEnabled(s); - } - private void loadOptions() { /* Compression */ @@ -489,7 +480,6 @@ class OptionsDialog extends Dialog { handleTunnel(); handleVia(); handleExtSSH(); - handleEmbed(); handleRfbState(); } @@ -1589,20 +1579,6 @@ class OptionsDialog extends Dialog { } } - private void handleEmbed() - { - if (embed.getValue()) { - desktopSizeCheckbox.setEnabled(false); - desktopWidthInput.setEnabled(false); - desktopHeightInput.setEnabled(false); - remoteResizeButton.setEnabled(false); - remoteScaleButton.setEnabled(false); - fullScreenCheckbox.setEnabled(false); - fullScreenAllMonitorsCheckbox.setEnabled(false); - scalingFactorInput.setEnabled(false); - } - } - private void handleRfbState() { CConn cc = VncViewer.cc; diff --git a/java/com/tigervnc/vncviewer/Parameters.java b/java/com/tigervnc/vncviewer/Parameters.java index aa4be90a..1a5a5ce5 100644 --- a/java/com/tigervnc/vncviewer/Parameters.java +++ b/java/com/tigervnc/vncviewer/Parameters.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 Brian P. Hinz +/* Copyright (C) 2016-2019 Brian P. Hinz * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,13 +38,6 @@ public class Parameters { "Lion or later.", false); - public static BoolParameter embed - = new BoolParameter("Embed", - "If the viewer is being run as an applet, display its output to " + - "an embedded frame in the browser window rather than to a dedicated " + - "window. Embed=1 implies FullScreen=0 and Scale=100.", - false); - public static BoolParameter dotWhenNoCursor = new BoolParameter("DotWhenNoCursor", "Show the dot cursor when the server sends an invisible cursor", @@ -580,48 +573,6 @@ public class Parameters { return servername; } - public static String loadAppletParameters(VncViewer applet) { - String servername = applet.getParameter("Server"); - String serverport = applet.getParameter("Port"); - String embedParam = applet.getParameter("Embed"); - - if (servername == null) - servername = applet.getCodeBase().getHost(); - - if (serverport != null) - servername = servername.concat("::"+serverport); - else - servername = servername.concat("::5900"); - - if (embedParam != null) - embed.setParam(embedParam); - - for (int i = 0; i < parameterArray.length; i++) { - String value = applet.getParameter(parameterArray[i].getName()); - if (value == null) - continue; - if (parameterArray[i] instanceof StringParameter) { - if (value.length() > 256) { - vlog.error(String.format("Failed to read applet parameter %s: %s", - parameterArray[i].getName(), - "Invalid format or too large value")); - continue; - } - ((StringParameter)parameterArray[i]).setParam(value); - } else if (parameterArray[i] instanceof IntParameter) { - ((IntParameter)parameterArray[i]).setParam(value); - } else if (parameterArray[i] instanceof BoolParameter) { - ((BoolParameter)parameterArray[i]).setParam(value); - } else { - vlog.error(String.format("Unknown parameter type for parameter %s", - parameterArray[i].getName())); - - } - } - - return servername; - } - private static void updateConnHistory(String serverName) { String hKey = "ServerDialog"; if (serverName != null && !serverName.isEmpty()) { diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index 1f21beef..c9d98d59 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -2,7 +2,7 @@ * Copyright (C) 2006 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 2009 Paul Donohue. All Rights Reserved. * Copyright (C) 2010, 2012-2013 D. R. Commander. All Rights Reserved. - * Copyright (C) 2011-2017 Brian P. Hinz + * Copyright (C) 2011-2019 Brian P. Hinz * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -240,8 +240,6 @@ class Viewport extends JPanel implements ActionListener { case MouseEvent.MOUSE_ENTERED: if (cursor != null) setCursor(cursor, cursorHotspot.x, cursorHotspot.y); - if (embed.getValue()) - requestFocus(); return 1; case MouseEvent.MOUSE_EXITED: setCursor(java.awt.Cursor.getDefaultCursor()); @@ -629,8 +627,7 @@ class Viewport extends JPanel implements ActionListener { this, ID.REFRESH, EnumSet.of(MENU.DIVIDER)); menu_add(contextMenu, "New connection...", KeyEvent.VK_N, - this, ID.NEWVIEWER, - embed.getValue() ? EnumSet.of(MENU.INACTIVE, MENU.DIVIDER) : EnumSet.of(MENU.DIVIDER)); + this, ID.NEWVIEWER, EnumSet.of(MENU.DIVIDER)); menu_add(contextMenu, "Options...", KeyEvent.VK_O, this, ID.OPTIONS, EnumSet.noneOf(MENU.class)); diff --git a/java/com/tigervnc/vncviewer/VncViewer.java b/java/com/tigervnc/vncviewer/VncViewer.java index 7bda301a..ae358c04 100644 --- a/java/com/tigervnc/vncviewer/VncViewer.java +++ b/java/com/tigervnc/vncviewer/VncViewer.java @@ -1,7 +1,7 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright (C) 2011-2013 D. R. Commander. All Rights Reserved. - * Copyright (C) 2011-2016 Brian P. Hinz + * Copyright (C) 2011-2019 Brian P. Hinz * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,13 +20,12 @@ */ // -// VncViewer - the VNC viewer applet. It can also be run from the -// command-line, when it behaves as much as possibly like the windows and unix +// VncViewer - the VNC viewer. It behaves as much as possible like the native // viewers. // // Unfortunately, because of the way Java classes are loaded on demand, only // configuration parameters defined in this file can be set from the command -// line or in applet parameters. +// line. package com.tigervnc.vncviewer; @@ -59,8 +58,7 @@ import com.tigervnc.network.*; import static com.tigervnc.vncviewer.Parameters.*; -public class VncViewer extends javax.swing.JApplet - implements Runnable, ActionListener { +public class VncViewer implements Runnable { public static final String aboutText = new String("TigerVNC Java Viewer v%s (%s)%n"+ @@ -82,7 +80,6 @@ public class VncViewer extends javax.swing.JApplet VncViewer.class.getResourceAsStream("timestamp"); public static final String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); - private static VncViewer applet; private String defaultServerName; int VNCSERVERNAMELEN = 256; @@ -147,11 +144,6 @@ public class VncViewer extends javax.swing.JApplet viewer.start(); } - public VncViewer() { - // Only called in applet mode - this(new String[0]); - } - public VncViewer(String[] argv) { SecurityClient.setDefaults(); @@ -324,105 +316,6 @@ public class VncViewer extends javax.swing.JApplet } } - public boolean isAppletDragStart(MouseEvent e) { - if(e.getID() == MouseEvent.MOUSE_DRAGGED) { - // Drag undocking on Mac works, but introduces a host of - // problems so disable it for now. - if (os.startsWith("mac os x")) - return false; - else if (os.startsWith("windows")) - return (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0; - else - return (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) != 0; - } else { - return false; - } - } - - public void appletDragStarted() { - embed.setParam(false); - //cc.recreateViewport(); - JFrame f = (JFrame)JOptionPane.getFrameForComponent(this); - // The default JFrame created by the drag event will be - // visible briefly between appletDragStarted and Finished. - if (f != null) - f.setSize(0, 0); - } - - public void appletDragFinished() { - JFrame f = (JFrame)JOptionPane.getFrameForComponent(this); - if (f != null) - f.dispose(); - } - - public void setAppletCloseListener(ActionListener cl) { - cc.setCloseListener(cl); - } - - public void appletRestored() { - cc.setCloseListener(null); - } - - public static void setupEmbeddedFrame(JScrollPane sp) { - InputMap im = sp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); - int ctrlAltShiftMask = Event.SHIFT_MASK | Event.CTRL_MASK | Event.ALT_MASK; - if (im != null) { - im.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, ctrlAltShiftMask), - "unitScrollUp"); - im.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, ctrlAltShiftMask), - "unitScrollDown"); - im.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ctrlAltShiftMask), - "unitScrollLeft"); - im.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, ctrlAltShiftMask), - "unitScrollRight"); - im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, ctrlAltShiftMask), - "scrollUp"); - im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, ctrlAltShiftMask), - "scrollDown"); - im.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, ctrlAltShiftMask), - "scrollLeft"); - im.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, ctrlAltShiftMask), - "scrollRight"); - } - applet.getContentPane().removeAll(); - applet.getContentPane().add(sp); - applet.validate(); - } - - public void init() { - // Called right after zero-arg constructor in applet mode - setLookAndFeel(); - setBackground(Color.white); - applet = this; - vncServerName.put(loadAppletParameters(applet).toCharArray()).flip(); - if (embed.getValue()) { - fullScreen.setParam(false); - remoteResize.setParam(false); - maximize.setParam(false); - scalingFactor.setParam("100"); - } - setFocusTraversalKeysEnabled(false); - addFocusListener(new FocusAdapter() { - public void focusGained(FocusEvent e) { - if (cc != null && cc.desktop != null) - cc.desktop.viewport.requestFocusInWindow(); - } - }); - Frame frame = (Frame)getFocusCycleRootAncestor(); - frame.setFocusTraversalKeysEnabled(false); - frame.addWindowListener(new WindowAdapter() { - // Transfer focus to scrollpane when browser receives it - public void windowActivated(WindowEvent e) { - if (cc != null && cc.desktop != null) - cc.desktop.viewport.requestFocusInWindow(); - } - public void windowDeactivated(WindowEvent e) { - if (cc != null) - cc.desktop.viewport.releaseDownKeys(); - } - }); - } - private static void getTimestamp() { if (version == null || build == null) { try { @@ -469,16 +362,7 @@ public class VncViewer extends javax.swing.JApplet } public void exit(int n) { - if (embed.getValue()) - destroy(); - else - System.exit(n); - } - - // If "Reconnect" button is pressed - public void actionPerformed(ActionEvent e) { - getContentPane().removeAll(); - start(); + System.exit(n); } void reportException(java.lang.Exception e) { @@ -486,26 +370,7 @@ public class VncViewer extends javax.swing.JApplet int msgType = JOptionPane.ERROR_MESSAGE; title = "TigerVNC Viewer : Error"; e.printStackTrace(); - if (embed.getValue()) { - getContentPane().removeAll(); - JLabel label = new JLabel("<html><center><b>" + title + "</b><p><i>" + - msg + "</i></center></html>", JLabel.CENTER); - label.setFont(new Font("Helvetica", Font.PLAIN, 24)); - label.setMaximumSize(new Dimension(getSize().width, 100)); - label.setVerticalAlignment(JLabel.CENTER); - label.setAlignmentX(Component.CENTER_ALIGNMENT); - JButton button = new JButton("Reconnect"); - button.addActionListener(this); - button.setMaximumSize(new Dimension(200, 30)); - button.setAlignmentX(Component.CENTER_ALIGNMENT); - setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); - add(label); - add(button); - validate(); - repaint(); - } else { - JOptionPane.showMessageDialog(null, msg, title, msgType); - } + JOptionPane.showMessageDialog(null, msg, title, msgType); } public void run() { @@ -569,9 +434,6 @@ public class VncViewer extends javax.swing.JApplet reportException(e); if (cc != null) cc.close(); - } else if (embed.getValue()) { - reportException(new java.lang.Exception("Connection closed")); - exit(0); } exit(1); } |