From d8809e334fb8095c4ba5520b0151e02bb0527b59 Mon Sep 17 00:00:00 2001 From: "Brian P. Hinz" Date: Wed, 15 Nov 2017 18:50:15 -0500 Subject: [PATCH] Override default window manager key bindings better --- java/com/tigervnc/vncviewer/Viewport.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index a588f0f4..6fff9b4f 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -102,16 +102,15 @@ class Viewport extends JPanel implements ActionListener { releaseDownKeys(); } }); - Action action = new AbstractAction() { + // Override default key bindings from L&F + getActionMap().put("null", 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(); - } }); + ArrayList keys = new ArrayList(); + keys.add(KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0, true)); + keys.add(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true)); + for (int i=0; i