1
0
mirror of https://github.com/fcwu/docker-ubuntu-vnc-desktop synced 2026-08-05 16:12:41 +02:00

Toolbar with scale and quality.

This commit is contained in:
Mango Liou
2016-01-05 02:49:18 +00:00
parent 6da7e3e885
commit 8dac68f2ce
10 changed files with 455 additions and 39 deletions
+47 -23
View File
@@ -35,28 +35,6 @@ var RFB;
this._rfb_tightvnc = false;
this._rfb_xvp_ver = 0;
// In preference order
this._encodings = [
['COPYRECT', 0x01 ],
['TIGHT', 0x07 ],
['TIGHT_PNG', -260 ],
['HEXTILE', 0x05 ],
['RRE', 0x02 ],
['RAW', 0x00 ],
['DesktopSize', -223 ],
['Cursor', -239 ],
// Psuedo-encoding settings
//['JPEG_quality_lo', -32 ],
['JPEG_quality_med', -26 ],
//['JPEG_quality_hi', -23 ],
//['compress_lo', -255 ],
['compress_hi', -247 ],
['last_rect', -224 ],
['xvp', -309 ],
['ExtendedDesktopSize', -308 ]
];
this._encHandlers = {};
this._encNames = {};
this._encStats = {};
@@ -131,7 +109,6 @@ var RFB;
'wsProtocols': ['binary', 'base64'], // Protocols to use in the WebSocket connection
'repeaterID': '', // [UltraVNC] RepeaterID to connect to
'viewportDrag': false, // Move the viewport on mouse drags
// Callback functions
'onUpdateState': function () { }, // onUpdateState(rfb, state, oldstate, statusMsg): state update/change
'onPasswordRequired': function () { }, // onPasswordRequired(rfb): VNC password is required
@@ -144,6 +121,53 @@ var RFB;
'onXvpInit': function () { }, // onXvpInit(version): XVP extensions active for this connection
});
try{
// Use my custom 'jpeg_quality'.
this._encodings = [
// ['COPYRECT', 0x01 ],
['TIGHT', 0x07 ],
['TIGHT_PNG', -260 ],
['HEXTILE', 0x05 ],
['RRE', 0x02 ],
['RAW', 0x00 ],
['DesktopSize', -223 ],
['Cursor', -239 ],
// Psuedo-encoding settings
['JPEG_quality_lo', -32 + jpeg_quality ],
// ['JPEG_quality_med', -28 ],
// ['JPEG_quality_hi', -23 ],
// ['compress_lo', -255 ],
['compress_hi', -247 ],
['last_rect', -224 ],
['xvp', -309 ],
['ExtendedDesktopSize', -308 ]
];
}
catch(e){
// If my custom 'jpeg_quality' is not defined, just use default setting.
this._encodings = [
['COPYRECT', 0x01 ],
['TIGHT', 0x07 ],
['TIGHT_PNG', -260 ],
['HEXTILE', 0x05 ],
['RRE', 0x02 ],
['RAW', 0x00 ],
['DesktopSize', -223 ],
['Cursor', -239 ],
// Psuedo-encoding settings
//['JPEG_quality_lo', -32 ],
['JPEG_quality_med', -26 ],
//['JPEG_quality_hi', -23 ],
//['compress_lo', -255 ],
['compress_hi', -247 ],
['last_rect', -224 ],
['xvp', -309 ],
['ExtendedDesktopSize', -308 ]
];
}
// main setup
Util.Debug(">> RFB.constructor");
+10 -1
View File
@@ -468,7 +468,16 @@ Util.getEventPosition = function (e, obj, scale) {
var realy = docY - pos.y;
var x = Math.max(Math.min(realx, pos.width - 1), 0);
var y = Math.max(Math.min(realy, pos.height - 1), 0);
return {'x': x / scale, 'y': y / scale, 'realx': realx / scale, 'realy': realy / scale};
try{
// Use my custom 'Scale' rate.
return {'x': x / Scale.x, 'y': y / Scale.y, 'realx': realx / Scale.x, 'realy': realy / Scale.y};
}
catch(e){
// If my custom 'Scale' is not defined, just use default 'scale'.
return {'x': x / scale, 'y': y / scale, 'realx': realx / scale, 'realy': realy / scale};
}
};