Commit Graph

159 Commits

Author SHA1 Message Date
samhed b2cdd55859 Proper error handling for tight filters
Don't throw an exception when we encounter an unsupported tight
subencoding.
2016-06-10 17:15:42 +02:00
samhed 5fd3f88e50 Merge branch 'ui-cleanup' of https://github.com/kanaka/noVNC 2016-06-03 10:46:05 +02:00
Samuel ae11605141 Split the setDesktopSize function (#618)
In order to follow the surrounding coding-standards, the
setDesktopSize client message is split from the public function which
now is called requestDesktopSize().
2016-06-02 22:37:52 +02:00
samhed 777cb7a0c5 Cleanup for the resize related functions
Renamed functions, added clarifying comments and moved the resize
related functions closer to the other viewport functions.
2016-05-12 16:56:49 +02:00
samhed f52105bc88 Add fallback value for devicePixelRatio
In IE 10 for example, devicePixelRatio doesn't exist which caused the
code to fail by setting the thresholds to zero.
2016-05-12 16:43:19 +02:00
samhed 32df3fdbe1 Add a threshold for viewport dragging (#600) 2016-04-28 17:41:48 +02:00
Jonathan Bennett 27e77d468f Adds tap-to-click in viewport drag mode (#600) 2016-04-28 13:46:40 +02:00
Solly Ross 464944844f Remove unused variables in the TIGHT server init
This commit removes some unused variables in the TIGHT server init
section of the server init handler, replacing them with documenting
comments and calls to rQskipBytes.

Fixes #440.
2016-01-06 11:18:47 -05:00
Solly Ross 0252c7f766 Remove remaining references to jsunzip.js
This commit removes remaining references to jsunzip.js,
which is no longer actually used in noVNC.

Closes #436.
2016-01-06 11:10:26 -05:00
Daniël van de Giessen 3e3df4dbb1 Added return to correctly wait for password input before proceeding. Fixes #542 2015-10-16 16:46:10 +02:00
Solly Ross c802d93189 Make sure Pako always has enough room
Previously, we used a fixed chunkSize of 100KiB for Pako's output
buffer.  Using a hardcoded size caused issues, since Pako would assume
we wanted to use multiple chunks, and we didn't deal with this.  Now,
`Inflator#inflate()` takes a new `expected` argument, which indicates
the expected output size.  If this is bigger than the current chunkSize,
Inflator allocates a new output buffer that's big enough to hold the
output.

Fixes #531
2015-09-23 09:53:00 -04:00
Solly Ross 89bdc8ce48 Fix buffer over-reads in handle_tight
For performance reasons, the `handle_tight` function skips the
use of the receive queue API and uses the raw receive queue directly.
Because of the way that typed array receive queue gets reused, this
introduced the potential for buffer over-reads.

To address this, a new function, `rQwhole`, was introduced.
`rQwhole` simply returns a new view into the receive queue that
starts at 0 and ends at the current recorded end of the queue.

`handle_tight` now makes use of this function.

Fixes #522
2015-08-26 14:31:23 -04:00
Solly Ross f00193e08f Skip unnecessary render queue object creation
This commit skips object creation for the render queue when not
needed.  Instead of pushing an object onto the queue, and then
immediately running the result, you call the function directly.
Then, if the render queue is not empty, an object is created and
pushed onto the queue.  Otherwise, the functionality is just run
directly.
2015-08-06 14:47:03 -04:00
Solly Ross 9ff86fb718 Use Typed Arrays for the send queue
This commit converts the send queue to use typed arrays, and converts
message creation functions in 'rfb.js' to create messages directly into
the socket's send queue.  This commit also removes the separate mouse array,
which is no longer needed.
2015-08-06 14:47:03 -04:00
Solly Ross d1800d0960 Avoid Creating Small Objects Frequently
Creating lots of small objects frequently can drastically decrease
performance.  This commit introduces three fixes which avoid this:

- Use a preallocated palette and indexed-to-rgb destination Typed Array
  (the destination typed array is currently allocated at `4 * width *
  height`).

- Inline `getTightCLength`, which returned a two-item array.

- Pass RGBX data directly in a Typed Array to the Display, which
  avoids an extra loop, and only creates a new Typed Array View,
  instead of a whole new ArrayBuffer.
2015-08-06 14:47:03 -04:00
Solly Ross 38781d931e Use Typed Arrays for the Websock receive queue
**This commit removes Base64 (and Flash) support**

This commit converts websock.js to used Typed Arrays for the
receive queue (and tweaks rfb.js to ensure that it continues
to function, since only Firefox implements
`%TypedArray%.prototype.slice`).  Base64 support was removed
to simplify code paths, and pave the way for using Typed Arrays
for the send queue as well.

This provides two advantages: first, we allocate a buffer ahead
of time, meaning the browser doesn't have to do any work dynamically
increasing the receive queue size.  Secondly, we are now able to pass
around Typed Array Views (e.g. `Uint8Array`), which are lightweight, and
don't involve copying.

The downside is that we initially allocate more memory -- we currently
start out with 4 MiB, and then automatically double when it looks like
the amount unused is getting to small.

The commit also explicitly adds a check to the compacting logic that
avoids calling the copy functions if `_rQlen === _rQi`.
2015-08-06 14:47:03 -04:00
Solly Ross 6c883653a2 Remove unecessarily nested loop
This commit removes a nested loop in indexedToRGB, converting it into a
plain loop without multiplication.
2015-08-06 14:47:03 -04:00
Solly Ross 6940936ffc WIP: Switch to Pako for zlib
This commit introduces an alternate implementation of the zlib
decompressor based on Pako (https://github.com/nodeca/pako).
2015-08-06 14:47:03 -04:00
Solly Ross 0442e153a1 Fix RFB.js JSHint Errors
This fixes a couple of JSHint errors in RFB.js caused
by using `==` instead of `===`.
2015-08-06 14:47:03 -04:00
samhed 8ce27ddb4b Re-fixes #428 which was broken by commit 58ded70
* Disable local cursor when the browser doesn't support data uri
2015-04-29 14:54:28 +02:00
Solly Ross d9fc1c7be4 Throw exceptions from RFB constructor
Previously, if an error was thrown from the Display constructor
in the RFB constructor, we would attempt to use `RFB#updateState`
to handle this.  However, `RFB#updateState` attempts to close
the WebSocket connection, which doesn't exist at this point.

In the constructor, it's probably just better to raise an exception
instead (making sure to clean up anything relevant).

Fixes #460
2015-03-26 17:10:24 -04:00
samhed 798340b98d * Change name of ext_desktop_size to the proper ExtendedDesktopSize
* Added better error handling in ExtendedDesktopSize
* Added helper function to share code with DesktopSize
* Update test.rfb.js to only check for error handling if we were the
  ones requesting the resize
2015-03-05 14:56:47 +01:00
Solly Ross e543525faa Fix disconnect/reconnect issues
Commit 155d78b399 prevented reconnections
from working properly.  This fixes that by creating a new RFB object
after disconnecting or failing.

Furthermore, this ensures that a new connection cannot be opened util
we've actually disconnected (either by timer or by receiving a `close`
event).

Closes #452
2015-02-25 11:01:18 -05:00
samhed b0ec6509f1 Support automatic resize [Part 2/4]: rfb.js
* Support sending the setDesktopSize encoding (client -> server)
* Support recieving the ExtendedDesktopSize encoding (server <- client)
2015-02-06 17:06:48 +01:00
Solly a437079307 Merge pull request #427 from jswanner/register-listeners
Unregister event listeners from websock.
2015-02-04 11:09:37 -05:00
samhed b804b3e458 Fixes #428 - hides the local cursor when using the server-side cursor. 2015-01-15 16:27:18 +01:00
Jacob Swanner 155d78b399 Unregister event listeners from websock.
Prevents possible memory and event notification leaks when tearing down
connection and reestablishing a new one.
2015-01-08 15:25:55 -05:00
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
Joe Huss df89129ff0 Fix for typo from a recent pull
There is a minor typo in the recent pull  Simple fix.
2014-11-23 07:22:39 -05:00
Ramon de Klein 40ac6f0ab6 Don't draw "blank" HEXTILE tiles with random data
Previously, if a HEXTILE tiles was received with a subencoding
of 0x00, it would draw a rectangle using data from the render
queue, which would result in random colored blocks when using
the HEXTILE encoding.  This is the result of a miscopy during
the refactoring.  It now has the correct functionality according
to the RFB protocol specification, which is to draw a rectangle
with the last set background color.

Closes #411
2014-11-17 20:01:28 -05:00
Julien Fontanet 58ca1978ea Fix subprotocols
Broken by b1dee94788
2014-10-01 16:30:39 +02:00
Solly Ross d02a99f0c8 Fixed Typo Causing MouseUp to not Register
There was a typo in one of the instances of the _buttonMask field
(it was written as _buttonMaks), causing MouseUp to never be sent.
This has been rectified, and the unit tests for the mouse handler
have been changed to check for explicitly sending mouseup and
mousedown.

Fixes #393
2014-09-19 14:18:45 -04:00
Solly Ross b1dee94788 Cleanup: RFB Client
File: rfb.js (also websock.js)
Tests Added: True

Changes:
- De-Crockford-ified rfb.js
- Added methods to websock.js to skip bytes in the receive queue
2014-09-15 16:46:02 -04:00
Solly Ross 95eb681bbb Support the "NOTUNNEL" tunnel type for TightVNC
Previously, tight auth was supported without any support for tunnels,
even the no-op tunnel.  No, the no-op tunnel type is supported.
2014-09-15 16:46:02 -04:00
Solly 7cad15425e Merge pull request #347 from dol/fix/better-ws-binarytype-detection
Improved websocket binary support detection
2014-03-26 10:58:11 -04:00
samhed b7996b048b Added a wrapper for the UTF-8 decoding. 2014-03-14 15:18:05 +01:00
samhed 6227a91c01 Decode from UTF-8 to allow unicode characters in the connection name 2014-03-14 13:44:10 +01:00
Dominic Luechinger 97362c3980 Improved websocket binary support detection
A facke connection to 'wss://localhost:17523' (randomly chosen) to detect
the WebSocket binary support is not the best solution.
First of all, check of prototype has the property 'binaryType'. If not,
perform a dummy connection to 'wss://.' instead of 'wss://localhost:17523'.

This patch was inspired by the discussion and implementation of Modernizr:
https://github.com/Modernizr/Modernizr/issues/370
https://github.com/Modernizr/Modernizr/blob/master/feature-detects/websockets/binary.js
2014-03-11 14:29:58 +01:00
Julien Fontanet c7fc3c082f WebSocket protocols are now configurable. 2014-02-19 19:29:06 +01:00
Malcolm Scott a856a051da Implement XVP extension (shutdown/reboot/reset) 2014-02-17 17:55:28 -05:00
Malcolm Scott 03ab251587 Implement XVP auth 2014-02-17 17:55:28 -05:00
Solly df6b7d7341 Merge pull request #327 from devicenull/master
Add support for connecting to TightVNC servers
2014-02-10 17:21:29 -05:00
samhed 20074a49eb Removes the connection timeouts to enable slower clients, connections or servers. 2014-02-06 16:08:00 +01:00
Brian Rak d86cc2d911 Add support for TightVNC auth type 2014-01-30 19:20:41 -05:00
jalf fa30469cda Keyboard Handling [5/8]: Update rfb.js to connect mouse events to keyboard handler
This allows the keyboard handler to check modifier key state much more frequently

Since some browsers never send keyup events for modifier keys, we have to
synchronize modifier state whenever we get a mouse or keyboard event
2013-12-05 12:25:31 -05:00
Samuel 69127447ac Merge pull request #282 from samhed/framebufferupdate
Allow higher frame rates by using a new approach for framebufferUpdate requests
2013-10-10 02:45:08 -07:00
samhed 76e262134e * Removed fbu-requests from the places I missed earlier.
* Added a few clarifying comments.
2013-08-29 13:38:12 +02:00
Anton Lundin c39df031d8 clearTimeout instead of clearInterval for timers
We create timeouts, not intervals. Then we need to clear them with
clearTimeout.
2013-08-02 09:58:15 +02:00
samhed dfcedffc16 Make noVNC follow the RFB protocol and keep only one outstanding
framebufferUpdate request at a time.
2013-07-22 15:46:59 +02:00
samhed 406a8b4e96 Display the desktop name in the document title 2013-07-18 15:51:23 +02:00