kanaka/noVNC — pull request #314 by jalfd (2013-10-24 09:25:27+00:00)
Title: Better keyboard handling with support for international keyboard layouts

As discussed in https://github.com/kanaka/noVNC/pull/212, a complete rewrite of keyboard input to robustly handle differing keyboard layouts and browser quirks in a systematic way.

I don't expect you to just merge this as-is, since the structure is fairly different from the rest of noVNC.

src/keyboard.js and src/helper.js contain a standalone implementation of keyboard handling, and tests/keyboard-tests.html contains automatic unit tests of these (needs mocha and chai libs), while tests/keytest.html hooks it up to a text input field allowing you to manually enter keys and see how they're translated.

I've also copy/pasted the contents of helper.js and keyboard.js into input.js so noVNC can use it. However, this duplication is obviously a terrible idea in the long run - but for now I wanted to give you access to the "raw" standalone implementation as well so you can decide how to best fit the pieces together.

We've been using this for the past 4 months or so and found no problems with it (On Mac, there are a number of cases that are impossible to handle regardless of browser, presumably because the OS never sends the appropriate events, and we've found a few minor issues with certain keyboard layouts on Linux involving various modifier keys that I haven't gotten around to fixing yet).