I (@kelleyk) have rebased the original patch by @jimdigriz (Alexander Clouter)
on the current upstream version of noVNC. This required the following changes:
- Rename keysym symbols.
- Convert use of _rfb_state to _rfb_init_state.
- Update state transition logic; fixes "old-style" ATEN auth detection.
- Fix conditional ordering so that we do not skip new-type ATEN iKVM detection.
- Fix assertion broken in test case broken by upstream changes.
- Convert arr.push(x) function calls to push(arr, x).
- Restore keyEvent and pointerEvent handlers before relevant test cases.
I (@kelleyk) have updated the original patch to be compatible with
the double-buffering changes made upstream, repaired some test cases,
and cleaned up the patch a little bit.
The author of the original patch is @jimdigriz (Alexander Clouter).
We don't have to check for _display or context here since this is a
private function which is never called under such circumstances. This
solves problems caused by display.get_context() which was previously
removed in e549ae074f.
Do all rendering to a hidden canvas and then copy over the finished
frame to the visible canvas once everything is done. This simplifies
things and solves some bugs as we can retain a copy of the entire
frame buffer.
RFB's _fail function logs the error, disconnects the session and sets
disconnect_reason. The disconnect_reason is upon disconnection sent to
the user interface. It is thus not suitable for including error details
that aren't user friendly. The idea is that you will look in the
browser console for a full log with details of the error.
RFB._fail() can be called at any time in any state, it is not certain
that we will get a close event on the socket since the socket might not
be open. This caused us to hit the disconnect timeout in such cases.
Fixes issue #678
For example, previously if the user typed in illegal characters in the
port field, no error would be displayed in the interface and the page
would stop at "connecting".
There is a specific event for when an image has finished loading,
so trigger on that rather than polling. The polling interval of
requestAnimationFrame() can also be very large.
The callers don't need to concern themselves with how images are
rendered, so hide the details behind the API. This also avoids
exposing the render queue.
Mouse wheel event handling has now been standardised and has broad
support. Use this event rather than the older, non-standard ones.
At the same time fix up support for horisontal mouse wheel events.
The states 'loaded', 'failed' and 'fatal' were all variations of the
'disconnected' state. Removing these states allows us to get rid of
many ugly workarounds and special cases. Error messages to the UI can
now instead be delivered via a new onDisconnected callback.