in guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js [881:947]
Guacamole.OnScreenKeyboard.Key = function(template, name) {
/**
* The unique name identifying this key within the keyboard layout.
*
* @type {!string}
*/
this.name = name || template.name;
/**
* The human-readable title that will be displayed to the user within the
* key. If not provided, this will be derived from the key name.
*
* @type {!string}
*/
this.title = template.title || this.name;
/**
* The keysym to be pressed/released when this key is pressed/released. If
* not provided, this will be derived from the title if the title is a
* single character.
*
* @type {number}
*/
this.keysym = template.keysym || (function deriveKeysym(title) {
// Do not derive keysym if title is not exactly one character
if (!title || title.length !== 1)
return null;
// For characters between U+0000 and U+00FF, the keysym is the codepoint
var charCode = title.charCodeAt(0);
if (charCode >= 0x0000 && charCode <= 0x00FF)
return charCode;
// For characters between U+0100 and U+10FFFF, the keysym is the codepoint or'd with 0x01000000
if (charCode >= 0x0100 && charCode <= 0x10FFFF)
return 0x01000000 | charCode;
// Unable to derive keysym
return null;
})(this.title);
/**
* The name of the modifier set when the key is pressed and cleared when
* this key is released, if any. The names of modifiers are distinct from
* the names of keys; both the "RightShift" and "LeftShift" keys may set
* the "shift" modifier, for example. By default, the key will affect no
* modifiers.
*
* @type {string}
*/
this.modifier = template.modifier;
/**
* An array containing the names of each modifier required for this key to
* have an effect. For example, a lowercase letter may require nothing,
* while an uppercase letter would require "shift", assuming the Shift key
* is named "shift" within the layout. By default, the key will require
* no modifiers.
*
* @type {!string[]}
*/
this.requires = template.requires || [];
};