diff options
author | Brian P. Hinz <bphinz@users.sf.net> | 2018-01-16 23:35:25 -0500 |
---|---|---|
committer | Brian P. Hinz <bphinz@users.sf.net> | 2018-01-16 23:37:00 -0500 |
commit | de4db7335399d11497ed77dcab550c361b8677d3 (patch) | |
tree | 7878c5ec61acf8f6403a975f07d09fcc85d3e078 /java | |
parent | b40235af946e6854e7fcf1f8f7a00c165e71008e (diff) | |
download | tigervnc-de4db7335399d11497ed77dcab550c361b8677d3.tar.gz tigervnc-de4db7335399d11497ed77dcab550c361b8677d3.zip |
Restore menukey function to java viewer
Menukey was broken by recent refactoring of OptionsDialog
Diffstat (limited to 'java')
-rw-r--r-- | java/com/tigervnc/vncviewer/MenuKey.java | 4 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/OptionsDialog.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/Viewport.java | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/java/com/tigervnc/vncviewer/MenuKey.java b/java/com/tigervnc/vncviewer/MenuKey.java index 3fd63456..5248b000 100644 --- a/java/com/tigervnc/vncviewer/MenuKey.java +++ b/java/com/tigervnc/vncviewer/MenuKey.java @@ -79,7 +79,7 @@ public class MenuKey if (VncViewer.os.startsWith("mac os x")) return sym.name.replace("_", " "); else - return KeyEvent.getKeyText(sym.keycode); + return KeyEvent.getKeyText(sym.javacode); } public static String getMenuKeyValueStr() { @@ -106,7 +106,7 @@ public class MenuKey } static int getMenuKeyCode() { - int menuKeyCode = VK_F8; + int menuKeyCode = 0x42; @SuppressWarnings({"static"}) String menuKeyStr = diff --git a/java/com/tigervnc/vncviewer/OptionsDialog.java b/java/com/tigervnc/vncviewer/OptionsDialog.java index 186c1fca..d02380cc 100644 --- a/java/com/tigervnc/vncviewer/OptionsDialog.java +++ b/java/com/tigervnc/vncviewer/OptionsDialog.java @@ -979,11 +979,9 @@ class OptionsDialog extends Dialog { sendClipboardCheckbox = new JCheckBox("Send clipboard to server"); JLabel menuKeyLabel = new JLabel("Menu key"); String[] menuKeys = new String[MenuKey.getMenuKeySymbolCount()]; - //String[] menuKeys = new String[MenuKey.getMenuKeySymbolCount()+1]; //menuKeys[0] = "None"; for (int i = 0; i < MenuKey.getMenuKeySymbolCount(); i++) menuKeys[i] = MenuKey.getKeyText(MenuKey.getMenuKeySymbols()[i]); - //menuKeys[i+1] = MenuKey.getKeyText(MenuKey.getMenuKeySymbols()[i]); menuKeyChoice = new JComboBox(menuKeys); inputPanel.add(viewOnlyCheckbox, diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index 6fff9b4f..1ce411c5 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -616,6 +616,12 @@ class Viewport extends JPanel implements ActionListener { this, ID.ALT, menuAltKey ? EnumSet.of(MENU.TOGGLE, MENU.VALUE) : EnumSet.of(MENU.TOGGLE)); + if (menuKeySym != 0) { + String sendMenuKey = String.format("Send %s", menuKey.getValueStr()); + menu_add(contextMenu, sendMenuKey, menuKeyJava, + this, ID.MENUKEY, EnumSet.noneOf(MENU.class)); + } + menu_add(contextMenu, "Send Ctrl-Alt-Del", KeyEvent.VK_D, this, ID.CTRLALTDEL, EnumSet.of(MENU.DIVIDER)); |