diff options
-rw-r--r-- | java/com/tigervnc/vncviewer/CConn.java | 27 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/DesktopWindow.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/Viewport.java | 2 |
3 files changed, 7 insertions, 24 deletions
diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java index e48e93b2..b876751c 100644 --- a/java/com/tigervnc/vncviewer/CConn.java +++ b/java/com/tigervnc/vncviewer/CConn.java @@ -310,7 +310,7 @@ public class CConn extends CConnection implements desktop.requestFocus(); } public void focusLost(FocusEvent e) { - releaseModifiers(); + releaseDownKeys(); } }); viewer.validate(); @@ -1367,27 +1367,10 @@ public class CConn extends CConnection implements } - synchronized void releaseModifiers() { - if (downKeySym.containsValue(Keysyms.Shift_L)) - writeKeyEvent(Keysyms.Shift_L, true); - if (downKeySym.containsValue(Keysyms.Shift_R)) - writeKeyEvent(Keysyms.Shift_R, true); - if (downKeySym.containsValue(Keysyms.Control_L)) - writeKeyEvent(Keysyms.Control_L, true); - if (downKeySym.containsValue(Keysyms.Control_R)) - writeKeyEvent(Keysyms.Control_R, true); - if (downKeySym.containsValue(Keysyms.Alt_L)) - writeKeyEvent(Keysyms.Alt_L, true); - if (downKeySym.containsValue(Keysyms.Alt_R)) - writeKeyEvent(Keysyms.Alt_R, true); - if (downKeySym.containsValue(Keysyms.Meta_L)) - writeKeyEvent(Keysyms.Meta_L, true); - if (downKeySym.containsValue(Keysyms.Meta_R)) - writeKeyEvent(Keysyms.Meta_R, true); - if (downKeySym.containsValue(Keysyms.Super_L)) - writeKeyEvent(Keysyms.Super_L, true); - if (downKeySym.containsValue(Keysyms.Super_R)) - writeKeyEvent(Keysyms.Super_R, true); + synchronized void releaseDownKeys() { + for (Map.Entry<Integer, Integer> entry : downKeySym.entrySet()) + writeKeyEvent(entry.getValue(), false); + downKeySym.clear(); } // this is a special ActionListener passed in by the diff --git a/java/com/tigervnc/vncviewer/DesktopWindow.java b/java/com/tigervnc/vncviewer/DesktopWindow.java index 4749eb2a..4175746f 100644 --- a/java/com/tigervnc/vncviewer/DesktopWindow.java +++ b/java/com/tigervnc/vncviewer/DesktopWindow.java @@ -86,7 +86,7 @@ class DesktopWindow extends JPanel implements Runnable, MouseListener, checkClipboard(); } public void focusLost(FocusEvent e) { - cc.releaseModifiers(); + cc.releaseDownKeys(); } }); setFocusTraversalKeysEnabled(false); diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index 19c51c94..a6ce3554 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -58,7 +58,7 @@ public class Viewport extends JFrame sp.getViewport().getView().requestFocusInWindow(); } public void windowLostFocus(WindowEvent e) { - cc.releaseModifiers(); + cc.releaseDownKeys(); } }); addWindowListener(new WindowAdapter() { |