aboutsummaryrefslogtreecommitdiffstats
path: root/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'java/com')
-rw-r--r--java/com/tigervnc/vncviewer/KeyMap.java7
-rw-r--r--java/com/tigervnc/vncviewer/PasswdDialog.java4
-rw-r--r--java/com/tigervnc/vncviewer/ServerDialog.java2
-rw-r--r--java/com/tigervnc/vncviewer/Viewport.java10
4 files changed, 14 insertions, 9 deletions
diff --git a/java/com/tigervnc/vncviewer/KeyMap.java b/java/com/tigervnc/vncviewer/KeyMap.java
index bce9a53a..62481957 100644
--- a/java/com/tigervnc/vncviewer/KeyMap.java
+++ b/java/com/tigervnc/vncviewer/KeyMap.java
@@ -161,7 +161,7 @@ public class KeyMap {
public static int vkey_to_keysym(KeyEvent ev)
{
- int keyCode = ev.getExtendedKeyCode();
+ int keyCode = get_keycode_fallback_extended(ev);
// Start with keys that either don't generate a symbol, or
// generate the same symbol as some other key.
@@ -217,6 +217,11 @@ public class KeyMap {
return NoSymbol;
}
+ public static int get_keycode_fallback_extended(final KeyEvent ev) {
+ final int keyCode = ev.getKeyCode();
+ return (keyCode == 0) ? ev.getExtendedKeyCode() : keyCode;
+ }
+
private static int vk_to_ascii(int vk, boolean shift) {
char c = 0;
if (code_map_java_to_char.containsKey(vk))
diff --git a/java/com/tigervnc/vncviewer/PasswdDialog.java b/java/com/tigervnc/vncviewer/PasswdDialog.java
index 4ff3f789..db0acd0c 100644
--- a/java/com/tigervnc/vncviewer/PasswdDialog.java
+++ b/java/com/tigervnc/vncviewer/PasswdDialog.java
@@ -96,12 +96,12 @@ class PasswdDialog extends Dialog implements UserInfo,
public void keyPressed(KeyEvent event) {
Object s = event.getSource();
if (s instanceof JTextField && (JTextField)s == userEntry) {
- if (event.getExtendedKeyCode() == KeyEvent.VK_ENTER) {
+ if (KeyMap.get_keycode_fallback_extended(event) == KeyEvent.VK_ENTER) {
endDialog();
}
} else if (s instanceof JPasswordField
&& (JPasswordField)s == passwdEntry) {
- if (event.getExtendedKeyCode() == KeyEvent.VK_ENTER) {
+ if (KeyMap.get_keycode_fallback_extended(event) == KeyEvent.VK_ENTER) {
endDialog();
}
}
diff --git a/java/com/tigervnc/vncviewer/ServerDialog.java b/java/com/tigervnc/vncviewer/ServerDialog.java
index ab7157d2..aeee0b21 100644
--- a/java/com/tigervnc/vncviewer/ServerDialog.java
+++ b/java/com/tigervnc/vncviewer/ServerDialog.java
@@ -87,7 +87,7 @@ class ServerDialog extends Dialog implements Runnable {
public void keyTyped(KeyEvent e) {}
public void keyReleased(KeyEvent e) {}
public void keyPressed(KeyEvent e) {
- if (e.getExtendedKeyCode() == KeyEvent.VK_ENTER) {
+ if (KeyMap.get_keycode_fallback_extended(e) == KeyEvent.VK_ENTER) {
serverName.insertItemAt(editor.getItem(), 0);
serverName.setSelectedIndex(0);
handleConnect();
diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java
index f158bdbd..16ba7d72 100644
--- a/java/com/tigervnc/vncviewer/Viewport.java
+++ b/java/com/tigervnc/vncviewer/Viewport.java
@@ -507,7 +507,7 @@ class Viewport extends JPanel implements ActionListener {
if (event instanceof KeyEvent) {
KeyEvent ev = (KeyEvent)event;
- if (ev.getExtendedKeyCode() == 0) {
+ if (KeyMap.get_keycode_fallback_extended(ev) == 0) {
// Not much we can do with this...
vlog.debug("Ignoring KeyEvent with unknown Java keycode");
return 0;
@@ -518,7 +518,7 @@ class Viewport extends JPanel implements ActionListener {
// out the proper one. Java virtual key codes aren't unique
// between left/right versions of keys, so we can't use them as
// indexes to the downKeySym map.
- long keyCode = ev.getExtendedKeyCode() | ((long)ev.getKeyLocation()<<32);
+ long keyCode = KeyMap.get_keycode_fallback_extended(ev) | ((long)ev.getKeyLocation()<<32);
// Pressing Ctrl wreaks havoc with the symbol lookup, so turn
// that off. But AltGr shows up as Ctrl_L+Alt_R in Windows, so
@@ -532,9 +532,9 @@ class Viewport extends JPanel implements ActionListener {
mask &= ~ALT_MASK;
mask |= ALT_GRAPH_MASK;
AWTKeyStroke ks =
- AWTKeyStroke.getAWTKeyStroke(ev.getExtendedKeyCode(), mask);
+ AWTKeyStroke.getAWTKeyStroke(KeyMap.get_keycode_fallback_extended(ev), mask);
ev = new KeyEvent((JComponent)ev.getSource(), ev.getID(),
- ev.getWhen(), mask, ev.getExtendedKeyCode(),
+ ev.getWhen(), mask, KeyMap.get_keycode_fallback_extended(ev),
ks.getKeyChar(), ev.getKeyLocation());
}
}
@@ -574,7 +574,7 @@ class Viewport extends JPanel implements ActionListener {
return 1;
} else if (ev.getID() == KeyEvent.KEY_RELEASED) {
- long keyCode = ev.getExtendedKeyCode() | ((long)ev.getKeyLocation()<<32);
+ long keyCode = KeyMap.get_keycode_fallback_extended(ev) | ((long)ev.getKeyLocation()<<32);
handleKeyRelease(keyCode);
return 1;
}