GUAC-391: Add *gag* detection of OS *gag* because there's no other way *gag* to know if it's safe to wait for keypress while Alt is held when keydown is not accurate enough *vomits*.

This commit is contained in:
Michael Jumper
2014-09-29 02:03:32 -07:00
parent 1d42823f82
commit b6769e4ba0

View File

@@ -186,10 +186,17 @@ Guacamole.Keyboard = function(element) {
if (!this.keysym && key_identifier_sane(keyCode, keyIdentifier))
this.keysym = keysym_from_key_identifier(keyIdentifier, location, guac_keyboard.modifiers.shift);
// Determine whether default action for Alt+combinations must be prevented
var prevent_alt = !guac_keyboard.modifiers.ctrl
&& !(navigator && navigator.platform && navigator.platform.match(/^mac/i));
// Determine whether default action for Ctrl+combinations must be prevented
var prevent_ctrl = !guac_keyboard.modifiers.alt;
// 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)
if ((prevent_ctrl && guac_keyboard.modifiers.ctrl)
|| (prevent_alt && guac_keyboard.modifiers.alt)
|| guac_keyboard.modifiers.meta
|| guac_keyboard.modifiers.hyper)
this.reliable = true;