As keydown/keypress are handled via deferred setTimeout(), so should keyup (otherwise, there's a race condition that keyup might happen before the deferred handling of keydown/keypress, and the key might be effectively stuck down or in a repeating state).

This commit is contained in:
Michael Jumper
2012-05-16 13:36:28 -07:00
parent aa7c38be32
commit a650a4a6ec

View File

@@ -511,6 +511,10 @@ Guacamole.Keyboard = function(element) {
if (window.event) keynum = window.event.keyCode;
else if (e.which) keynum = e.which;
// Defer handling of keyup (otherwise, keyup may happen before
// deferred handling of keydown/keypress).
window.setTimeout(function() {
// Ctrl/Alt/Shift
if (keynum == 16) guac_keyboard.modifiers.shift = false;
else if (keynum == 17) guac_keyboard.modifiers.ctrl = false;
@@ -527,6 +531,8 @@ Guacamole.Keyboard = function(element) {
// Send release event
sendKeyReleased(lastKeyDownChar);
}, 0);
};
// When focus is lost, clear modifiers.