summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorBrian Hinz <bphinz@users.sourceforge.net>2013-02-09 02:42:14 +0000
committerBrian Hinz <bphinz@users.sourceforge.net>2013-02-09 02:42:14 +0000
commit1e252c68268825c340e80b6532af404659e32cbb (patch)
tree40cddefe464b27cac81c0a27cdec2bf411a646bf /java
parentddde1e22e1a125042bf0a49f7c3ae50b21b173cd (diff)
downloadtigervnc-1e252c68268825c340e80b6532af404659e32cbb.tar.gz
tigervnc-1e252c68268825c340e80b6532af404659e32cbb.zip
Sending menu key from F8 menu was sending the keycode instead of the keysym.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5040 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java')
-rw-r--r--java/com/tigervnc/vncviewer/F8Menu.java4
-rw-r--r--java/com/tigervnc/vncviewer/MenuKey.java60
2 files changed, 40 insertions, 24 deletions
diff --git a/java/com/tigervnc/vncviewer/F8Menu.java b/java/com/tigervnc/vncviewer/F8Menu.java
index ee7ae872..9ef0c389 100644
--- a/java/com/tigervnc/vncviewer/F8Menu.java
+++ b/java/com/tigervnc/vncviewer/F8Menu.java
@@ -103,8 +103,8 @@ public class F8Menu extends JPopupMenu implements ActionListener {
} else if (actionMatch(ev, clipboard)) {
cc.clipboardDialog.showDialog(cc.viewport);
} else if (actionMatch(ev, f8)) {
- cc.writeKeyEvent(cc.menuKeyCode, true);
- cc.writeKeyEvent(cc.menuKeyCode, false);
+ cc.writeKeyEvent(MenuKey.getMenuKeySym(), true);
+ cc.writeKeyEvent(MenuKey.getMenuKeySym(), false);
} else if (actionMatch(ev, ctrlAltDel)) {
cc.writeKeyEvent(Keysyms.Control_L, true);
cc.writeKeyEvent(Keysyms.Alt_L, true);
diff --git a/java/com/tigervnc/vncviewer/MenuKey.java b/java/com/tigervnc/vncviewer/MenuKey.java
index 49677087..5fdd037a 100644
--- a/java/com/tigervnc/vncviewer/MenuKey.java
+++ b/java/com/tigervnc/vncviewer/MenuKey.java
@@ -27,36 +27,39 @@ import com.tigervnc.rfb.*;
public class MenuKey
{
static class MenuKeySymbol {
- public MenuKeySymbol(String name_, int keycode_) {
+ public MenuKeySymbol(String name_, int keycode_, int keysym_) {
name = name_;
keycode = keycode_;
+ keysym = keysym_;
}
String name;
int keycode;
+ int keysym;
}
private static final MenuKeySymbol[] menuSymbols = {
- new MenuKeySymbol("F1", KeyEvent.VK_F1),
- new MenuKeySymbol("F2", KeyEvent.VK_F2),
- new MenuKeySymbol("F3", KeyEvent.VK_F3),
- new MenuKeySymbol("F4", KeyEvent.VK_F4),
- new MenuKeySymbol("F5", KeyEvent.VK_F5),
- new MenuKeySymbol("F6", KeyEvent.VK_F6),
- new MenuKeySymbol("F7", KeyEvent.VK_F7),
- new MenuKeySymbol("F8", KeyEvent.VK_F8),
- new MenuKeySymbol("F9", KeyEvent.VK_F9),
- new MenuKeySymbol("F10", KeyEvent.VK_F10),
- new MenuKeySymbol("F11", KeyEvent.VK_F11),
- new MenuKeySymbol("F12", KeyEvent.VK_F12),
- new MenuKeySymbol("Pause", KeyEvent.VK_PAUSE),
- new MenuKeySymbol("Print", KeyEvent.VK_PRINTSCREEN),
- new MenuKeySymbol("Scroll_Lock", KeyEvent.VK_SCROLL_LOCK),
- new MenuKeySymbol("Escape", KeyEvent.VK_ESCAPE),
- new MenuKeySymbol("Insert", KeyEvent.VK_INSERT),
- new MenuKeySymbol("Delete", KeyEvent.VK_DELETE),
- new MenuKeySymbol("Home", KeyEvent.VK_HOME),
- new MenuKeySymbol("Page_Up", KeyEvent.VK_PAGE_UP),
- new MenuKeySymbol("Page_Down", KeyEvent.VK_PAGE_DOWN)
+ new MenuKeySymbol("F1", KeyEvent.VK_F1, Keysyms.F1),
+ new MenuKeySymbol("F2", KeyEvent.VK_F2, Keysyms.F2),
+ new MenuKeySymbol("F3", KeyEvent.VK_F3, Keysyms.F3),
+ new MenuKeySymbol("F4", KeyEvent.VK_F4, Keysyms.F4),
+ new MenuKeySymbol("F5", KeyEvent.VK_F5, Keysyms.F5),
+ new MenuKeySymbol("F6", KeyEvent.VK_F6, Keysyms.F6),
+ new MenuKeySymbol("F7", KeyEvent.VK_F7, Keysyms.F7),
+ new MenuKeySymbol("F8", KeyEvent.VK_F8, Keysyms.F8),
+ new MenuKeySymbol("F9", KeyEvent.VK_F9, Keysyms.F9),
+ new MenuKeySymbol("F10", KeyEvent.VK_F10, Keysyms.F10),
+ new MenuKeySymbol("F11", KeyEvent.VK_F11, Keysyms.F11),
+ new MenuKeySymbol("F12", KeyEvent.VK_F12, Keysyms.F12),
+ new MenuKeySymbol("Pause", KeyEvent.VK_PAUSE, Keysyms.Pause),
+ new MenuKeySymbol("Print", KeyEvent.VK_PRINTSCREEN, Keysyms.Print),
+ new MenuKeySymbol("Scroll_Lock", KeyEvent.VK_SCROLL_LOCK,
+ Keysyms.Scroll_Lock),
+ new MenuKeySymbol("Escape", KeyEvent.VK_ESCAPE, Keysyms.Escape),
+ new MenuKeySymbol("Insert", KeyEvent.VK_INSERT, Keysyms.Insert),
+ new MenuKeySymbol("Delete", KeyEvent.VK_DELETE, Keysyms.Delete),
+ new MenuKeySymbol("Home", KeyEvent.VK_HOME, Keysyms.Home),
+ new MenuKeySymbol("Page_Up", KeyEvent.VK_PAGE_UP, Keysyms.Page_Up),
+ new MenuKeySymbol("Page_Down", KeyEvent.VK_PAGE_DOWN, Keysyms.Page_Down)
};
static int getMenuKeySymbolCount() {
@@ -90,4 +93,17 @@ public class MenuKey
return menuKeyCode;
}
+ static int getMenuKeySym() {
+ int menuKeySym = Keysyms.F8;
+
+ @SuppressWarnings({"static"})
+ String menuKeyStr =
+ Configuration.global().getParam("menuKey").getValueStr();
+ for(int i = 0; i < getMenuKeySymbolCount(); i++)
+ if (menuSymbols[i].name.equals(menuKeyStr))
+ menuKeySym = menuSymbols[i].keysym;
+
+ return menuKeySym;
+ }
+
}