API changes. Client cursor and settings menu.
The following API changes may affect integrators:
- Settings have been moved out of the RFB.connect() call. Each
setting now has it's own setter function: setEncrypt, setBase64,
setTrueColor, setCursor.
- Encrypt and cursor settings now default to on.
- CSS changes:
- VNC_status_bar for input buttons switched to a element class.
- VNC_buttons split into VNC_buttons_right and
VNC_buttons_left
- New id styles for VNC_settings_menu and VNC_setting
Note: the encrypt, true_color and cursor, logging setting can all be
set on load using query string variables (in addition to host, port
and password).
Client cursor (cursor pseudo-encoding) support has been polished and
activated.
The RFB settings are now presented as radio button list items in
a drop-down "Settings" menu when using the default controls.
Also, in the settings menu is the ability to select between alternate
style-sheets.
Cookie and stylesheet selection support added to util.js.
This commit is contained in:
+64
-35
@@ -61,11 +61,11 @@ RFB = {
|
||||
host : '',
|
||||
port : 5900,
|
||||
password : '',
|
||||
|
||||
encrypt : true,
|
||||
true_color : false,
|
||||
|
||||
b64encode : true, // false means UTF-8 on the wire
|
||||
//b64encode : false, // false means UTF-8 on the wire
|
||||
local_cursor : true,
|
||||
connectTimeout : 2000, // time to wait for connection
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ encodings : [
|
||||
['RRE', 0x02, 'display_rre'],
|
||||
['RAW', 0x00, 'display_raw'],
|
||||
['DesktopSize', -223, 'set_desktopsize'],
|
||||
['Cursor', -239, 'set_cursor'],
|
||||
|
||||
// Psuedo-encoding settings
|
||||
['JPEG_quality_lo', -32, 'set_jpeg_quality'],
|
||||
@@ -85,9 +86,6 @@ encodings : [
|
||||
// ['compress_hi', -247, 'set_compress_level']
|
||||
],
|
||||
|
||||
encodingCursor :
|
||||
['Cursor', -239, 'set_cursor'],
|
||||
|
||||
|
||||
setUpdateState: function(externalUpdateState) {
|
||||
RFB.externalUpdateState = externalUpdateState;
|
||||
@@ -101,6 +99,43 @@ setCanvasID: function(canvasID) {
|
||||
RFB.canvasID = canvasID;
|
||||
},
|
||||
|
||||
setEncrypt: function(encrypt) {
|
||||
if ((!encrypt) || (encrypt in {'0':1, 'no':1, 'false':1})) {
|
||||
RFB.encrypt = false;
|
||||
} else {
|
||||
RFB.encrypt = true;
|
||||
}
|
||||
},
|
||||
|
||||
setBase64: function(b64) {
|
||||
if ((!b64) || (b64 in {'0':1, 'no':1, 'false':1})) {
|
||||
RFB.b64encode = false;
|
||||
} else {
|
||||
RFB.b64encode = true;
|
||||
}
|
||||
Util.Debug("Set b64encode to: " + RFB.b64encode);
|
||||
},
|
||||
|
||||
setTrueColor: function(trueColor) {
|
||||
if ((!trueColor) || (trueColor in {'0':1, 'no':1, 'false':1})) {
|
||||
RFB.true_color = false;
|
||||
} else {
|
||||
RFB.true_color = true;
|
||||
}
|
||||
},
|
||||
|
||||
setCursor: function(cursor) {
|
||||
if ((!cursor) || (cursor in {'0':1, 'no':1, 'false':1})) {
|
||||
RFB.local_cursor = false;
|
||||
} else {
|
||||
if (Canvas.isCursor()) {
|
||||
RFB.local_cursor = true;
|
||||
} else {
|
||||
Util.Warn("Browser does not support local cursor");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
sendPassword: function(passwd) {
|
||||
RFB.password = passwd;
|
||||
RFB.state = "Authentication";
|
||||
@@ -149,14 +184,6 @@ load: function () {
|
||||
RFB.updateState('fatal', "No working Canvas");
|
||||
}
|
||||
|
||||
// Add Cursor pseudo-encoding if supported
|
||||
/*
|
||||
if (Canvas.isCursor()) {
|
||||
Util.Debug("Adding Cursor pseudo-encoding to encoding list");
|
||||
RFB.encodings.push(RFB.encodingCursor);
|
||||
}
|
||||
*/
|
||||
|
||||
// Populate encoding lookup tables
|
||||
RFB.encHandlers = {};
|
||||
RFB.encNames = {};
|
||||
@@ -167,24 +194,12 @@ load: function () {
|
||||
//Util.Debug("<< load");
|
||||
},
|
||||
|
||||
connect: function (host, port, password, encrypt, true_color) {
|
||||
connect: function (host, port, password) {
|
||||
//Util.Debug(">> connect");
|
||||
|
||||
RFB.host = host;
|
||||
RFB.port = port;
|
||||
RFB.password = (password !== undefined) ? password : "";
|
||||
RFB.encrypt = (encrypt !== undefined) ? encrypt : true;
|
||||
if ((RFB.encrypt === "0") ||
|
||||
(RFB.encrypt === "no") ||
|
||||
(RFB.encrypt === "false")) {
|
||||
RFB.encrypt = false;
|
||||
}
|
||||
RFB.true_color = (true_color !== undefined) ? true_color: true;
|
||||
if ((RFB.true_color === "0") ||
|
||||
(RFB.true_color === "no") ||
|
||||
(RFB.true_color === "false")) {
|
||||
RFB.true_color = false;
|
||||
}
|
||||
|
||||
if ((!RFB.host) || (!RFB.port)) {
|
||||
RFB.updateState('failed', "Must set host and port");
|
||||
@@ -501,7 +516,11 @@ init_msg: function () {
|
||||
RFB.timing.history_start = (new Date()).getTime();
|
||||
setTimeout(RFB.update_timings, 1000);
|
||||
|
||||
RFB.updateState('normal', "Connected to: " + RFB.fb_name);
|
||||
if (RFB.encrypt) {
|
||||
RFB.updateState('normal', "Connected (encrypted) to: " + RFB.fb_name);
|
||||
} else {
|
||||
RFB.updateState('normal', "Connected (unencrypted) to: " + RFB.fb_name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
//Util.Debug("<< init_msg");
|
||||
@@ -1051,9 +1070,9 @@ set_cursor: function () {
|
||||
|
||||
//Util.Debug(" set_cursor, x: " + x + ", y: " + y + ", w: " + w + ", h: " + h);
|
||||
|
||||
Canvas.setCursor(RFB.RQ.shiftBytes(pixelslength),
|
||||
RFB.RQ.shiftBytes(masklength),
|
||||
x, y, w, h);
|
||||
Canvas.changeCursor(RFB.RQ.shiftBytes(pixelslength),
|
||||
RFB.RQ.shiftBytes(masklength),
|
||||
x, y, w, h);
|
||||
|
||||
RFB.FBU.bytes = 0;
|
||||
RFB.FBU.rects -= 1;
|
||||
@@ -1104,14 +1123,24 @@ fixColourMapEntries: function () {
|
||||
|
||||
clientEncodings: function () {
|
||||
//Util.Debug(">> clientEncodings");
|
||||
var arr, i;
|
||||
var arr, i, encList = [];
|
||||
|
||||
for (i=0; i<RFB.encodings.length; i += 1) {
|
||||
if ((RFB.encodings[i][0] === "Cursor") &&
|
||||
(! RFB.local_cursor)) {
|
||||
Util.Debug("Skipping Cursor pseudo-encoding");
|
||||
} else {
|
||||
//Util.Debug("Adding encoding: " + RFB.encodings[i][0]);
|
||||
encList.push(RFB.encodings[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
arr = [2]; // msg-type
|
||||
arr.push8(0); // padding
|
||||
|
||||
arr.push16(RFB.encodings.length); // encoding count
|
||||
|
||||
for (i=0; i<RFB.encodings.length; i += 1) {
|
||||
arr.push32(RFB.encodings[i][1]);
|
||||
arr.push16(encList.length); // encoding count
|
||||
for (i=0; i < encList.length; i += 1) {
|
||||
arr.push32(encList[i]);
|
||||
}
|
||||
//Util.Debug("<< clientEncodings: " + arr);
|
||||
return arr;
|
||||
|
||||
Reference in New Issue
Block a user