diff --git a/guacamole-common-js/src/main/webapp/modules/Keyboard.js b/guacamole-common-js/src/main/webapp/modules/Keyboard.js index f71ca8af3..aff3f01ce 100644 --- a/guacamole-common-js/src/main/webapp/modules/Keyboard.js +++ b/guacamole-common-js/src/main/webapp/modules/Keyboard.js @@ -182,14 +182,16 @@ Guacamole.Keyboard = function(element) { if (this.keysym) this.reliable = true; - // We must use the (potentially buggy) keyIdentifier immediately if - // keypress will likely not fire, as we need to make a best effort - // to prevent default if requested - if (guac_keyboard.modifiers.ctrl - || guac_keyboard.modifiers.alt + // Use legacy keyIdentifier as a last resort + this.keysym = this.keysym || keysym_from_key_identifier(keyIdentifier, location, guac_keyboard.modifiers.shift); + + // We must rely on the (potentially buggy) keyIdentifier if preventing + // the default action is important + if ((guac_keyboard.modifiers.ctrl && !guac_keyboard.modifiers.alt) + || (guac_keyboard.modifiers.alt && !guac_keyboard.modifiers.ctrl) || guac_keyboard.modifiers.meta || guac_keyboard.modifiers.hyper) - this.keysym = this.keysym || keysym_from_key_identifier(keyIdentifier, location, guac_keyboard.modifiers.shift); + this.reliable = true; // Record most recently known keysym by associated key code recentKeysym[keyCode] = this.keysym; @@ -802,6 +804,33 @@ Guacamole.Keyboard = function(element) { } + /** + * Searches the event log for a keyup event having a given keysym, + * returning its index within the log. + * + * @param {Number} keysym The keysym of the keyup event to search for. + * @returns {Number} The index of the first keyup event in the event log + * having the given keysym, or -1 if no such event exists. + */ + function indexof_keyup(keysym) { + + var i; + + // Search event log for keyup events having the given keysym + for (i=0; i 100) { console.log("Warning: Key press was dropped as ambiguous.", first);