Class Index | File Index

Classes


Class Guacamole.Keyboard


Defined in: Keyboard.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Provides cross-browser and cross-keyboard keyboard for a specific element.
Field Summary
Field Attributes Field Name and Description
<inner>  
An array of recorded events, which can be instances of the private KeydownEvent, KeypressEvent, and KeyupEvent classes.
<inner>  
The last result of calling the onkeydown handler for each key, indexed by keysym.
 
All modifiers and their states.
 
The state of every key, indexed by keysym.
Method Summary
Method Attributes Method Name and Description
<inner>  
get_keysym(keysyms, location)
Given an array of keysyms indexed by location, returns the keysym for the given location, or the keysym for the standard location if undefined.
<inner>  
indexof_keyup(keydown)
Searches the event log for a keyup event corresponding to the given keydown event, returning its index within the log.
<inner>  
Reads through the event log, interpreting the first event, if possible, and returning that event.
<inner>  
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).
<inner>  
key_identifier_sane(keyCode, keyIdentifier)
Heuristically detects if the legacy keyIdentifier property of a keydown/keyup event looks incorrectly derived.
<inner>  
Releases Ctrl+Alt, if both are currently pressed and the given keysym looks like a key that may require AltGr.
<inner>  
Given a keyboard event, updates the local modifier state and remote key state based on the modifier flags within the event.
Event Summary
Event Attributes Event Name and Description
 
onkeydown(keysym)
Fired whenever the user presses a key with the element associated with this Guacamole.Keyboard in focus.
 
onkeyup(keysym)
Fired whenever the user releases a key with the element associated with this Guacamole.Keyboard in focus.
Class Detail
Guacamole.Keyboard(element)
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.
Parameters:
{Element} element
The Element to use to provide keyboard events.
Field Detail
<inner> {(KeydownEvent|KeypressEvent|KeyupEvent)[]} eventLog
An array of recorded events, which can be instances of the private KeydownEvent, KeypressEvent, and KeyupEvent classes.

<inner> last_keydown_result
The last result of calling the onkeydown handler for each key, indexed 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.

modifiers
All modifiers and their states.

pressed
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.
Method Detail
<inner> get_keysym(keysyms, location)
Given an array of keysyms indexed by location, returns the keysym for the given location, or the keysym for the standard location if undefined.
Parameters:
{Array} keysyms
An array of keysyms, where the index of the keysym in the array is the location value.
{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

<inner> {Number} indexof_keyup(keydown)
Searches the event log for a keyup event corresponding to the given keydown event, returning its index within the log.
Parameters:
{KeydownEvent} keydown
The keydown event whose corresponding keyup event we are to search for.
Returns:
{Number} The index of the first keyup event in the event log matching the given keydown event, or -1 if no such event exists.

<inner> {KeyEvent} interpret_event()
Reads through the event log, interpreting the first event, if possible, 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.
Returns:
{KeyEvent} The first key event in the log, if it can be interpreted, or null otherwise.

<inner> {Boolean} interpret_events()
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).
Returns:
{Boolean} Whether the default action of the latest event should be prevented.

<inner> {Boolean} key_identifier_sane(keyCode, keyIdentifier)
Heuristically detects if the legacy keyIdentifier property of a keydown/keyup event looks incorrectly derived. Chrome, and presumably others, will produce the keyIdentifier by assuming the keyCode is the Unicode codepoint for that key. This is not correct in all cases.
Parameters:
{Number} keyCode
The keyCode from a browser keydown/keyup event.
{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.

<inner> release_simulated_altgr(keysym)
Releases Ctrl+Alt, if both are currently pressed and the given keysym looks like a key that may require AltGr.
Parameters:
{Number} keysym
The key that was just pressed.

<inner> update_modifier_state(e)
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.
Parameters:
{KeyboardEvent} e
The keyboard event containing the flags to update.
Event Detail
{Boolean} onkeydown(keysym)
Fired whenever the user presses a key with the element associated with this Guacamole.Keyboard in focus.
Parameters:
{Number} keysym
The keysym of the key being pressed.
Returns:
{Boolean} true if the key event should be allowed through to the browser, false otherwise.

onkeyup(keysym)
Fired whenever the user releases a key with the element associated with this Guacamole.Keyboard in focus.
Parameters:
{Number} keysym
The keysym of the key being released.

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Sep 30 2014 00:43:03 GMT-0700 (PDT)