]> source.dussan.org Git - tigervnc.git/commitdiff
Fix names of menu keys in options dialog on OS X 279/head
authorBrian P. Hinz <bphinz@users.sf.net>
Fri, 18 Mar 2016 02:46:15 +0000 (22:46 -0400)
committerBrian P. Hinz <bphinz@users.sf.net>
Fri, 18 Mar 2016 02:46:15 +0000 (22:46 -0400)
Apple changed the implementation of KeyEvent.getKeyText() to
return the unicode for the key glyph instead of a textual
description.

java/com/tigervnc/vncviewer/MenuKey.java
java/com/tigervnc/vncviewer/OptionsDialog.java

index 63b6380242cfbf9f2a037f681d54701adf1a3016..071c00405699e45cca93921fa102463735fb2017 100644 (file)
@@ -70,6 +70,13 @@ public class MenuKey
     return menuSymbols;
   }
 
+  public static String getKeyText(MenuKeySymbol sym) {
+    if (VncViewer.os.startsWith("mac os x"))
+      return sym.name.replace("_", " ");
+    else
+      return KeyEvent.getKeyText(sym.keycode);
+  }
+
   public static String getMenuKeyValueStr() {
     String s = "";
     for (int i = 0; i < getMenuKeySymbolCount(); i++) {
index 3bd74e277626f0d04994acc9b3c77ea0808c9923..1681518ddad536e99a5d5c198dffd97746e78a8b 100644 (file)
@@ -412,7 +412,7 @@ class OptionsDialog extends Dialog {
     JLabel menuKeyLabel = new JLabel("Menu Key");
     String[] menuKeys = new String[MenuKey.getMenuKeySymbolCount()];
     for (int i = 0; i < MenuKey.getMenuKeySymbolCount(); i++)
-      menuKeys[i] = KeyEvent.getKeyText(MenuKey.getMenuKeySymbols()[i].keycode);
+      menuKeys[i] = MenuKey.getKeyText(MenuKey.getMenuKeySymbols()[i]);
     menuKey  = new JComboBox(menuKeys);
 
     inputPanel.add(viewOnly,