Commit Graph

91 Commits

Author SHA1 Message Date
Joel Martin bc28395abf Add/use display.drawImage which is viewport relative.
Fixes https://github.com/kanaka/noVNC/issues/163

When using an encoding with raw images (tight, tightPNG) we need to
draw those image relative to the viewport so that clipping works when
the viewport isn't at 0, 0.
2012-05-10 18:16:27 -05:00
Todd Freese 58ad83878c Added support for RealVNC Mac. 2012-05-10 12:29:36 -05:00
Joel Martin dcf1994d3e Don't treat onerror as a close.
The close event will also fire so trying to fail the connection twice
is unhelpful and hiding status information.
2012-04-25 20:13:25 -05:00
Joel Martin f8380ff939 Add code/reason to close event messages. Remove useless object print in error event. 2012-04-13 11:25:04 -05:00
Joel Martin f84504bc63 Support Apple Remote Desktop.
https://github.com/kanaka/noVNC/issues/58
2012-03-23 12:21:23 -05:00
Joel Martin ce86f5c954 Squelch noisy debug logs. 2012-03-13 20:24:24 -05:00
Joel Martin c0c20581f5 Merge tight/tightPNG routine.
Mostly duplicate code so merge it and wrap with closures that pass in
the isTightPNG parameter.

Still detect and error if copy/filter when tightPNG.
2012-03-12 15:34:56 -07:00
Joel Martin d065cad99e General code formatting and cleanliness. 2012-03-10 20:32:01 -06:00
Joel Martin a09a75e8f2 Stats: count pixels instead of just FBU.rects.
With last_rect, the rects count can be high until a last_rect
pseudo-encoding is received which messes with the timing stats. So
count up the number of pixels rendered and show timing after the pixel
count reaches the width*height of the screen.
2012-03-10 19:56:19 -06:00
Mike Tinglof d38db74abd add some documentation; default to existing websocket transport 2012-03-09 11:02:18 -05:00
Mike Tinglof 9b75bcaada add tight zlib stream reset; add error if tight encoding is used w/o true color 2012-01-31 00:15:56 -05:00
Mike Tinglof a14b8fae2a comment out per-decompress checksum and logging 2012-01-30 02:26:36 -05:00
Mike Tinglof 2cedf48397 add last rect special encoding; fix tight fill subencoding color handling; fix mono indexed rect handling 2012-01-30 02:19:18 -05:00
Mike Tinglof c514fd5e1c don't need to copy palette data until we have all data for rect; change a few comments 2012-01-29 02:10:25 -05:00
Mike Tinglof 5ca5e2d8cd implement tight indexed rectangle; remove some debug code 2012-01-29 01:55:41 -05:00
Mike Tinglof 6fbc37489f fix handling of min compression size 2012-01-28 02:56:19 -05:00
Mike Tinglof a820f1267a added rgb image drawing, some zlib changes (huffman coding working, but lz77 not so much) 2012-01-25 18:09:55 -05:00
Mike Tinglof c577ca2305 keep zlib history so we can decode as a stream 2012-01-24 21:18:29 -05:00
Mike T de84e09854 basic framing for tight is working (decode not complete) 2012-01-24 13:56:33 -05:00
Joel Martin e79917c3db Merge remote branch 'origin/issue-70'
Conflicts:
	include/display.js
	include/rfb.js

This merges in the fix for https://github.com/kanaka/noVNC/issues/70

This changes noVNC to use the preferred color ordering that most VNC
server prefer and that VMWare VNC requires. It's possible this may
break some VNC servers out there in which case we might have to do
something a bit more subtle such as having alternate render functions
for little and big endian color ordering.
2012-01-12 17:17:11 -06:00
Joel Martin a9a7f0e18c Fix Intel AMT KVM: disable true color.
Issue: https://github.com/kanaka/noVNC/issues/118
Reporter @maxnet also found and suggested the fix.

