Joel Martin [Tue, 13 Sep 2011 18:14:11 +0000 (13:14 -0500)]
Fix window/document sizing in firefox.
Another firefox issue is that height: 100% is calculated as 100% of
the containing element even when the containing element is the window.
This means that the size of any sibling element shifts the window size
down by that much and causes the vertical scroll bars to appear. This
doesn't happen in Chrome.
- So instead, put a pad element inside the noVNC_screen element that
is the size of the control bar. This is hidden by the control bar,
however, it causes things to be sized correctly.
Joel Martin [Tue, 13 Sep 2011 17:17:44 +0000 (12:17 -0500)]
Firefox offset bug: use margin instead of padding.
For some reason, the position calculation is broken in firefox when
a DOM object in the ancestry change uses padding. So use margin to
shift the view area down.
Joel Martin [Tue, 13 Sep 2011 14:54:44 +0000 (09:54 -0500)]
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
Joel Martin [Wed, 3 Aug 2011 23:18:41 +0000 (18:18 -0500)]
Add a viewport example/test.
Tested with an iPad 2.
This example shows a 400x200 viewport of an 800x400 display.
It tries to be intelligent about how much it redraws. It copies what
it can, and then when the user releases the mouse, it redraws the
"dirty" areas that were newly revealed.
Joel Martin [Sun, 24 Jul 2011 02:24:59 +0000 (21:24 -0500)]
Touch events and mouse button selectors.
First crack at supporting touch screen for devices like Android and
iOS tablets. Part of https://github.com/kanaka/noVNC/issues/48.
This change detects touch screen support and uses the touchstart,
touchmove, touchend events in place of the normal mouse events.
In order to support middle and right mouse clicks, if the device is
a touch device, then three toggle buttons are added to the UI
representing the left, middle and right mouse buttons. These select
which mouse button will be sent when the screen is touched. All the
buttons can be toggled off, in which case then the touch events only
move the mouse cursor rather than sending a mouse down and mouse up
for touchstart and touchend events respectively. This allows fairly
full control with the mouse on touch screens.
Joel Martin [Thu, 14 Jul 2011 20:57:01 +0000 (15:57 -0500)]
Version 0.1, debian packaging, license text.
noVNC version 0.1
Add debian packaging directory loosely based on
http://trac.zentyal.org/browser/trunk/extra/novnc/debian
Show web root directory on startup (pulled from websockify f1c8223).
Lintian fixups:
- Some license text clarifications.
- remove executable permission on utils/launch.sh and
include/web-socket-js/web_socket.js
- Add executable permission to utils/launch.sh
WebSocketServer.socket() is a static method takes a host and port and
an optional connect parameter. If connect is not set then it returns
a socket listening on host and port. If connect is set then
a connection will be made host and port and the socket returned. This
has IPv6 support like the addrinfo method it replaces.
Also, prefer IPv4 resolutions if they are in the list. This can be
overriden to prefer IPv6 resolutions for the same host using the
optional prefer_ipv6 parameter.
Joel Martin [Wed, 6 Jul 2011 21:32:42 +0000 (16:32 -0500)]
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).
The reocrd parameter will turn on recording of all messages sent
to and from the client. The record parameter is a file prefix. The
full file-name will be the prefix with an extension '.HANDLER_ID'
based on the handler ID.
Joel Martin [Wed, 11 May 2011 22:31:53 +0000 (17:31 -0500)]
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.
Joel Martin [Wed, 11 May 2011 20:55:44 +0000 (15:55 -0500)]
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.
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
Joel Martin [Tue, 12 Apr 2011 14:06:11 +0000 (09:06 -0500)]
input.js: adjust special key handling for non-US keys.
Issue #21 - non-US keyboard layouts.
Only identify some keys as special during the keyDown event so that
when using non-US keyboards the values don't overlap with the values
for normal keys.
Some keys have to still be identified in both keyDown and keyPress
since they generate both: backspace and enter for Firefox and Opera,
tab for Opera.
Joel Martin [Tue, 5 Apr 2011 19:26:54 +0000 (14:26 -0500)]
Refactor keyboard event handling.
This is part of addressing issue #21 - non-US keyboard layouts.
There are several challenges when dealing with keyboard events:
- The meaning and use of keyCode, charCode and which depends on
both the browser and the event type (keyDown/Up vs keyPress).
- We cannot automatically determine the keyboard layout
- The keyDown and keyUp events have a keyCode value that has not
been translated by modifier keys.
- The keyPress event has a translated (for layout and modifiers)
character code but the attribute containing it differs. keyCode
contains the translated value in WebKit (Chrome/Safari), Opera
11 and IE9. charCode contains the value in WebKit and Firefox.
The which attribute contains the value on WebKit, Firefox and
Opera 11.
- The keyDown/Up keyCode value indicates (sort of) the physical
key was pressed but only for standard US layout. On a US
keyboard, the '-' and '_' characters are on the same key and
generate a keyCode value of 189. But on an AZERTY keyboard even
though they are different physical keys they both still
generate a keyCode of 189!
- To prevent a key event from propagating to the browser and
causing unwanted default actions (such as closing a tab,
opening a menu, shifting focus, etc) we must suppress this
event in both keyDown and keyPress because not all key strokes
generate on a keyPress event. Also, in WebKit and IE9
suppressing the keyDown prevents a keyPress but other browsers
still generated a keyPress even if keyDown is suppressed.
For safe key events, we wait until the keyPress event before
reporting a key down event. For unsafe key events, we report a key
down event when the keyDown event fires and we suppress any further
actions (including keyPress).
In order to report a key up event that matches what we reported
for the key down event, we keep a list of keys that are currently
down. When the keyDown event happens, we add the key event to the
list. If it is a safe key event, then we update the which attribute
in the most recent item on the list when we received a keyPress
event (keyPress should immediately follow keyDown). When we
received a keyUp event we search for the event on the list with
a matching keyCode and we report the character code using the value
in the 'which' attribute that was stored with that key.
For character codes above 255 we use a character code to keysym lookup
table. This is generated using the util/u2x11 script contributed by
Colin Dean (xvpsource.org).
Joel Martin [Sun, 3 Apr 2011 22:30:45 +0000 (17:30 -0500)]
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.
Joel Martin [Tue, 22 Mar 2011 19:24:55 +0000 (14:24 -0500)]
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.
Joel Martin [Mon, 31 Jan 2011 04:58:22 +0000 (22:58 -0600)]
IE9 fixes. Works but slow. API change.
API change: changed include path variable from VNC_uri_prefix to
URI_INCLUDE since websock.js uses the variable and websock.js is no
longer just for noVNC (i.e. websockify is really the canonical
location for websock.js).
Changes to get web-socket-js to work. Right now it's a hack to get
around: https://github.com/gimite/web-socket-js/issues#issue/41. The
hack is to disable caching of the flash objects by appending
"?" + Math.random() to the end of the flash object path (but only when
using IE).