aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/com/tigervnc/vncviewer/CConn.java39
-rw-r--r--java/com/tigervnc/vncviewer/DesktopWindow.java13
-rw-r--r--java/com/tigervnc/vncviewer/Viewport.java3
3 files changed, 20 insertions, 35 deletions
diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java
index b8cbbfef..fe79ce19 100644
--- a/java/com/tigervnc/vncviewer/CConn.java
+++ b/java/com/tigervnc/vncviewer/CConn.java
@@ -1155,7 +1155,7 @@ public class CConn extends CConnection
}
public void writeKeyEvent(KeyEvent ev) {
- int keysym = 0, keycode, key, location, fakeModifiers = 0;
+ int keysym = 0, keycode, key, location = 0;
if (shuttingDown)
return;
@@ -1167,7 +1167,7 @@ public class CConn extends CConnection
location = ev.getKeyLocation();
vlog.debug((ev.isActionKey() ? "action " : "") + "key " +
- (down ? "PRESS" : "release") + " code " + keycode +
+ (down ? "press" : "release") + " code " + keycode +
" location " + location + " ASCII " + key);
if (!ev.isActionKey()) {
@@ -1210,6 +1210,9 @@ public class CConn extends CConnection
else
keysym = Keysyms.Clear; break;
case KeyEvent.VK_CONTROL:
+ // Suppress CTRL+ALT when AltGr is pressed
+ if (ev.isAltGraphDown())
+ return;
if (down)
modifiers |= Event.CTRL_MASK;
else
@@ -1219,6 +1222,9 @@ public class CConn extends CConnection
else
keysym = Keysyms.Control_L; break;
case KeyEvent.VK_ALT:
+ // Suppress CTRL+ALT when AltGr is pressed
+ if (ev.isAltGraphDown())
+ return;
if (down)
modifiers |= Event.ALT_MASK;
else
@@ -1246,13 +1252,7 @@ public class CConn extends CConnection
else
keysym = Keysyms.Meta_L; break;
default:
- if (ev.isControlDown() && ev.isAltDown()) {
- // Handle AltGr key on international keyboards
- if ((keycode >= 32 && keycode <= 126) ||
- (keycode >= 160 && keycode <= 255))
- key = keycode;
- fakeModifiers |= Event.ALT_MASK | Event.CTRL_MASK;
- } else if (ev.isControlDown()) {
+ if (ev.isControlDown()) {
// For CTRL-<letter>, CTRL is sent separately, so just send <letter>.
if ((key >= 1 && key <= 26 && !ev.isShiftDown()) ||
// CTRL-{, CTRL-|, CTRL-} also map to ASCII 96-127
@@ -1360,28 +1360,7 @@ public class CConn extends CConnection
}
}
- if (fakeModifiers != 0) {
- if ((fakeModifiers & Event.CTRL_MASK) != 0) {
- vlog.debug("Fake L Ctrl raised");
- writeKeyEvent(Keysyms.Control_L, false);
- }
- if ((modifiers & Event.ALT_MASK) != 0) {
- vlog.debug("Fake R Alt raised");
- writeKeyEvent(Keysyms.Alt_R, false);
- }
- }
writeKeyEvent(keysym, down);
- if (fakeModifiers != 0) {
- if ((fakeModifiers & Event.CTRL_MASK) != 0) {
- vlog.debug("Fake L Ctrl pressed");
- writeKeyEvent(Keysyms.Control_L, true);
- }
- if ((modifiers & Event.ALT_MASK) != 0) {
- vlog.debug("Fake R Alt pressed");
- writeKeyEvent(Keysyms.Alt_R, true);
- }
- fakeModifiers = 0;
- }
}
diff --git a/java/com/tigervnc/vncviewer/DesktopWindow.java b/java/com/tigervnc/vncviewer/DesktopWindow.java
index 42a1cc9d..5f9ee1a3 100644
--- a/java/com/tigervnc/vncviewer/DesktopWindow.java
+++ b/java/com/tigervnc/vncviewer/DesktopWindow.java
@@ -460,20 +460,23 @@ class DesktopWindow extends JPanel implements Runnable, MouseListener,
int ctrlAltShiftMask = Event.SHIFT_MASK | Event.CTRL_MASK | Event.ALT_MASK;
if ((e.getModifiers() & ctrlAltShiftMask) == ctrlAltShiftMask) {
switch (e.getKeyCode()) {
+ case KeyEvent.VK_A:
+ cc.showAbout();
+ return;
case KeyEvent.VK_F:
cc.toggleFullScreen();
return;
+ case KeyEvent.VK_H:
+ cc.refresh();
+ return;
case KeyEvent.VK_I:
cc.showInfo();
return;
- case KeyEvent.VK_N:
- VncViewer.newViewer(cc.viewer);
- return;
case KeyEvent.VK_O:
cc.options.showDialog(cc.viewport);
return;
- case KeyEvent.VK_R:
- cc.refresh();
+ case KeyEvent.VK_W:
+ VncViewer.newViewer(cc.viewer);
return;
case KeyEvent.VK_LEFT:
case KeyEvent.VK_RIGHT:
diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java
index 8f1b0e0e..465dee88 100644
--- a/java/com/tigervnc/vncviewer/Viewport.java
+++ b/java/com/tigervnc/vncviewer/Viewport.java
@@ -52,6 +52,9 @@ public class Viewport extends JFrame
if (isVisible())
sp.getViewport().getView().requestFocusInWindow();
}
+ public void windowLostFocus(WindowEvent e) {
+ cc.releaseModifiers();
+ }
});
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {