GUAC-791: Add missing private tags to inner variables/functions.

This commit is contained in:
Michael Jumper
2015-12-14 14:26:19 -08:00
parent 4554c64bb7
commit 7cdfd146ef
8 changed files with 89 additions and 33 deletions

View File

@@ -313,6 +313,7 @@ Guacamole.Keyboard = function(element) {
* An array of recorded events, which can be instances of the private
* KeydownEvent, KeypressEvent, and KeyupEvent classes.
*
* @private
* @type {KeyEvent[]}
*/
var eventLog = [];
@@ -541,6 +542,8 @@ Guacamole.Keyboard = function(element) {
* by keysym. This is used to prevent/allow default actions for key events,
* even when the onkeydown handler cannot be called again because the key
* is (theoretically) still pressed.
*
* @private
*/
var last_keydown_result = {};
@@ -571,19 +574,22 @@ Guacamole.Keyboard = function(element) {
* for the given location, or the keysym for the standard location if
* undefined.
*
* @param {Array} keysyms An array of keysyms, where the index of the
* keysym in the array is the location value.
* @param {Number} location The location on the keyboard corresponding to
* the key pressed, as defined at:
* http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent
* @private
* @param {Number[]} keysyms
* An array of keysyms, where the index of the keysym in the array is
* the location value.
*
* @param {Number} location
* The location on the keyboard corresponding to the key pressed, as
* defined at: http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent
*/
function get_keysym(keysyms, location) {
var get_keysym = function get_keysym(keysyms, location) {
if (!keysyms)
return null;
return keysyms[location] || keysyms[0];
}
};
function keysym_from_key_identifier(identifier, location, shifted) {
@@ -651,15 +657,18 @@ Guacamole.Keyboard = function(element) {
* the keyCode is the Unicode codepoint for that key. This is not
* correct in all cases.
*
* @param {Number} keyCode The keyCode from a browser keydown/keyup
* event.
* @param {String} keyIdentifier The legacy keyIdentifier from a
* browser keydown/keyup event.
* @returns {Boolean} true if the keyIdentifier looks sane, false if
* the keyIdentifier appears incorrectly derived or
* is missing entirely.
* @private
* @param {Number} keyCode
* The keyCode from a browser keydown/keyup event.
*
* @param {String} keyIdentifier
* The legacy keyIdentifier from a browser keydown/keyup event.
*
* @returns {Boolean}
* true if the keyIdentifier looks sane, false if the keyIdentifier
* appears incorrectly derived or is missing entirely.
*/
function key_identifier_sane(keyCode, keyIdentifier) {
var key_identifier_sane = function key_identifier_sane(keyCode, keyIdentifier) {
// Missing identifier is not sane
if (!keyIdentifier)
@@ -684,7 +693,7 @@ Guacamole.Keyboard = function(element) {
// The keyIdentifier does NOT appear sane
return false;
}
};
/**
* Marks a key as pressed, firing the keydown event if registered. Key
@@ -777,10 +786,12 @@ Guacamole.Keyboard = function(element) {
* Given a keyboard event, updates the local modifier state and remote
* key state based on the modifier flags within the event. This function
* pays no attention to keycodes.
*
* @param {KeyboardEvent} e The keyboard event containing the flags to update.
*
* @private
* @param {KeyboardEvent} e
* The keyboard event containing the flags to update.
*/
function update_modifier_state(e) {
var update_modifier_state = function update_modifier_state(e) {
// Get state
var state = Guacamole.Keyboard.ModifierState.fromKeyboardEvent(e);
@@ -819,13 +830,14 @@ Guacamole.Keyboard = function(element) {
// Update state
guac_keyboard.modifiers = state;
}
};
/**
* 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.
*/
@@ -850,10 +862,11 @@ Guacamole.Keyboard = function(element) {
/**
* Releases Ctrl+Alt, if both are currently pressed and the given keysym
* looks like a key that may require AltGr.
*
*
* @private
* @param {Number} keysym The key that was just pressed.
*/
function release_simulated_altgr(keysym) {
var release_simulated_altgr = function release_simulated_altgr(keysym) {
// Both Ctrl+Alt must be pressed if simulated AltGr is in use
if (!guac_keyboard.modifiers.ctrl || !guac_keyboard.modifiers.alt)
@@ -875,7 +888,7 @@ Guacamole.Keyboard = function(element) {
guac_keyboard.release(0xFFEA); // Right alt
}
}
};
/**
* Reads through the event log, interpreting the first event, if possible,
@@ -883,10 +896,12 @@ Guacamole.Keyboard = function(element) {
* total lack of events or the need for more events, null is returned. Any
* interpreted events are automatically removed from the log.
*
* @return {KeyEvent} The first key event in the log, if it can be
* interpreted, or null otherwise.
* @private
* @return {KeyEvent}
* The first key event in the log, if it can be interpreted, or null
* otherwise.
*/
function interpret_event() {
var interpret_event = function interpret_event() {
// Peek at first event in log
var first = eventLog[0];
@@ -973,13 +988,14 @@ Guacamole.Keyboard = function(element) {
// No event interpreted
return null;
}
};
/**
* Returns the keyboard location of the key associated with the given
* keyboard event. The location differentiates key events which otherwise
* have the same keycode, such as left shift vs. right shift.
*
* @private
* @param {KeyboardEvent} e
* A JavaScript keyboard event, as received through the DOM via a
* "keydown", "keyup", or "keypress" handler.