Probably could be more intelligent/generic by keying off the depth
sent by the server, but this will do for now.
2012-01-12 12:52:09 -06:00
Joel Martin ff4bfcb773 Linting.
Switched to using: http://www.jshint.com/
2012-01-12 12:38:55 -06:00
Joel Martin b688a909b0 Show close code and reason.
Also add commented out web-socket-js debug variable in
include/websock.js
2011-12-15 13:59:35 -06:00
Joel Martin 06a9ef0c6c Add View Only mode setting.
Resolve issue: https://github.com/kanaka/noVNC/pull/101

Based on proposal from @mightpenguin:
Matthew Balman <emperor@mightypenguin.org>

If view_only option is set then do not send mouse and keyboard events.
This is not a secure/enforced way to make a client view only. To
enforce view only at the server, most VNC servers support setting
a view only password.
2011-12-01 09:05:16 -06:00
Joel Martin 6209639f2c Add WebSocket URL path to UI settings. 2011-09-27 12:36:06 -05:00
Joel Martin 490d471c53 Remove support for non-HTML5 browsers.
Display API change:
    - getTile -> startTile (no longer returns a tile)
    - setSubTile -> subTile (drop img/tile first parameter)
    - putTile -> finishTile (no longer takes img/tile paramter)

The Display tile logic uses canvas image data directly and
caches/reuses a 16x16 imageData tile (for other sizes, the tile is
create for each call). This gives a 30% speedup on Chrome
13 (and no significant change for Firefox 3.6/4.0).

Other:

- Remove rgbxImageFill and cmapImageFill routines.

- Simplify constructor tests and just error if createImageData is not
  supported by canvas instead of .

- Remove webkit canvas bug workaround that effects Chrome 7. Chrome
  7 usage share is now less than 0.5 percent and the workaround is
  ugly. Drop the function wrapping in the constructor and the canvas
  flush() routine.

- Remove support for getImageData (Opera 11+ now required)

Update browser support list:

    - Chrome 8+ (really any except 7)
    - Firefox 3.6+
    - Safari 4+
    - Opera 11+
    - IE9+
    - iOS 4.2+
2011-09-26 11:28:24 -05:00
Joel Martin a5df24b488 Viewport clip/drag for mobile/touchscreen devices.
API changes (forward compatible):

- Display: add 'viewport' conf option to turn on and off viewport
  mode.
- RFB: add 'viewportDrag' option to enable/disable viewport dragging
  mode.

Other:

- Add clip mode setting to default UI. For touch devices, clipping is
  forced on.
- Use CSS media queries to adjust visual elements based on screen
  size. Especially disconnected logo size/position and button text size.
