From 7cdfd146ef61b6d16aafaf939c8a305f26157151 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 14 Dec 2015 14:26:19 -0800 Subject: [PATCH] GUAC-791: Add missing private tags to inner variables/functions. --- .../src/main/webapp/modules/AudioPlayer.js | 1 + .../src/main/webapp/modules/Client.js | 23 ++++-- .../src/main/webapp/modules/DataURIReader.js | 1 + .../src/main/webapp/modules/IntegerPool.js | 4 ++ .../src/main/webapp/modules/Keyboard.js | 70 ++++++++++++------- .../src/main/webapp/modules/Mouse.js | 8 +++ .../main/webapp/modules/OnScreenKeyboard.js | 10 +++ .../src/main/webapp/modules/StringReader.js | 5 +- 8 files changed, 89 insertions(+), 33 deletions(-) diff --git a/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js b/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js index b9d1ce9a5..760851abf 100644 --- a/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js +++ b/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js @@ -361,6 +361,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * dynamically according to the click-reduction algorithm implemented by * splitAudioPacket(). * + * @private * @returns {SampleArray} * A packet of audio data pulled from the beginning of the playback * queue. diff --git a/guacamole-common-js/src/main/webapp/modules/Client.js b/guacamole-common-js/src/main/webapp/modules/Client.js index de3379b7c..dc9c9a02f 100644 --- a/guacamole-common-js/src/main/webapp/modules/Client.js +++ b/guacamole-common-js/src/main/webapp/modules/Client.js @@ -69,11 +69,17 @@ Guacamole.Client = function(tunnel) { /** * The underlying Guacamole display. + * + * @private + * @type {Guacamole.Display} */ var display = new Guacamole.Display(); /** * All available layers and buffers + * + * @private + * @type {Object.} */ var layers = {}; @@ -81,6 +87,7 @@ Guacamole.Client = function(tunnel) { * All audio players currently in use by the client. Initially, this will * be empty, but audio players may be allocated by the server upon request. * + * @private * @type {Object.} */ var audioPlayers = {}; @@ -89,6 +96,7 @@ Guacamole.Client = function(tunnel) { * All video players currently in use by the client. Initially, this will * be empty, but video players may be allocated by the server upon request. * + * @private * @type {Object.} */ var videoPlayers = {}; @@ -103,6 +111,7 @@ Guacamole.Client = function(tunnel) { * All current objects. The index of each object is dictated by the * Guacamole server. * + * @private * @type {Guacamole.Object[]} */ var objects = []; @@ -554,11 +563,15 @@ Guacamole.Client = function(tunnel) { * Returns the layer with the given index, creating it if necessary. * Positive indices refer to visible layers, an index of zero refers to * the default layer, and negative indices refer to buffers. - * - * @param {Number} index The index of the layer to retrieve. - * @return {Guacamole.Display.VisibleLayer|Guacamole.Layer} The layer having the given index. + * + * @private + * @param {Number} index + * The index of the layer to retrieve. + * + * @return {Guacamole.Display.VisibleLayer|Guacamole.Layer} + * The layer having the given index. */ - function getLayer(index) { + var getLayer = function getLayer(index) { // Get layer, create if necessary var layer = layers[index]; @@ -579,7 +592,7 @@ Guacamole.Client = function(tunnel) { return layer; - } + }; function getParser(index) { diff --git a/guacamole-common-js/src/main/webapp/modules/DataURIReader.js b/guacamole-common-js/src/main/webapp/modules/DataURIReader.js index dfd402353..cbce5e7cd 100644 --- a/guacamole-common-js/src/main/webapp/modules/DataURIReader.js +++ b/guacamole-common-js/src/main/webapp/modules/DataURIReader.js @@ -43,6 +43,7 @@ Guacamole.DataURIReader = function(stream, mimetype) { /** * Current data URI. * + * @private * @type {String} */ var uri = 'data:' + mimetype + ';base64,'; diff --git a/guacamole-common-js/src/main/webapp/modules/IntegerPool.js b/guacamole-common-js/src/main/webapp/modules/IntegerPool.js index 5a6b68a17..a790e4103 100644 --- a/guacamole-common-js/src/main/webapp/modules/IntegerPool.js +++ b/guacamole-common-js/src/main/webapp/modules/IntegerPool.js @@ -31,11 +31,15 @@ Guacamole.IntegerPool = function() { /** * Reference to this integer pool. + * + * @private */ var guac_pool = this; /** * Array of available integers. + * + * @private * @type {Number[]} */ var pool = []; diff --git a/guacamole-common-js/src/main/webapp/modules/Keyboard.js b/guacamole-common-js/src/main/webapp/modules/Keyboard.js index b624eefd4..ce9f016ba 100644 --- a/guacamole-common-js/src/main/webapp/modules/Keyboard.js +++ b/guacamole-common-js/src/main/webapp/modules/Keyboard.js @@ -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. diff --git a/guacamole-common-js/src/main/webapp/modules/Mouse.js b/guacamole-common-js/src/main/webapp/modules/Mouse.js index 428575a52..cdd1ae935 100644 --- a/guacamole-common-js/src/main/webapp/modules/Mouse.js +++ b/guacamole-common-js/src/main/webapp/modules/Mouse.js @@ -119,6 +119,8 @@ Guacamole.Mouse = function(element) { * Cumulative scroll delta amount. This value is accumulated through scroll * events and results in scroll button clicks if it exceeds a certain * threshold. + * + * @private */ var scroll_delta = 0; @@ -789,6 +791,8 @@ Guacamole.Mouse.Touchscreen = function(element) { /** * Whether a gesture is known to be in progress. If false, touch events * will be ignored. + * + * @private */ var gesture_in_progress = false; @@ -806,11 +810,15 @@ Guacamole.Mouse.Touchscreen = function(element) { /** * The timeout associated with the delayed, cancellable click release. + * + * @private */ var click_release_timeout = null; /** * The timeout associated with long-press for right click. + * + * @private */ var long_press_timeout = null; diff --git a/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js b/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js index 6504247e7..81d5680e7 100644 --- a/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js +++ b/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js @@ -36,6 +36,7 @@ Guacamole.OnScreenKeyboard = function(layout) { /** * Reference to this Guacamole.OnScreenKeyboard. * + * @private * @type {Guacamole.OnScreenKeyboard} */ var osk = this; @@ -55,6 +56,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * pressed, it may not be in this map at all, but all pressed keys will * have a corresponding mapping to true. * + * @private * @type {Object.} */ var pressed = {}; @@ -214,6 +216,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * Returns whether all modifiers having the given names are currently * active. * + * @private * @param {String[]} names * The names of all modifiers to test. * @@ -242,6 +245,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * given name, where that Key object's requirements (such as pressed * modifiers) are all currently satisfied. * + * @private * @param {String} keyName * The name of the key to retrieve. * @@ -279,6 +283,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * element with the "guac-keyboard-pressed" CSS class. If the key is * already pressed, this function has no effect. * + * @private * @param {String} keyName * The name of the key to press. * @@ -346,6 +351,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * "guac-keyboard-pressed" CSS class from the associated element. If the * key is already released, this function has no effect. * + * @private * @param {String} keyName * The name of the key to release. * @@ -705,6 +711,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * key. Touch events will result in mouse events being ignored for * touchMouseThreshold events. * + * @private * @param {TouchEvent} e * The touch event being handled. */ @@ -719,6 +726,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * key. Touch events will result in mouse events being ignored for * touchMouseThreshold events. * + * @private * @param {TouchEvent} e * The touch event being handled. */ @@ -733,6 +741,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * key. If mouse events are currently being ignored, this handler * does nothing. * + * @private * @param {MouseEvent} e * The touch event being handled. */ @@ -747,6 +756,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * key. If mouse events are currently being ignored, this handler * does nothing. * + * @private * @param {MouseEvent} e * The touch event being handled. */ diff --git a/guacamole-common-js/src/main/webapp/modules/StringReader.js b/guacamole-common-js/src/main/webapp/modules/StringReader.js index f905ec3cb..7b49e3f74 100644 --- a/guacamole-common-js/src/main/webapp/modules/StringReader.js +++ b/guacamole-common-js/src/main/webapp/modules/StringReader.js @@ -48,13 +48,16 @@ Guacamole.StringReader = function(stream) { /** * The number of bytes remaining for the current codepoint. - * + * + * @private * @type {Number} */ var bytes_remaining = 0; /** * The current codepoint value, as calculated from bytes read so far. + * + * @private * @type {Number} */ var codepoint = 0;