diff options
author | Brian Hinz <bphinz@users.sourceforge.net> | 2013-03-06 18:14:54 +0000 |
---|---|---|
committer | Brian Hinz <bphinz@users.sourceforge.net> | 2013-03-06 18:14:54 +0000 |
commit | 8fb4efa3ff48f590a3dcabd547db3fcbad45b658 (patch) | |
tree | eacf121fd8981bf3d8deff39919d230a18a3537b /java/com/tigervnc/vncviewer/CConn.java | |
parent | 46395b7ff2f6ea7bf20da6d7199a6502b74546b3 (diff) | |
download | tigervnc-8fb4efa3ff48f590a3dcabd547db3fcbad45b658.tar.gz tigervnc-8fb4efa3ff48f590a3dcabd547db3fcbad45b658.zip |
Fixes some regressions introduced in r5056. Losing window focus caused key modifiers to be left in an incorrect state. Special handling of AltGr key was being applied in cases where CTRL_L+ALT_L keys were depressed which also caused the modifiers to be left in an incorrect state. Corrected mapping of CTRL+ALT+SHIFT hotkeys to match F8 menu.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5058 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/com/tigervnc/vncviewer/CConn.java')
-rw-r--r-- | java/com/tigervnc/vncviewer/CConn.java | 39 |
1 files changed, 9 insertions, 30 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; - } } |