diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js index 590403949..55640f980 100644 --- a/guacamole/src/main/webapp/scripts/client-ui.js +++ b/guacamole/src/main/webapp/scripts/client-ui.js @@ -246,6 +246,10 @@ GuacUI.Client = { "touch_screen" : null, "touch_pad" : null, + /* Keyboard shortcuts */ + + "shortcuts" : [], + /* Clipboard */ "remote_clipboard" : "", @@ -747,6 +751,167 @@ GuacUI.Client.Pinch = function(element) { }; +/** + * An object for handling keyboard shortcuts. The pattern for the shortcut is + * generic, consisting of an array of all required keys, where each "required + * key" is itself an array of allowed keysyms for that key. For the shortcut + * to match, at least one keysym from each array in the pattern must be + * pressed. + * + * @constructor + * @param Array.> pattern An array of required keys, where each + * "required key" is itself an array of + * allowed keysyms for that key. + */ +GuacUI.Client.KeyboardShortcut = function(pattern) { + + /** + * Reference to this keyboard shortcut. + */ + var guac_shortcut = this; + + /** + * Array of objects, where each object corresponds to a required key in the + * given pattern, and each property corresponds to a currently-pressed + * keysym which matches that required key. + * + * @type Object.[] + */ + var matchedKeysyms = []; + + /** + * Object whose properties are the currently-pressed keysyms which do not + * match any required key of the given pattern. + * + * @type Object. + */ + var unmatchedKeysyms = {}; + + // Initialize with zero matched keysyms + for (var i=0; i