Commit be098285 authored by Joel Martin's avatar Joel Martin

Merge branch 'master' of github.com:kanaka/noVNC

parents c3c51ed3 142aa458
...@@ -10,6 +10,7 @@ is not limited to): ...@@ -10,6 +10,7 @@ is not limited to):
include/display.js include/display.js
include/input.js include/input.js
include/jsunzip.js include/jsunzip.js
include/keysym.js
include/logo.js include/logo.js
include/rfb.js include/rfb.js
include/ui.js include/ui.js
......
images/alt.png

339 Bytes

images/esc.png

385 Bytes

images/tab.png

387 Bytes

/* /*
* noVNC base CSS * noVNC base CSS
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* noVNC is licensed under the MPL 2.0 (see LICENSE.txt) * noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
* This file is licensed under the 2-Clause BSD license (see LICENSE.txt). * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
*/ */
...@@ -51,7 +52,6 @@ html { ...@@ -51,7 +52,6 @@ html {
float:right; float:right;
} }
#noVNC_view_drag_button { #noVNC_view_drag_button {
display: none; display: none;
} }
...@@ -62,34 +62,36 @@ html { ...@@ -62,34 +62,36 @@ html {
display: none; display: none;
} }
#noVNC_extra_keys {
display: inline;
list-style-type: none;
padding: 0px;
margin: 0px;
position: relative;
}
.noVNC-buttons-left { .noVNC-buttons-left {
float: left; float: left;
padding-left:10px; z-index: 1;
padding-top:4px; position: relative;
} }
.noVNC-buttons-right { .noVNC-buttons-right {
float:right; float:right;
right: 0px; right: 0px;
padding-right:10px; z-index: 2;
padding-top:4px; position: absolute;
}
#noVNC_status_bar {
margin-top: 0px;
padding: 0px;
} }
#noVNC_status_bar div { #noVNC_status {
font-size: 12px; font-size: 12px;
padding-top: 4px; padding-top: 4px;
width:100%; height:32px;
}
#noVNC_status {
height:20px;
text-align: center; text-align: center;
font-weight: bold;
color: #fff;
} }
#noVNC_settings_menu { #noVNC_settings_menu {
margin: 3px; margin: 3px;
text-align: left; text-align: left;
...@@ -104,22 +106,12 @@ html { ...@@ -104,22 +106,12 @@ html {
float:right; float:right;
} }
.noVNC_status_normal {
background: #eee;
}
.noVNC_status_error {
background: #f44;
}
.noVNC_status_warn {
background: #ff4;
}
/* Do not set width/height for VNC_screen or VNC_canvas or incorrect /* Do not set width/height for VNC_screen or VNC_canvas or incorrect
* scaling will occur. Canvas resizes to remote VNC settings */ * scaling will occur. Canvas resizes to remote VNC settings */
#noVNC_screen_pad { #noVNC_screen_pad {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
height: 44px; height: 36px;
} }
#noVNC_screen { #noVNC_screen {
text-align: center; text-align: center;
...@@ -154,14 +146,14 @@ html { ...@@ -154,14 +146,14 @@ html {
/*Bubble contents divs*/ /*Bubble contents divs*/
#noVNC_settings { #noVNC_settings {
display:none; display:none;
margin-top:77px; margin-top:73px;
right:20px; right:20px;
position:fixed; position:fixed;
} }
#noVNC_controls { #noVNC_controls {
display:none; display:none;
margin-top:77px; margin-top:73px;
right:12px; right:12px;
position:fixed; position:fixed;
} }
...@@ -173,7 +165,7 @@ html { ...@@ -173,7 +165,7 @@ html {
display:none; display:none;
position:fixed; position:fixed;
margin-top:77px; margin-top:73px;
right:20px; right:20px;
left:20px; left:20px;
padding:15px; padding:15px;
...@@ -186,9 +178,30 @@ html { ...@@ -186,9 +178,30 @@ html {
border-radius:10px; border-radius:10px;
} }
#noVNC_popup_status_panel {
display:none;
position: fixed;
z-index: 1;
margin:15px;
margin-top:60px;
padding:15px;
width:auto;
text-align:center;
font-weight:bold;
word-wrap:break-word;
color:#fff;
background:rgba(0,0,0,0.65);
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
}
#noVNC_clipboard { #noVNC_clipboard {
display:none; display:none;
margin-top:77px; margin-top:73px;
right:30px; right:30px;
position:fixed; position:fixed;
} }
...@@ -207,17 +220,11 @@ html { ...@@ -207,17 +220,11 @@ html {
z-index: -1; z-index: -1;
} }
.noVNC_status_warn {
background-color:yellow;
}
/* /*
* Advanced Styling * Advanced Styling
*/ */
/* Control bar */ .noVNC_status_normal {
#noVNC-control-bar {
position:fixed;
background: #b2bdcd; /* Old browsers */ background: #b2bdcd; /* Old browsers */
background: -moz-linear-gradient(top, #b2bdcd 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */ background: -moz-linear-gradient(top, #b2bdcd 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b2bdcd), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b2bdcd), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */
...@@ -225,9 +232,32 @@ html { ...@@ -225,9 +232,32 @@ html {
background: -o-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */ background: -o-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */ background: -ms-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */
background: linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */ background: linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */
}
.noVNC_status_error {
background: #f04040; /* Old browsers */
background: -moz-linear-gradient(top, #f04040 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f04040), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f04040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f04040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f04040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */
background: linear-gradient(top, #f04040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */
}
.noVNC_status_warn {
background: #f0f040; /* Old browsers */
background: -moz-linear-gradient(top, #f0f040 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f0f040), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f0f040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f0f040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f0f040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */
background: linear-gradient(top, #f0f040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */
}
/* Control bar */
#noVNC-control-bar {
position:fixed;
display:block; display:block;
height:44px; height:36px;
left:0; left:0;
top:0; top:0;
width:100%; width:100%;
...@@ -368,22 +398,85 @@ html { ...@@ -368,22 +398,85 @@ html {
font-size: 180px; font-size: 180px;
} }
@media screen and (min-width: 481px) and (max-width: 640px) { .noVNC-buttons-left {
.noVNC_status_button { padding-left: 10px;
font-size: 10px; }
.noVNC-buttons-right {
padding-right: 10px;
}
#noVNC_status {
z-index: 0;
position: absolute;
width: 100%;
margin-left: 0px;
}
#showExtraKeysButton { display: none; }
#toggleCtrlButton { display: inline; }
#toggleAltButton { display: inline; }
#sendTabButton { display: inline; }
#sendEscButton { display: inline; }
/* left-align the status text on lower resolutions */
@media screen and (max-width: 800px){
#noVNC_status {
z-index: 1;
position: relative;
width: auto;
float: left;
margin-left: 4px;
} }
}
@media screen and (max-width: 640px){
#noVNC_clipboard_text { #noVNC_clipboard_text {
width: 410px; width: 410px;
} }
#noVNC_logo { #noVNC_logo {
font-size: 150px; font-size: 150px;
} }
}
@media screen and (min-width: 321px) and (max-width: 480px) {
.noVNC_status_button { .noVNC_status_button {
font-size: 10px; font-size: 10px;
} }
.noVNC-buttons-left {
padding-left: 0px;
}
.noVNC-buttons-right {
padding-right: 0px;
}
/* collapse the extra keys on lower resolutions */
#showExtraKeysButton {
display: inline;
}
#toggleCtrlButton {
display: none;
position: absolute;
top: 30px;
left: 0px;
}
#toggleAltButton {
display: none;
position: absolute;
top: 65px;
left: 0px;
}
#sendTabButton {
display: none;
position: absolute;
top: 100px;
left: 0px;
}
#sendEscButton {
display: none;
position: absolute;
top: 135px;
left: 0px;
}
}
@media screen and (min-width: 321px) and (max-width: 480px) {
#noVNC_clipboard_text { #noVNC_clipboard_text {
width: 250px; width: 250px;
} }
......
/* /*
* noVNC black CSS * noVNC black CSS
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* noVNC is licensed under the MPL 2.0 (see LICENSE.txt) * noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
* This file is licensed under the 2-Clause BSD license (see LICENSE.txt). * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
*/ */
...@@ -9,7 +10,7 @@ ...@@ -9,7 +10,7 @@
background-color:#000; background-color:#000;
} }
#noVNC-control-bar { .noVNC_status_normal {
background: #4c4c4c; /* Old browsers */ background: #4c4c4c; /* Old browsers */
background: -moz-linear-gradient(top, #4c4c4c 0%, #2c2c2c 50%, #000000 51%, #131313 100%); /* FF3.6+ */ background: -moz-linear-gradient(top, #4c4c4c 0%, #2c2c2c 50%, #000000 51%, #131313 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4c4c4c), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(100%,#131313)); /* Chrome,Safari4+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4c4c4c), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(100%,#131313)); /* Chrome,Safari4+ */
...@@ -18,6 +19,24 @@ ...@@ -18,6 +19,24 @@
background: -ms-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */ background: -ms-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */
background: linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */ background: linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */
} }
.noVNC_status_error {
background: #f04040; /* Old browsers */
background: -moz-linear-gradient(top, #f04040 0%, #2c2c2c 50%, #000000 51%, #131313 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f04040), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(100%,#131313)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f04040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f04040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f04040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */
background: linear-gradient(top, #f04040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */
}
.noVNC_status_warn {
background: #f0f040; /* Old browsers */
background: -moz-linear-gradient(top, #f0f040 0%, #2c2c2c 50%, #000000 51%, #131313 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f0f040), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(100%,#131313)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f0f040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f0f040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f0f040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */
background: linear-gradient(top, #f0f040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */
}
.triangle-right { .triangle-right {
border:2px solid #fff; border:2px solid #fff;
......
/* /*
* noVNC blue CSS * noVNC blue CSS
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* noVNC is licensed under the MPL 2.0 (see LICENSE.txt) * noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
* This file is licensed under the 2-Clause BSD license (see LICENSE.txt). * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
*/ */
#noVNC-control-bar { .noVNC_status_normal {
background-color:#04073d; background-color:#04073d;
background-image: -webkit-gradient( background-image: -webkit-gradient(
linear, linear,
...@@ -20,6 +21,36 @@ ...@@ -20,6 +21,36 @@
rgb(4,7,61) 50% rgb(4,7,61) 50%
); );
} }
.noVNC_status_error {
background-color:#f04040;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.54, rgb(240,64,64)),
color-stop(0.5, rgb(4,7,61))
);
background-image: -moz-linear-gradient(
center bottom,
rgb(4,7,61) 54%,
rgb(249,64,64) 50%
);
}
.noVNC_status_warn {
background-color:#f0f040;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.54, rgb(240,240,64)),
color-stop(0.5, rgb(4,7,61))
);
background-image: -moz-linear-gradient(
center bottom,
rgb(4,7,61) 54%,
rgb(240,240,64) 50%
);
}
.triangle-right { .triangle-right {
border:2px solid #fff; border:2px solid #fff;
......
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* Licensed under MPL 2.0 or any later version (see LICENSE.txt) * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
*/ */
...@@ -489,6 +490,9 @@ var that = {}, // Public API methods ...@@ -489,6 +490,9 @@ var that = {}, // Public API methods
conf = {}, // Configuration attributes conf = {}, // Configuration attributes
mouseCaptured = false; mouseCaptured = false;
var doubleClickTimer = null,
lastTouchPos = null;
// Configuration attributes // Configuration attributes
Util.conf_defaults(conf, that, defaults, [ Util.conf_defaults(conf, that, defaults, [
['target', 'ro', 'dom', document, 'DOM element that captures mouse input'], ['target', 'ro', 'dom', document, 'DOM element that captures mouse input'],
...@@ -521,6 +525,10 @@ function releaseMouse() { ...@@ -521,6 +525,10 @@ function releaseMouse() {
// Private functions // Private functions
// //
function resetDoubleClickTimer() {
doubleClickTimer = null;
}
function onMouseButton(e, down) { function onMouseButton(e, down) {
var evt, pos, bmask; var evt, pos, bmask;
if (! conf.focused) { if (! conf.focused) {
...@@ -528,8 +536,34 @@ function onMouseButton(e, down) { ...@@ -528,8 +536,34 @@ function onMouseButton(e, down) {
} }
evt = (e ? e : window.event); evt = (e ? e : window.event);
pos = Util.getEventPosition(e, conf.target, conf.scale); pos = Util.getEventPosition(e, conf.target, conf.scale);
if (e.touches || e.changedTouches) { if (e.touches || e.changedTouches) {
// Touch device // Touch device
// When two touches occur within 500 ms of each other and are
// closer than 20 pixels together a double click is triggered.
if (down == 1) {
if (doubleClickTimer == null) {
lastTouchPos = pos;
} else {
clearTimeout(doubleClickTimer);
// When the distance between the two touches is small enough
// force the position of the latter touch to the position of
// the first.
var xs = lastTouchPos.x - pos.x;
var ys = lastTouchPos.y - pos.y;
var d = Math.sqrt((xs * xs) + (ys * ys));
// The goal is to trigger on a certain physical width, the
// devicePixelRatio brings us a bit closer but is not optimal.
if (d < 20 * window.devicePixelRatio) {
pos = lastTouchPos;
}
}
doubleClickTimer = setTimeout(resetDoubleClickTimer, 500);
}
bmask = conf.touchButton; bmask = conf.touchButton;
// If bmask is set // If bmask is set
} else if (evt.which) { } else if (evt.which) {
...@@ -543,7 +577,7 @@ function onMouseButton(e, down) { ...@@ -543,7 +577,7 @@ function onMouseButton(e, down) {
} }
//Util.Debug("mouse " + pos.x + "," + pos.y + " down: " + down + //Util.Debug("mouse " + pos.x + "," + pos.y + " down: " + down +
// " bmask: " + bmask + "(evt.button: " + evt.button + ")"); // " bmask: " + bmask + "(evt.button: " + evt.button + ")");
if (bmask > 0 && conf.onMouseButton) { if (conf.onMouseButton) {
Util.Debug("onMouseButton " + (down ? "down" : "up") + Util.Debug("onMouseButton " + (down ? "down" : "up") +
", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask); ", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask);
conf.onMouseButton(pos.x, pos.y, down, bmask); conf.onMouseButton(pos.x, pos.y, down, bmask);
...@@ -611,9 +645,9 @@ function onMouseDisable(e) { ...@@ -611,9 +645,9 @@ function onMouseDisable(e) {
evt = (e ? e : window.event); evt = (e ? e : window.event);
pos = Util.getEventPosition(e, conf.target, conf.scale); pos = Util.getEventPosition(e, conf.target, conf.scale);
/* Stop propagation if inside canvas area */ /* Stop propagation if inside canvas area */
if ((pos.x >= 0) && (pos.y >= 0) && if ((pos.realx >= 0) && (pos.realy >= 0) &&
(pos.x < conf.target.offsetWidth) && (pos.realx < conf.target.offsetWidth) &&
(pos.y < conf.target.offsetHeight)) { (pos.realy < conf.target.offsetHeight)) {
//Util.Debug("mouse event disabled"); //Util.Debug("mouse event disabled");
Util.stopEvent(e); Util.stopEvent(e);
return false; return false;
......
This diff is collapsed.
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* Licensed under MPL 2.0 (see LICENSE.txt) * Licensed under MPL 2.0 (see LICENSE.txt)
* *
* See README.md for usage and integration instructions. * See README.md for usage and integration instructions.
...@@ -102,7 +103,6 @@ var that = {}, // Public API methods ...@@ -102,7 +103,6 @@ var that = {}, // Public API methods
fb_height = 0, fb_height = 0,
fb_name = "", fb_name = "",
last_req_time = 0,
rre_chunk_sz = 100, rre_chunk_sz = 100,
timing = { timing = {
...@@ -147,9 +147,6 @@ Util.conf_defaults(conf, that, defaults, [ ...@@ -147,9 +147,6 @@ Util.conf_defaults(conf, that, defaults, [
['viewportDrag', 'rw', 'bool', false, 'Move the viewport on mouse drags'], ['viewportDrag', 'rw', 'bool', false, 'Move the viewport on mouse drags'],
['check_rate', 'rw', 'int', 217, 'Timing (ms) of send/receive check'],
['fbu_req_rate', 'rw', 'int', 1413, 'Timing (ms) of frameBufferUpdate requests'],
// Callback functions // Callback functions
['onUpdateState', 'rw', 'func', function() { }, ['onUpdateState', 'rw', 'func', function() { },
'onUpdateState(rfb, state, oldstate, statusMsg): RFB state update/change '], 'onUpdateState(rfb, state, oldstate, statusMsg): RFB state update/change '],
...@@ -165,6 +162,8 @@ Util.conf_defaults(conf, that, defaults, [ ...@@ -165,6 +162,8 @@ Util.conf_defaults(conf, that, defaults, [
'onFBUComplete(rfb, fbu): RFB FBU received and processed '], 'onFBUComplete(rfb, fbu): RFB FBU received and processed '],
['onFBResize', 'rw', 'func', function() { }, ['onFBResize', 'rw', 'func', function() { },
'onFBResize(rfb, width, height): frame buffer resized'], 'onFBResize(rfb, width, height): frame buffer resized'],
['onDesktopName', 'rw', 'func', function() { },
'onDesktopName(rfb, name): desktop name received'],
// These callback names are deprecated // These callback names are deprecated
['updateState', 'rw', 'func', function() { }, ['updateState', 'rw', 'func', function() { },
...@@ -400,7 +399,7 @@ updateState = function(state, statusMsg) { ...@@ -400,7 +399,7 @@ updateState = function(state, statusMsg) {
} }
if (msgTimer) { if (msgTimer) {
clearInterval(msgTimer); clearTimeout(msgTimer);
msgTimer = null; msgTimer = null;
} }
...@@ -441,13 +440,13 @@ updateState = function(state, statusMsg) { ...@@ -441,13 +440,13 @@ updateState = function(state, statusMsg) {
if (connTimer && (rfb_state !== 'connect')) { if (connTimer && (rfb_state !== 'connect')) {
Util.Debug("Clearing connect timer"); Util.Debug("Clearing connect timer");
clearInterval(connTimer); clearTimeout(connTimer);
connTimer = null; connTimer = null;
} }
if (disconnTimer && (rfb_state !== 'disconnect')) { if (disconnTimer && (rfb_state !== 'disconnect')) {
Util.Debug("Clearing disconnect timer"); Util.Debug("Clearing disconnect timer");
clearInterval(disconnTimer); clearTimeout(disconnTimer);
disconnTimer = null; disconnTimer = null;
} }
...@@ -566,44 +565,18 @@ function genDES(password, challenge) { ...@@ -566,44 +565,18 @@ function genDES(password, challenge) {
return (new DES(passwd)).encrypt(challenge); return (new DES(passwd)).encrypt(challenge);
} }
function flushClient() {
if (mouse_arr.length > 0) {
//send(mouse_arr.concat(fbUpdateRequests()));
ws.send(mouse_arr);
setTimeout(function() {
ws.send(fbUpdateRequests());
}, 50);
mouse_arr = [];
return true;
} else {
return false;
}
}
// overridable for testing // overridable for testing
checkEvents = function() { checkEvents = function() {
var now; if (rfb_state === 'normal' && !viewportDragging && mouse_arr.length > 0) {
if (rfb_state === 'normal' && !viewportDragging) { ws.send(mouse_arr);
if (! flushClient()) { mouse_arr = [];
now = new Date().getTime();
if (now > last_req_time + conf.fbu_req_rate) {
last_req_time = now;
ws.send(fbUpdateRequests());
}
}
} }
setTimeout(checkEvents, conf.check_rate);
}; };
keyPress = function(keysym, down) { keyPress = function(keysym, down) {
var arr;
if (conf.view_only) { return; } // View only, skip keyboard events if (conf.view_only) { return; } // View only, skip keyboard events
arr = keyEvent(keysym, down); ws.send(keyEvent(keysym, down));
arr = arr.concat(fbUpdateRequests());
ws.send(arr);
}; };
mouseButton = function(x, y, down, bmask) { mouseButton = function(x, y, down, bmask) {
...@@ -622,7 +595,6 @@ mouseButton = function(x, y, down, bmask) { ...@@ -622,7 +595,6 @@ mouseButton = function(x, y, down, bmask) {
return; return;
} else { } else {
viewportDragging = false; viewportDragging = false;
ws.send(fbUpdateRequests()); // Force immediate redraw
} }
} }
...@@ -630,7 +602,8 @@ mouseButton = function(x, y, down, bmask) { ...@@ -630,7 +602,8 @@ mouseButton = function(x, y, down, bmask) {
mouse_arr = mouse_arr.concat( mouse_arr = mouse_arr.concat(
pointerEvent(display.absX(x), display.absY(y)) ); pointerEvent(display.absX(x), display.absY(y)) );
flushClient(); ws.send(mouse_arr);
mouse_arr = [];
}; };
mouseMove = function(x, y) { mouseMove = function(x, y) {
...@@ -653,7 +626,9 @@ mouseMove = function(x, y) { ...@@ -653,7 +626,9 @@ mouseMove = function(x, y) {
if (conf.view_only) { return; } // View only, skip mouse events if (conf.view_only) { return; } // View only, skip mouse events
mouse_arr = mouse_arr.concat( mouse_arr = mouse_arr.concat(
pointerEvent(display.absX(x), display.absY(y)) ); pointerEvent(display.absX(x), display.absY(y)));
checkEvents();
}; };
...@@ -873,6 +848,7 @@ init_msg = function() { ...@@ -873,6 +848,7 @@ init_msg = function() {
/* Connection name/title */ /* Connection name/title */
name_length = ws.rQshift32(); name_length = ws.rQshift32();
fb_name = ws.rQshiftStr(name_length); fb_name = ws.rQshiftStr(name_length);
conf.onDesktopName(that, fb_name);
if (conf.true_color && fb_name === "Intel(r) AMT KVM") if (conf.true_color && fb_name === "Intel(r) AMT KVM")
{ {
...@@ -896,13 +872,12 @@ init_msg = function() { ...@@ -896,13 +872,12 @@ init_msg = function() {
response = pixelFormat(); response = pixelFormat();
response = response.concat(clientEncodings()); response = response.concat(clientEncodings());
response = response.concat(fbUpdateRequests()); response = response.concat(fbUpdateRequests()); // initial fbu-request
timing.fbu_rt_start = (new Date()).getTime(); timing.fbu_rt_start = (new Date()).getTime();
timing.pixels = 0; timing.pixels = 0;
ws.send(response); ws.send(response);
/* Start pushing/polling */ checkEvents();
setTimeout(checkEvents, conf.check_rate);
if (conf.encrypt) { if (conf.encrypt) {
updateState('normal', "Connected (encrypted) to: " + fb_name); updateState('normal', "Connected (encrypted) to: " + fb_name);
...@@ -930,6 +905,10 @@ normal_msg = function() { ...@@ -930,6 +905,10 @@ normal_msg = function() {
switch (msg_type) { switch (msg_type) {
case 0: // FramebufferUpdate case 0: // FramebufferUpdate
ret = framebufferUpdate(); // false means need more data ret = framebufferUpdate(); // false means need more data
if (ret) {
// only allow one outstanding fbu-request at a time
ws.send(fbUpdateRequests());
}
break; break;
case 1: // SetColourMapEntries case 1: // SetColourMapEntries
Util.Debug("SetColourMapEntries"); Util.Debug("SetColourMapEntries");
...@@ -1592,8 +1571,6 @@ encHandlers.DesktopSize = function set_desktopsize() { ...@@ -1592,8 +1571,6 @@ encHandlers.DesktopSize = function set_desktopsize() {
conf.onFBResize(that, fb_width, fb_height); conf.onFBResize(that, fb_width, fb_height);
display.resize(fb_width, fb_height); display.resize(fb_width, fb_height);
timing.fbu_rt_start = (new Date()).getTime(); timing.fbu_rt_start = (new Date()).getTime();
// Send a new non-incremental request
ws.send(fbUpdateRequests());
FBU.bytes = 0; FBU.bytes = 0;
FBU.rects -= 1; FBU.rects -= 1;
...@@ -1819,7 +1796,6 @@ that.sendCtrlAltDel = function() { ...@@ -1819,7 +1796,6 @@ that.sendCtrlAltDel = function() {
arr = arr.concat(keyEvent(0xFFFF, 0)); // Delete arr = arr.concat(keyEvent(0xFFFF, 0)); // Delete
arr = arr.concat(keyEvent(0xFFE9, 0)); // Alt arr = arr.concat(keyEvent(0xFFE9, 0)); // Alt
arr = arr.concat(keyEvent(0xFFE3, 0)); // Control arr = arr.concat(keyEvent(0xFFE3, 0)); // Control
arr = arr.concat(fbUpdateRequests());
ws.send(arr); ws.send(arr);
}; };
...@@ -1836,7 +1812,6 @@ that.sendKey = function(code, down) { ...@@ -1836,7 +1812,6 @@ that.sendKey = function(code, down) {
arr = arr.concat(keyEvent(code, 1)); arr = arr.concat(keyEvent(code, 1));
arr = arr.concat(keyEvent(code, 0)); arr = arr.concat(keyEvent(code, 0));
} }
arr = arr.concat(fbUpdateRequests());
ws.send(arr); ws.send(arr);
}; };
......
This diff is collapsed.
...@@ -298,9 +298,11 @@ Util.getEventPosition = function (e, obj, scale) { ...@@ -298,9 +298,11 @@ Util.getEventPosition = function (e, obj, scale) {
if (typeof scale === "undefined") { if (typeof scale === "undefined") {
scale = 1; scale = 1;
} }
var x = Math.max(Math.min(docX - pos.x, obj.width-1), 0); var realx = docX - pos.x;
var y = Math.max(Math.min(docY - pos.y, obj.height-1), 0); var realy = docY - pos.y;
return {'x': x / scale, 'y': y / scale}; var x = Math.max(Math.min(realx, obj.width-1), 0);
var y = Math.max(Math.min(realy, obj.height-1), 0);
return {'x': x / scale, 'y': y / scale, 'realx': realx / scale, 'realy': realy / scale};
}; };
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<!-- <!--
noVNC example: simple example using default UI noVNC example: simple example using default UI
Copyright (C) 2012 Joel Martin Copyright (C) 2012 Joel Martin
Copyright (C) 2013 Samuel Mannehed for Cendio AB
noVNC is licensed under the MPL 2.0 (see LICENSE.txt) noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
This file is licensed under the 2-Clause BSD license (see LICENSE.txt). This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
...@@ -65,12 +66,30 @@ ...@@ -65,12 +66,30 @@
<input type="image" src="images/keyboard.png" <input type="image" src="images/keyboard.png"
id="showKeyboard" class="noVNC_status_button" id="showKeyboard" class="noVNC_status_button"
value="Keyboard" title="Show Keyboard"/> value="Keyboard" title="Show Keyboard"/>
<input type="email" <input type="text" autocapitalize="off" autocorrect="off"
autocapitalize="off" autocorrect="off" id="keyboardinput" class=""/>
id="keyboardinput" class="noVNC_status_button"/> <div id="noVNC_extra_keys">
<input type="image" src="images/showextrakeys.png"
id="showExtraKeysButton"
class="noVNC_status_button">
<input type="image" src="images/ctrl.png"
id="toggleCtrlButton"
class="noVNC_status_button">
<input type="image" src="images/alt.png"
id="toggleAltButton"
class="noVNC_status_button">
<input type="image" src="images/tab.png"
id="sendTabButton"
class="noVNC_status_button">
<input type="image" src="images/esc.png"
id="sendEscButton"
class="noVNC_status_button">
</div>
</div> </div>
</div> </div>
<div id="noVNC_status">Loading</div>
<!--noVNC Buttons--> <!--noVNC Buttons-->
<div class="noVNC-buttons-right"> <div class="noVNC-buttons-right">
<input type="image" src="images/ctrlaltdel.png" <input type="image" src="images/ctrlaltdel.png"
...@@ -106,6 +125,10 @@ ...@@ -106,6 +125,10 @@
<input id="descriptionButton" type="button" value="Close"> <input id="descriptionButton" type="button" value="Close">
</div> </div>
<!-- Popup Status Panel -->
<div id="noVNC_popup_status_panel" class="">
</div>
<!-- Clipboard Panel --> <!-- Clipboard Panel -->
<div id="noVNC_clipboard" class="triangle-right top"> <div id="noVNC_clipboard" class="triangle-right top">
<textarea id="noVNC_clipboard_text" rows=5> <textarea id="noVNC_clipboard_text" rows=5>
...@@ -163,10 +186,6 @@ ...@@ -163,10 +186,6 @@
<div id="noVNC_screen"> <div id="noVNC_screen">
<div id="noVNC_screen_pad"></div> <div id="noVNC_screen_pad"></div>
<div id="noVNC_status_bar" class="noVNC_status_bar">
<div id="noVNC_status">Loading</div>
</div>
<h1 id="noVNC_logo"><span>no</span><br />VNC</h1> <h1 id="noVNC_logo"><span>no</span><br />VNC</h1>
<!-- HTML5 Canvas --> <!-- HTML5 Canvas -->
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
<html> <html>
<head> <head>
<!-- <!--
noVNC example: simple example using default UI noVNC example: simple example using default UI
Copyright (C) 2012 Joel Martin Copyright (C) 2012 Joel Martin
Copyright (C) 2013 Samuel Mannehed for Cendio AB
noVNC is licensed under the MPL 2.0 (see LICENSE.txt) noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
This file is licensed under the 2-Clause BSD license (see LICENSE.txt). This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
...@@ -46,7 +47,9 @@ ...@@ -46,7 +47,9 @@
<div id="noVNC_screen"> <div id="noVNC_screen">
<div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;"> <div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;">
<table border=0 width="100%"><tr> <table border=0 width="100%"><tr>
<td><div id="noVNC_status">Loading</div></td> <td><div id="noVNC_status" style="position: relative; height: auto;">
Loading
</div></td>
<td width="1%"><div id="noVNC_buttons"> <td width="1%"><div id="noVNC_buttons">
<input type=button value="Send CtrlAltDel" <input type=button value="Send CtrlAltDel"
id="sendCtrlAltDelButton"> id="sendCtrlAltDelButton">
...@@ -125,12 +128,12 @@ ...@@ -125,12 +128,12 @@
// if port == 80 (or 443) then it won't be present and should be // if port == 80 (or 443) then it won't be present and should be
// set manually // set manually
if (!port) { if (!port) {
if (window.location.protocol.substring(0,4) == 'http') { if (window.location.protocol.substring(0,5) == 'https') {
port = 80;
}
else if (window.location.protocol.substring(0,5) == 'https') {
port = 443; port = 443;
} }
else if (window.location.protocol.substring(0,4) == 'http') {
port = 80;
}
} }
// If a token variable is passed in, set the parameter in a cookie. // If a token variable is passed in, set the parameter in a cookie.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment