diff --git a/src/Keyboard.js b/src/Keyboard.js index 62d709c..4fc1e5b 100644 --- a/src/Keyboard.js +++ b/src/Keyboard.js @@ -23,7 +23,7 @@ var Guacamole = Guacamole || {}; * Provides cross-browser and cross-keyboard keyboard for a specific element. * Browser and keyboard layout variation is abstracted away, providing events * which represent keys as their corresponding X11 keysym. - * + * * @constructor * @param {Element|Document} [element] * The Element to use to provide keyboard events. If omitted, at least one @@ -62,7 +62,7 @@ Guacamole.Keyboard = function Keyboard(element) { /** * Fired whenever the user presses a key with the element associated * with this Guacamole.Keyboard in focus. - * + * * @event * @param {!number} keysym * The keysym of the key being pressed. @@ -76,7 +76,7 @@ Guacamole.Keyboard = function Keyboard(element) { /** * Fired whenever the user releases a key with the element associated * with this Guacamole.Keyboard in focus. - * + * * @event * @param {!number} keysym * The keysym of the key being released. @@ -158,7 +158,7 @@ Guacamole.Keyboard = function Keyboard(element) { /** * The JavaScript key code of the key pressed. For most events (keydown * and keyup), this is a scancode-like value related to the position of - * the key on the US English "Qwerty" keyboard. For keypress events, + * the key on the US English "Qwerty" keyboard. For keypress events, * this is the Unicode codepoint of the character that would be typed * by the key pressed. * @@ -177,7 +177,7 @@ Guacamole.Keyboard = function Keyboard(element) { /** * The standard name of the key pressed, as defined at: * http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent - * + * * @type {!string} */ this.key = orig && orig.key; @@ -186,7 +186,7 @@ Guacamole.Keyboard = function Keyboard(element) { * The location on the keyboard corresponding to the key pressed, as * defined at: * http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent - * + * * @type {!number} */ this.location = orig ? getEventLocation(orig) : 0; @@ -471,7 +471,7 @@ Guacamole.Keyboard = function Keyboard(element) { "CapsLock": [0xFFE5], "Cancel": [0xFF69], "Clear": [0xFF0B], - "Convert": [0xFF21], + "Convert": [0xFF23], "Copy": [0xFD15], "Crsel": [0xFD1C], "CrSel": [0xFD1C], @@ -538,6 +538,7 @@ Guacamole.Keyboard = function Keyboard(element) { "Left": [0xFF51], "Meta": [0xFFE7, 0xFFE7, 0xFFE8], "ModeChange": [0xFF7E], + "NonConvert": [0xFF22], "NumLock": [0xFF7F], "PageDown": [0xFF56], "PageUp": [0xFF55], @@ -547,6 +548,7 @@ Guacamole.Keyboard = function Keyboard(element) { "PrintScreen": [0xFF61], "Redo": [0xFF66], "Right": [0xFF53], + "Romaji": [0xFF24], "RomanCharacters": null, "Scroll": [0xFF14], "Select": [0xFF60], @@ -577,11 +579,11 @@ Guacamole.Keyboard = function Keyboard(element) { 0xFE03: true, // ISO Level 3 Shift (AltGr) 0xFFE1: true, // Left shift 0xFFE2: true, // Right shift - 0xFFE3: true, // Left ctrl - 0xFFE4: true, // Right ctrl + 0xFFE3: true, // Left ctrl + 0xFFE4: true, // Right ctrl 0xFFE5: true, // Caps Lock - 0xFFE7: true, // Left meta - 0xFFE8: true, // Right meta + 0xFFE7: true, // Left meta + 0xFFE8: true, // Right meta 0xFFE9: true, // Left alt 0xFFEA: true, // Right alt 0xFFEB: true, // Left super/hyper @@ -594,11 +596,11 @@ Guacamole.Keyboard = function Keyboard(element) { * @type {!Guacamole.Keyboard.ModifierState} */ this.modifiers = new Guacamole.Keyboard.ModifierState(); - + /** * The state of every key, indexed by keysym. If a particular key is * pressed, the value of pressed for that keysym will be true. If a key - * is not currently pressed, it will not be defined. + * is not currently pressed, it will not be defined. * * @type {!Object.} */ @@ -658,7 +660,7 @@ Guacamole.Keyboard = function Keyboard(element) { * Given an array of keysyms indexed by location, returns the keysym * for the given location, or the keysym for the standard location if * undefined. - * + * * @private * @param {number[]} keysyms * An array of keysyms, where the index of the keysym in the array is @@ -702,7 +704,7 @@ Guacamole.Keyboard = function Keyboard(element) { var typedCharacter; - // If identifier is U+xxxx, decode Unicode character + // If identifier is U+xxxx, decode Unicode character var unicodePrefixLocation = identifier.indexOf("U+"); if (unicodePrefixLocation >= 0) { var hex = identifier.substring(unicodePrefixLocation+2); @@ -804,7 +806,7 @@ Guacamole.Keyboard = function Keyboard(element) { * repeat for the pressed key will start after a delay if that key is * not a modifier. The return value of this function depends on the * return value of the keydown event handler, if any. - * + * * @param {number} keysym * The keysym of the key to press. * @@ -851,7 +853,7 @@ Guacamole.Keyboard = function Keyboard(element) { /** * Marks a key as released, firing the keyup event if registered. - * + * * @param {number} keysym * The keysym of the key to release. */ @@ -859,7 +861,7 @@ Guacamole.Keyboard = function Keyboard(element) { // Only release if pressed if (guac_keyboard.pressed[keysym]) { - + // Mark key as released delete guac_keyboard.pressed[keysym]; delete implicitlyPressed[keysym]; @@ -1054,7 +1056,7 @@ Guacamole.Keyboard = function Keyboard(element) { * Reads through the event log, removing events from the head of the log * when the corresponding true key presses are known (or as known as they * can be). - * + * * @private * @return {boolean} * Whether the default action of the latest event should be prevented. @@ -1106,8 +1108,8 @@ Guacamole.Keyboard = function Keyboard(element) { // Release Ctrl+Alt if the keysym is printable if (keysym <= 0xFF || (keysym & 0xFF000000) === 0x01000000) { - guac_keyboard.release(0xFFE3); // Left ctrl - guac_keyboard.release(0xFFE4); // Right ctrl + guac_keyboard.release(0xFFE3); // Left ctrl + guac_keyboard.release(0xFFE4); // Right ctrl guac_keyboard.release(0xFFE9); // Left alt guac_keyboard.release(0xFFEA); // Right alt } @@ -1119,7 +1121,7 @@ Guacamole.Keyboard = function Keyboard(element) { * and returning that event. If no events can be interpreted, due to a * total lack of events or the need for more events, null is returned. Any * interpreted events are automatically removed from the log. - * + * * @private * @return {KeyEvent} * The first key event in the log, if it can be interpreted, or null @@ -1455,28 +1457,28 @@ Guacamole.Keyboard._nextID = 0; * @constructor */ Guacamole.Keyboard.ModifierState = function() { - + /** * Whether shift is currently pressed. * * @type {!boolean} */ this.shift = false; - + /** * Whether ctrl is currently pressed. * * @type {!boolean} */ this.ctrl = false; - + /** * Whether alt is currently pressed. * * @type {!boolean} */ this.alt = false; - + /** * Whether meta (apple key) is currently pressed. * @@ -1495,7 +1497,7 @@ Guacamole.Keyboard.ModifierState = function() { /** * Returns the modifier state applicable to the keyboard event given. - * + * * @param {!KeyboardEvent} e * The keyboard event to read. * @@ -1503,7 +1505,7 @@ Guacamole.Keyboard.ModifierState = function() { * The current state of keyboard modifiers. */ Guacamole.Keyboard.ModifierState.fromKeyboardEvent = function(e) { - + var state = new Guacamole.Keyboard.ModifierState(); // Assign states from old flags @@ -1521,5 +1523,5 @@ Guacamole.Keyboard.ModifierState.fromKeyboardEvent = function(e) { } return state; - + };