Browse Source

Override implicit focus transfer when "F10" key is pressed

Java L&F has pre-defined hook that transfers the focus to the
menu of the RootPane.  Since the viewer doesn't have a menu
this just causes a loss of focus and subsequent unexpected
behavior of keyboard and mouse.
tags/v1.8.90
Brian P. Hinz 6 years ago
parent
commit
2dc6529ecd
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      java/com/tigervnc/vncviewer/Viewport.java

+ 10
- 0
java/com/tigervnc/vncviewer/Viewport.java View File

@@ -102,6 +102,16 @@ class Viewport extends JPanel implements ActionListener {
releaseDownKeys();
}
});
Action action = new AbstractAction() {
public void actionPerformed(ActionEvent e) { }
};
KeyStroke f10 = KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0);
getInputMap(JComponent.WHEN_FOCUSED).put(f10, "requestFocus");
getActionMap().put("requestFocus", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
requestFocusInWindow();
}
});

setFocusTraversalKeysEnabled(false);
setFocusable(true);

Loading…
Cancel
Save