Commit Graph

8 Commits

Author SHA1 Message Date
samhed 282834caf1 Fixes #309, make use of keysym.js
Bonus 3 bug fixes:
 * Meta is 0xFFE7 not 0xFE07
 * Super_L is 0xFFEB not 0xFFEC
 * Super_R is 0xFFEC not 0xFFED
2014-11-26 09:24:13 +01:00
Solly Ross 31f169e86f Cleanup: Keyboard code
File: keyboard.js
Tests Added: False (already present)
Changes:
- Fixed JSHint Errors
- Moved functions outside loops
- Added proper include directives to tests
2014-09-15 16:46:02 -04:00
samhed 60a415ae1c Credit for this fix goes to Jesper Dam (https://github.com/Medical-Insight/noVNC/tree/fix-ie10-keyboard).
Fix keyboard handling for IE10 (issue #352)
* Keyboard events in IE10 do not provide any useful information on the properties 'which', 'char' or 'charCode'. Instead, it seems to store the char code in the keyCode property.
2014-04-14 13:26:52 +02:00
Jesper Dam 230784066c Better browser OS detection.
Apparently Firefox on Linux changed the value of navigator.appVersion,
causing our OS detection (used to determine how to interpret different
modifier keys) to fail.

Use navigator.platform instead, which should be more stable.

http://stackoverflow.com/a/19883965/33213
2014-03-12 11:19:57 +01:00
Jesper Dam c3f6052435 Better key identifiers
Previously we identified keys in keyboard events by the 'key' property
if it was set, and 'keyCode' otherwise.

This turns out to be problematic as Firefox no longer leaves 'key'
undefined (so we fall back to using 'keyCode'), but instead sets 'key'
to 'MozPrintableKey' for all printable keys.

This meant that when (printable) keys are released, we can't match it
against the corresponding keydown event, and instead just send a keyup
event for the last keydown received.

Now, if both 'key' and 'keyCode' are set, use the concatenation of both.
Otherwise prefer 'keyCode', as that is at least unique for every key.

This should let us release the right keys on keyup events.
2014-03-12 11:19:56 +01:00
Jesper Dam f6a1d98a3a Fix issue #326: correct handling of shift key
When shortcut modifiers (modifier keys such as CTRL, which do not participate in
composing character input) are pressed, we try to suppress the keypress
event, as browsers do not reliably generate it. This means that
subsequent key events are decoded only based on the keydown event.

Due to a type error (comparing a string to a number), shift was
mistakenly treated as a shortcut modifier, preventing text input which
relied on shift, such as _ and %, from being generated.
2014-01-06 13:59:25 +01:00
jalf 466a09f0f3 Keyboard Handling [8/8]: Introduce substituteCodepoint() to replace code points which don't have a keysym with ones that do
For now, the only code points this is done for are {s, S, t, T} with comma below (used in Romanian),
 which are replaced by {s, S, t, T} Cedilla.
2013-12-05 12:31:50 -05:00
jalf 4ef7566b10 Keyboard Handling [2/8]: Core implementation of new keyboard handling
Add keyboard.js, containing the actual keyboard event parsing code.
2013-12-05 12:25:15 -05:00