Commit 3b20e7a9 authored by Joel Martin's avatar Joel Martin

rfb.js, canvas.js: status feedback on Canvas functionality.

Read the render mode selected by canvas and report it in the initial
page loaded status message.
parent 562beccf
...@@ -46,6 +46,8 @@ cdef('focused', 'bool', true, 'Capture and send key strokes'); ...@@ -46,6 +46,8 @@ cdef('focused', 'bool', true, 'Capture and send key strokes');
cdef('colourMap', 'raw', [], 'Colour map array (not true color)'); cdef('colourMap', 'raw', [], 'Colour map array (not true color)');
cdef('scale', 'float', 1, 'VNC viewport scale factor'); cdef('scale', 'float', 1, 'VNC viewport scale factor');
cdef('render_mode', 'str', '', 'Canvas rendering mode (read-only)');
// Override some specific getters/setters // Override some specific getters/setters
that.set_prefer_js = function(val) { that.set_prefer_js = function(val) {
if (val && c_forceCanvas) { if (val && c_forceCanvas) {
...@@ -72,6 +74,8 @@ that.set_colourMap = function(val, idx) { ...@@ -72,6 +74,8 @@ that.set_colourMap = function(val, idx) {
} }
}; };
that.set_render_mode = function () { throw("render_mode is read-only"); };
// Add some other getters/setters // Add some other getters/setters
that.get_width = function() { that.get_width = function() {
return c_width; return c_width;
...@@ -135,9 +139,12 @@ function constructor() { ...@@ -135,9 +139,12 @@ function constructor() {
if (ctx.createImageData) { if (ctx.createImageData) {
// If it's there, it's faster // If it's there, it's faster
Util.Info("Using Canvas createImageData"); Util.Info("Using Canvas createImageData");
conf.render_mode = "createImageData rendering";
that.imageData = that.imageDataCreate; that.imageData = that.imageDataCreate;
} else if (ctx.getImageData) { } else if (ctx.getImageData) {
// I think this is mostly just Opera
Util.Info("Using Canvas getImageData"); Util.Info("Using Canvas getImageData");
conf.render_mode = "getImageData rendering";
that.imageData = that.imageDataGet; that.imageData = that.imageDataGet;
} }
Util.Info("Prefering javascript operations"); Util.Info("Prefering javascript operations");
...@@ -148,6 +155,7 @@ function constructor() { ...@@ -148,6 +155,7 @@ function constructor() {
that.cmapImage = that.cmapImageData; that.cmapImage = that.cmapImageData;
} else { } else {
Util.Warn("Canvas lacks imageData, using fillRect (slow)"); Util.Warn("Canvas lacks imageData, using fillRect (slow)");
conf.render_mode = "fillRect rendering (slow)";
c_forceCanvas = true; c_forceCanvas = true;
conf.prefer_js = false; conf.prefer_js = false;
that.rgbxImage = that.rgbxImageFill; that.rgbxImage = that.rgbxImageFill;
......
...@@ -209,7 +209,7 @@ function rQshiftBytes(len) { ...@@ -209,7 +209,7 @@ function rQshiftBytes(len) {
// Create the public API interface and initialize // Create the public API interface and initialize
function constructor() { function constructor() {
var i; var i, rmode;
Util.Debug(">> RFB.constructor"); Util.Debug(">> RFB.constructor");
// Create lookup tables based encoding number // Create lookup tables based encoding number
...@@ -225,13 +225,14 @@ function constructor() { ...@@ -225,13 +225,14 @@ function constructor() {
Util.Error("Canvas exception: " + exc); Util.Error("Canvas exception: " + exc);
updateState('fatal', "No working Canvas"); updateState('fatal', "No working Canvas");
} }
rmode = canvas.get_render_mode();
init_vars(); init_vars();
/* Check web-socket-js if no builtin WebSocket support */ /* Check web-socket-js if no builtin WebSocket support */
if (VNC_native_ws) { if (VNC_native_ws) {
Util.Info("Using native WebSockets"); Util.Info("Using native WebSockets");
updateState('loaded', 'noVNC ready (using native WebSockets)'); updateState('loaded', 'noVNC ready: native WebSockets, ' + rmode);
} else { } else {
Util.Warn("Using web-socket-js flash bridge"); Util.Warn("Using web-socket-js flash bridge");
if ((! Util.Flash) || if ((! Util.Flash) ||
...@@ -241,7 +242,7 @@ function constructor() { ...@@ -241,7 +242,7 @@ function constructor() {
updateState('fatal', updateState('fatal',
"'file://' URL is incompatible with Adobe Flash"); "'file://' URL is incompatible with Adobe Flash");
} else { } else {
updateState('loaded', 'noVNC ready (using Flash WebSockets emulation)'); updateState('loaded', 'noVNC ready: WebSockets emulation, ' + rmode);
} }
} }
......
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