Commit Graph

74 Commits

Author SHA1 Message Date
Juanjo Diaz 9255e0fb47 Remove intermediate variable from mouse 2019-02-16 23:31:58 +02:00
Juanjo Diaz 84a5a2d827 Throw Error instead of String 2018-11-24 19:47:57 +02:00
Solly Ross 84586c0f17 Change copyright header (#1138)
* Change copyright header

This updates the copyright header to say "The noVNC Authors".  People
who previously had copyright listings are now under the AUTHORS file.
2018-10-09 12:15:35 +02:00
Pierre Ossman 3f1cda2e37 Enforce space before code block 2018-09-06 17:29:26 +02:00
Pierre Ossman 426a8c927b Enforce curly braces for control statements 2018-09-06 17:22:40 +02:00
Pierre Ossman 942a312779 Enforce object key spacing 2018-09-06 17:07:11 +02:00
Pierre Ossman 7b536961b2 Enforce indentation 2018-09-06 16:37:38 +02:00
Pierre Ossman a98881151f Enforce brace style 2018-09-06 15:39:26 +02:00
Juanjo Diaz 651c23ece3 Use fat arrow functions `const foo = () => { ... };` for callbacks
and any other function that is passed around and it's not a top level function
2018-07-12 19:06:57 +02:00
Juanjo Diaz 0e4808bf6f Use ES6 classes
Always use the shorthand notation if the function is a method of an object or class `{ foo() { ... } }` or `class bar { foo() { ... } }`
unless it's a callback in which case you a fat arrow function should be used `{ cb: () => { ... } }`
2018-07-12 19:06:57 +02:00
Pierre Ossman 1073b60155 Sort vkeys table 2018-07-04 15:53:41 +02:00
Pierre Ossman 8acadd9e97 Merge branch 'fix/ie11-numpad5-compatibility' of https://github.com/vlastoun/noVNC 2018-07-04 15:53:30 +02:00
Juanjo Diaz 2b5f94fa6a Prefer const/let over var 2018-05-24 00:27:09 +03:00
Juanjo Diaz 8727f598c2 Add eslint and fix reported issues 2018-05-24 00:25:44 +03:00
Vlastimil Sadilek 5858f472e3 Fix: IE11 Numpad5 compatibility when numlock off
This fix Numpad5 in Internet Explorer 11 if numlock state of host differs with numlock state of
VNC console.
2018-05-16 13:52:56 +02:00
Pierre Ossman 35dd3c2299 Merge branches 'ffalt' and 'altgr' of https://github.com/CendioOssman/noVNC 2018-03-13 16:03:01 +01:00
Pierre Ossman 3a7c0c67c1 Work around broken Alt keyup in Firefox
Firefox no longer sends keyup events properly for the Alt keys. Try
to sniff out the state of the Alt key by monitoring other events that
include its state.
2018-03-13 16:01:38 +01:00
Pierre Ossman b22c9ef954 Better detection of AltGr on Windows
Try to properly detect the fake CtrlL+AltR sequence Windows sends
when pressing AltGr. This allows us to send more accurate key
events over to the server.
2018-03-09 12:14:23 +01:00
Pierre Ossman d6ae445773 Handle _keyDownList in _sendKeyEvent()
This makes sure it never gets out of sync with what we've actually
sent.
2018-03-09 12:13:21 +01:00
Solly Ross a4d51bd220
Merge pull request #1009 from juanjoDiaz/move_browser_checks
Move browser checks to browser.js
2018-02-01 10:33:28 -05:00
Juanjo Diaz 9e1bd410aa Remove jshint comments 2018-01-31 07:38:29 -08:00
Juanjo Diaz a003535941 Remove console statements 2018-01-30 08:53:38 -08:00
Juanjo Diaz 59ef29163e Move browser checks to browser.js 2018-01-30 08:35:47 -08:00
Pierre Ossman 747b462337 Use standard JavaScript properties
Use normal properties with JavaScript setters and getters instead of
our homegrown stuff.

This also changes the properties to follow normal naming conventions.
2017-11-09 13:03:32 +01:00
Pierre Ossman 3d7bb02036 Change some attributes to arguments
Some attributes are better suited as arguments, primarily because they
are associated with a specific method and cannot be changed later.
2017-11-09 12:52:05 +01:00
Pierre Ossman 2afda54456 Only grab key events on canvas
Give the canvas proper focus handling. This avoids messy logic that
needs to disable and enable event handling when we want to interact
with other UI elements.

It also makes sure we can properly inhibit the browser from triggering
local actions on key presses.
2017-10-18 15:07:17 +02:00
Samuel Mannehed 28b004fd70 Combine small mouse wheel events
The VNC protocol can't handle different deltas or speeds for a mouse
wheel event. When using a device that sends a lot of small mouse wheel
events, instead of fewer larger steps, the effect was that mouse wheel
scrolling was way to sensitive.
This patch looks at the delta of wheel events and doesn't send events
until the combined delta has passed a threshold. Single events that
doesn't pass the threshold get sent after a timeout in order to not
loose any events.

Fixes #577.
2017-09-17 18:23:57 +02:00
Samuel Mannehed c1e2785fb6 Split devices.js into keyboard.js and mouse.js 2017-09-17 18:23:57 +02:00
Pierre Ossman 4093c37f28 Ignore compositing key
keyCode 229 is commonly used with virtual keyboards when the
system cannot map things to a specific key. As such we should
treat it as 'Unidentified'.
2017-07-07 15:04:44 +02:00
Pierre Ossman 8f8c1803ff Merge branch 'qemufix' of https://github.com/CendioOssman/noVNC 2017-07-06 13:07:19 +02:00
Pierre Ossman 7cac5c8e9f Fallback for missing keypress events
IE and Edge have some corner cases (e.g. Ctrl+key) where we get
insufficient information in the keydown event, and we never get
a keypress event. Try to make a guess of the key in those cases.
2017-07-06 13:00:00 +02:00
Pierre Ossman 7e79dfe425 Track keys using keyIdentifier
This is necessary on older iOS where code isn't provided.
2017-07-06 13:00:00 +02:00
Pierre Ossman e7c4d669f0 Handle iOS special keys 2017-06-21 14:02:24 +02:00
Pierre Ossman 9e99ce126c Fake key release for iOS hardware keyboards
iOS sends decent key down events, but junk key up events when a
hardware keyboard is used. This confuses the key tracking as a
corresponding release is then never detected. To work around this
we'll treat the hardware keyboard like the virtual ones and send
the key release right away.
2017-06-21 13:58:53 +02:00
Pierre Ossman 858ea4a774 Avoid use of 'let' and 'const'
They are not supported on older browsers, e.g. iOS 9.
2017-06-02 15:41:37 +02:00
Pierre Ossman 844e983916 Limit use of keypress fallback
It was preventing key events for dead keys, so try to reduce it to
only cases where we must use it.
2017-06-02 14:38:16 +02:00
Pierre Ossman dfa7826d72 Get XT scan code mappings from the keycodemapdb project
This way we can work together with other projects that need this kind
of mapping.
2017-05-31 16:20:24 +02:00
Samuel Mannehed afb621d577 Add missing semicolon 2017-05-13 01:56:35 +02:00
Samuel Mannehed 333ad45c70 Don't capture touch events
They are implicitly captured anyway, and we get problems if we try
to explicitly capture them.
2017-05-11 13:34:43 +02:00
Samuel Mannehed 4f1c81dca9 Stop tracking mouse capture state
Was a workaround for other bugs which are now fixed.
2017-05-11 13:30:40 +02:00
Samuel Mannehed cb568ece8b Stop grabbing mouse events globally
Not necessary anymore since we have proper capture.
2017-05-11 13:27:10 +02:00
Pierre Ossman 9782d4a324 Use KeyboardEvent.key too look up keysyms
And emulate it on browsers where it is missing or incorrect. This
makes the code more future oriented as it primarily uses the standardised
fields.
2017-05-04 12:13:48 +02:00
Pierre Ossman 634cc1ba46 Handle CapsLock on macOS
Modifiers behave a bit oddly on macOS, causing weird CapsLock events
to be sent by the browsers.
2017-05-04 12:13:48 +02:00
Pierre Ossman bf43c26319 Clean up AltGraph handling
It doesn't need to be this general as the issue is mostly about
Windows. Also use the same modifier shuffle that RealVNC and
TigerVNC uses to get macOS working well.
2017-05-04 12:13:48 +02:00
Pierre Ossman ae82053366 Simplify pressed key handling
Prefer avoid having the server simulate multiple key presses by
refusing to use multiple keysyms for the same physical key.
2017-05-04 12:13:47 +02:00
Pierre Ossman 9fce233d51 Simplify handling of keypress
Use a dedicated variable to track a two stage key rather than
piggy-backing on the key state array.
2017-05-04 12:13:47 +02:00
Pierre Ossman f7363fd26d Move keyboard handling in to Keyboard class
Replace the multi stage pipeline system with something simpler.
That level of abstraction is not needed.
2017-05-04 12:13:47 +02:00
Pierre Ossman 9e6f71cb75 Remove modifier synchronisation
The fields provided cannot tell us if it is the left or right
version of the key that's pressed, so they are inherently unreliable.
It is also not a huge problem in practice as we'll get in sync on
the next press or release of the modifier.
2017-05-04 12:13:47 +02:00
Pierre Ossman a784a9cabc Remove QEMU key event handler
The normal event handler provides all the necessary information
now, so it is no longer needed.
2017-05-04 12:13:47 +02:00
Pierre Ossman d0703d1bde Simplify keyboard event API
No need for an object for three static fields.
2017-05-04 12:13:47 +02:00