Pierre Ossman [Fri, 1 Nov 2019 12:13:35 +0000 (13:13 +0100)]
Send NumLock on macOS, even though the key is Clear
There is no obvious choice what works best here, but this is what
TigerVNC has been doing for years without complaints. Let's follow
them until we get reports that this doesn't work well.
Samuel Mannehed [Thu, 31 Oct 2019 15:24:06 +0000 (16:24 +0100)]
Keep the virtual keyboard after using extra keys
If using the extra keys always gives focus to the screen then an
on-screen keyboard would be closed. When using on-screen keyboards we
instead want to give focus to our virtual keyboard input element.
Pierre Ossman [Thu, 31 Oct 2019 13:07:30 +0000 (14:07 +0100)]
Try to handle Meta key properly
The standards have unfortunatly caused some confusion between the Windows
key and the original Meta key. Try to handle the common case sanely at least.
Samuel Mannehed [Fri, 25 Oct 2019 15:44:20 +0000 (17:44 +0200)]
Move focus to the screen when using extra keys
A regression from 2afda54 and friends was that you couldn't use the
extra keys and then directly use the keyboard, you would have to click
in the session first.
This commit restores the correct behavior and also adds a visual queue
to the fact that the screen got the focus by fading the controlbar.
Samuel Mannehed [Mon, 21 Oct 2019 09:27:43 +0000 (11:27 +0200)]
Hide the emulated cursor when target is null
Makes it easier to understand what happens when a real element isn't
passed as a target to updateVisibility(). Also makes the code more
robust to future changes.
Co-authored-by: Alex Tanskanen <aleta@cendio.se> Co-authored-by: Niko Lehto <nikle@cendio.se>
Samuel Mannehed [Mon, 21 Oct 2019 09:26:40 +0000 (11:26 +0200)]
Fix disappearing cursor after click
In the cursor emulation when deciding if the cursor should be hidden -
Instead of checking what's under the cursor, we check the element that
has capture.
This introduced another bug in the cursor emulation. The cursor did not
always disappear properly when using our cursor emulation together with
our setCapture polyfill. More specifically, we saw a problem when a
capture ended on an element without cursor emulation.
We solved this by introducing another visibility check on a timer in
the cursor emulation. However this led to yet another problem where
this timer conflicted with the timer in the setCapture polyfill.
We removed the timeout in the setCapture polyfill and created a
variable to make sure that all the events remaining in the queue can be
completed.
Co-authored-by: Alex Tanskanen <aleta@cendio.se> Co-authored-by: Niko Lehto <nikle@cendio.se>
Samuel Mannehed [Mon, 21 Oct 2019 09:25:01 +0000 (11:25 +0200)]
Check next elem at mouseleave in cursor emulation
It's not obvious that we want to hide the cursor when we get a leave,
it depends on the element that we're leaving to. This makes the code
more robust.
Co-authored-by: Alex Tanskanen <aleta@cendio.se> Co-authored-by: Niko Lehto <nikle@cendio.se>
Pierre Ossman [Mon, 14 Oct 2019 08:15:19 +0000 (10:15 +0200)]
Never show drag icon if clipping is disabled
Toggling the enabled state is a remnant from an earlier version
of the code where we could determine if the the session is actually
clipped, and not just that the setting is enabled.
Right now we only change things based on the setting, so let's
completely hide the button when clipping is disabled.
Pierre Ossman [Fri, 16 Aug 2019 09:18:45 +0000 (11:18 +0200)]
Use "nomodule" instead of manual check
Very few browsers are left in the wild that supports modules but not
"nomodule", so let's simplify our handling a bit.
Safari 10 supports modules but not 'nomodule', this means that this
particular version of Safari will be broken. Due to this we have to
bump up the required Safari version to 11.
Niko Lehto [Tue, 17 Sep 2019 07:28:30 +0000 (09:28 +0200)]
Add support for VMware cursor encoding
Supports both classic cursor type and alpha cursor type. In classic
mode the server can send 'inverted' pixels for the cursor, our code
does not support this but handles these pixels as opaque black.
Co-authored-by: Samuel Mannehed <samuel@cendio.se>
Pierre Ossman [Fri, 23 Aug 2019 11:58:40 +0000 (13:58 +0200)]
Deprecate showDotCursor option for RFB constructor
It is not relevant for the connection stage so it should not have
been a constructor argument to begin with. Ship with a warning for
a release before we remove it.
Pierre Ossman [Fri, 23 Aug 2019 11:57:30 +0000 (13:57 +0200)]
Make sure showDotCursor can be modified before connecting
The cursor object is only attached to our canvas whilst connecting,
so we need to make sure we don't try to update anything when were
not connected or we'll get a crash.
Jesper Alf Dam [Wed, 7 Aug 2019 09:12:35 +0000 (11:12 +0200)]
When compacting the receive buffer don't copy unused buffer space
When compacting the receive buffer, we should only copy the bytes
between _rQi and _rQlen (the index of the first unread byte, and the
next write position).
Previously, we copied everything for _rQi up untill the end of the
buffer.
Jesper Alf Dam [Wed, 7 Aug 2019 09:03:12 +0000 (11:03 +0200)]
Don't compact the receive buffer unless we've actually run out of space
Previously, we would compact the buffer (moving unread data to the
start of the buffer) as follows:
- after processing a message, if there are zero unread bytes, just reset
the indices for first and last unread byte to zero
- else, if at least 1/8th of the buffer is used, copy remaining data to the beginning of the buffer
The second option is never actually necessary, as before inserting new data
into the array, we already check if there's enough free space, and
compact the buffer first if necessary. So we've been doing a lot of
copies that weren't actually needed. Let's not do that any more.
Jesper Alf Dam [Fri, 16 Aug 2019 12:27:12 +0000 (14:27 +0200)]
Avoid recursion in Alt check on Firefox
The Firefox workaround which checks for missing Alt key events may
synthesise new KeyboardEvents. On these events, checkAlt should not be
recursively triggered. Otherwise, we get "too much recursion" errors
whenever the Alt key is pressed.
Tim Edwards [Thu, 25 Jul 2019 20:22:48 +0000 (06:22 +1000)]
Added a Snap package for noVNC (#1231)
Creating an Ubuntu Snap package to make noVNC easier to deploy.
Checks for the websockify binary in both the PATH (using which) and in the location where the Snap package places the binary. This is necessary for noVNC to be usable in a Snap. It doesn't affect the original functionality of git cloning websockify if it's not found in PATH or the Snap location.
Lee Yarwood [Tue, 9 Jul 2019 11:12:43 +0000 (12:12 +0100)]
launch.sh: Check for a local websockify directory
Previously launch.sh would check both for the existence of a local
websockify file and /websockify/run file.
This initial check should really be for a local websockify directory
as in packaged environments a file could very well be the actual
executable leading to launch.sh incorrectly attempting to use a local
version of websockify.
Pierre Ossman [Fri, 24 May 2019 11:06:26 +0000 (13:06 +0200)]
Remove server pixel format warnings
These are harmless and really only for debugging. So remove them
as they tend to trick people in to thinking something is wrong.
We already print the entire server pixel format earlier anyway in
case we need the details.
Samuel Mannehed [Tue, 2 Apr 2019 14:45:51 +0000 (16:45 +0200)]
Allow autoscale() with zero height or width
Commit 6e7e6f9 stopped the function from running if width or height was
zero, this commit reverts that change. This commit also makes the
resulting canvas 0x0 if autoscale is called with zero. By adding this
special case we can avoid division by zero in the calculations.