- Catch page unload while connected and give a confirm dialog.
- Change mouse button selector to a single button that changes between
  ' ', 'L', 'M', 'R' when clicked (empty means mouse is just being
  moved and doesn't send clicks).
- include/ui.js:setViewClip() routine sets the clipping of the
  viewport to the current size of the viewport area (if clipping is
  enabled).
- include/ui.js:setViewDrag() toggles/enables/disables viewport
  dragging mode.
- Add several images for the UI and for Apple devices:
    - images/clipboard.png: clipboard menu icon
    - images/connect.png: connect menu icon
    - images/disconnect.png: disconnect button icon
    - images/keyboard.png: show keyboard button
    - images/move.png: viewport drag/move toggle button
    - images/settings.png: settings menu icon
    - images/screen_320x460.png: iOS app/desktop link start image
    - images/screen_57x57.png: iOS app icon
    - images/screen_700x700.png: full size noVNC image
2011-09-22 10:36:23 -05:00
Joel Martin e0b23efe95 Fix fbUpdateRequest undefined parameter logic. 2011-09-14 10:42:15 -05:00
Joel Martin 7e5f81f255 Merge branch 'master' into mobile 2011-09-13 16:53:04 -05:00
Joel Martin 832c744578 Framebuffer requests based on clean/dirty areas.
New routine fbUpdateRequests that builds the update request messages
based on the result of display.getCleanDirtyReset().

- Also, fix fbUpdateRequest to properly accept x,y,xw,yw parameters.
2011-09-13 14:42:38 -05:00
Joel Martin 9192cbe39c Merge branch 'master' into mobile
Conflicts:
	include/rfb.js
2011-09-13 10:14:53 -05:00
Joel Martin 54e7cbdf8f Viewport handling in include/display.js
Part of mobile device support:
https://github.com/kanaka/noVNC/issues/48

The Display object is redefined as a larger display region with
an equal or smaller visible viewport. The size of the full display
region is set/changed using resize(). The viewport is set/changed
using viewportChange().

All exposed routines that draw on the display now take coordinates
that are absolute (relative to the full display region). For example,
the result of fillRect(100, 100, 10, 10, [255,0,0]) will appear in the
canvas at (0,0) if the viewport is set to (100,100).

Details:

- Move the generic part of the viewport code from tests/viewport.html
  into include/display.

- Add two new routines to the Display interface:

    - viewportChange(deltaX, deltaY, width, height)
        - This adjusts the position of the visible viewport and/or the
          size of the viewport.

        - deltaX and deltaY specify how the position of the viewport
          should be shifted. The position of the viewport is clamped
          to the full region size (i.e. cannot outside the display
          region).

        - The clean and dirty regions of the display are updated based
          on calls to this routine. For example, if the viewport width
          is increased, then there is now a dirty box on the right
          side of the viewport. Another example, if the viewport is
          shifted down and to the left over the display region, there
          are now two dirty boxes: one on the left side and one
          on the bottom of the viewport.

    - getCleanDirtyReset()
        - This returns an object with the clean box and a list of
          dirty boxes (that need to be redrawn).

            {'cleanBox':
                {'x': x, 'y': y, 'w': w, 'h': h},
             'dirtyBoxes':
                [{'x': x, 'y': y, 'w': w, 'h': h}, ...]
             }

        - The coordinates in the clean and dirty boxes are absolute
          coordinates (relative to the full display region) but they
          are clipped to the visible viewport.

        - Calling this function also resets the clean rectangle to be
          the whole viewport (i.e. nothing visible needs to be redrawn
          dirty) so the caller of this routine is responsible for
          redrawing any
2011-09-13 09:54:44 -05:00
Joel Martin 0911173a89 Disable static canvas logo. 2011-09-08 09:29:05 -05:00
Chris Gordon 53fc7392bb Modifed UI. Move HTML from ui.js to vnc.html. 2011-09-08 08:26:30 -05:00
Joel Martin 1150d0f70f Only output debug colourMap table once. 2011-09-06 17:46:57 -05:00
Joel Martin ac99a1f791 Change default PixelFormat. Fix canvas test.
Instead of R,G,B (red-shift of 0, green-shift of 8, and blue-shift
of 16), use the default ordering of B,G,R (red-shift of 16, green-shift of 8, and blue-shift
of 0) that tightvncserver uses (and that VMWare's VNC server seems to
require). Also, warn in the console if the server does not default to
the new format.

Fix the tests/canvas.html test. This is a general fix with regards to
the rename/refactor of canvas.js into display.js and not specific to
the color re-ordering.
2011-07-18 12:17:47 -05:00
Joel Martin a4ff1f573d Fix ordering of tightPNG fills.
This addresses issue #65:
https://github.com/kanaka/noVNC/issues/65

When tightPNG encoded rects were received, any fill types were
immediately drawn to the canvas while images (PNG, JPEGs) were queued
for loading. This can cause screen corruption when things are changing
rapidly due to the misordering of fills vs images.

Also, remove the onload setting in each image on the queue and instead
decrease the tight image queue scanning interval (to 40ms or 25
scans per second).
2011-07-06 16:32:42 -05:00
Joel Martin c6fd71536f Show full pixelFormat received from server.
For debugging issue #70: https://github.com/kanaka/noVNC/issues/70
2011-07-01 13:17:20 -05:00
Ed Schouten 3b8caa4b09 Add support for passing the file name to get.
This change allows one to implement a single WebSockets proxy, which
multiplexes connections to different hosts.
2011-06-27 10:55:03 +02:00
Joel Martin fa8f14d56d Fix playback of recorded VNC.
- Update test mode calls to work with separate websock module.

- Pull in include/websock.js update 7f487fdbd from websockify.
2011-06-26 14:17:42 -05:00
Joel Martin 5210330a6c Refactor configuration attributes.
- Add conf_defaults which accepts an array of configuration
  attributes.
- Split out user configuration defaults from the actual configuration
  object.
- Add mode field and enforce read-only, write-once, read-write modes.
2011-05-11 17:31:53 -05:00
Joel Martin d890e8640f API changes/cleanup.
API changes:
    - include/canvas.js renamed to include/display.js
    - Display.rescale() method removed from API. Use Display.set_scale() instead.
    - Make logo configuration attribute of Display and display it when
      clear() is called if it is set.

API deprecations:
    - use RFB onUpdateState instead of updateState.
    - use RFB onClipboard instead of clipboardReceive.

See https://github.com/kanaka/noVNC/wiki/ModuleAPI for detailed noVNC
modules and API description.

Expand and normalize the event/callback interfaces. Standize on
"onEventName" form for callbacks.

    Callback Renames:
        - RFB updateState -> onUpdateState
        - RFB clipboardReceive -> onClipboard
        - Keyboard keyPress -> onKeyPress
        - Mouse mouseButton -> onMouseButton
        - Mouse mouseMove -> onMouseMove

    Callback Additions:
        - RFB onPasswordRequired
        - RFB onBell
        - RFB onFBUReceive
        - RFB onFBUComplete

Other:
- Add array type support to Util.conf_default()
- Removed a bunch of routines from the Display API that were just used
  internally and not actually by noVNC: flush, setFillColor,
  imageDataGet, imageDataCreate, rgbxImageData, rgbxImageFill,
  cmapImageData, cmapImageFill.
- More keyboard/mouse logging when debug turned on.
- Some JSLinting
2011-05-11 15:55:44 -05:00
Joel Martin d0c29bb679 Fix copyright year to 2011. 2011-04-05 14:44:47 -05:00
Joel Martin d1bd5ec7d4 Fix focus/clipboard related to mouse/keyboard refactor. 2011-04-03 17:51:47 -05:00
Joel Martin d3796c149e API change: Mouse/kbd handling to include/input.js
API change: for intergrators that explicitly include the Javascript
files (that do not use include/vnc.js)js, include/input.js is a new
file that must also be included.

The mouse and keyboard handling could be useful on its own so split it
out into a Keyboard and Mouse class in include/input.js.

This refactoring is preparation to deal with issue #21 - non-US
keyboard layouts.
2011-04-03 17:30:45 -05:00
Joel Martin f899070482 IE9 fixes: mouse, doctype. Adobe Flash link.
Fix mouse button mapping in IE9. All browsers have converged on
a standard left=0, middle=1, right=2 ... all except IE that is.

Add html5 doctype to tests.

In vnc_perf test, use do_test instead of start for function name since
start is a keyword in IE.

In error about Flash give a link to Adobe's download page.
2011-03-29 15:44:03 -05:00
Joel Martin 0b6292b8c0 No exception if noVNC_logo is undefined. 2011-03-25 09:01:53 -05:00
Joel Martin 81bcf70fdc Higher connectTimeout default with web-socket-js.
Current timeout is 2 seconds for connect timeout. Use 5 seconds if
web-socket-js (Flash WebSockets emulator) is being used. On Windows XP
with Flash 10.2.152.26, connecting seems to take quite a bit longer
than it probably should. This should make it work more consistently.
2011-03-22 14:24:55 -05:00
Joel Martin 43cf7bd83b Some JSLint'ing 2011-02-19 16:44:10 -06:00
Joel Martin 159ad55d03 Add logo, favicon.
Thanks to Michael Sersen for creating images/Logo.svg.

- Add images directory with original SVG logo, favicon, and some
  derivative PNGs of the logo for different purpose.

- Note that license on images/* is CC BY-SA.

- Add utils/img2js.py to take an image and generate a base64 encoded
  data URI string.

- Add base64 encoded data URI screen logo to display in canvas when
  disconnected.
2011-02-03 11:04:32 -06:00