diff --git a/README b/README index 89d3747..6443000 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ Instructions and status as of August, 2016. Requirements: 1. Modern Firefox or Chrome (IE will work, but badly) - + 2. A WebSocket proxy websockify: @@ -24,7 +24,7 @@ Optional: With firefox, you can just open file:///your-path-to-spice.html-here - With Chrome, you have to set a secret config flag to do that, or + With Chrome, you have to set a secret config flag to do that, or serve the files from a web server. diff --git a/TODO b/TODO index 4d4b115..64fc326 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,7 @@ Medium Tasks: *only* about messages) . Change the message processing to be able to handle - an array of ArrayBuffers so we don't have to + an array of ArrayBuffers so we don't have to use the combine function, which is presumed slow. . Use the 'real' DataView if we have it diff --git a/cursor.js b/cursor.js index 296fbde..d3f4d55 100644 --- a/cursor.js +++ b/cursor.js @@ -118,7 +118,7 @@ SpiceCursorConn.prototype.process_channel_message = function(msg) SpiceCursorConn.prototype.set_cursor = function(cursor) { var pngstr = create_rgba_png(cursor.header.height, cursor.header.width, cursor.data); - var curstr = 'url(data:image/png,' + pngstr + ') ' + + var curstr = 'url(data:image/png,' + pngstr + ') ' + cursor.header.hot_spot_x + ' ' + cursor.header.hot_spot_y + ", default"; var screen = document.getElementById(this.parent.screen_id); screen.style.cursor = 'auto'; diff --git a/display.js b/display.js index 12fbab0..d8239c2 100644 --- a/display.js +++ b/display.js @@ -142,7 +142,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg) { base: draw_copy.base, src_area: draw_copy.data.src_area, image_data: this.cache[draw_copy.data.src_bitmap.descriptor.id], - tag: "copycache." + draw_copy.data.src_bitmap.descriptor.id, + tag: "copycache." + draw_copy.data.src_bitmap.descriptor.id, has_alpha: true, /* FIXME - may want this to be false... */ descriptor : draw_copy.data.src_bitmap.descriptor }); @@ -200,7 +200,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg) tmpstr += qdv[i].toString(16); } - img.o = + img.o = { base: draw_copy.base, tag: "jpeg." + draw_copy.data.src_bitmap.surface_id, descriptor : draw_copy.data.src_bitmap.descriptor, @@ -233,7 +233,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg) tmpstr += qdv[i].toString(16); } - img.o = + img.o = { base: draw_copy.base, tag: "jpeg." + draw_copy.data.src_bitmap.surface_id, descriptor : draw_copy.data.src_bitmap.descriptor, @@ -265,7 +265,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg) draw_copy.data.src_bitmap.bitmap); if (! source_img) { - this.log_warn("FIXME: Unable to interpret bitmap of format: " + + this.log_warn("FIXME: Unable to interpret bitmap of format: " + draw_copy.data.src_bitmap.bitmap.format); return false; } @@ -295,7 +295,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg) draw_copy.data.src_bitmap.lz_rgb); if (! source_img) { - this.log_warn("FIXME: Unable to interpret bitmap of type: " + + this.log_warn("FIXME: Unable to interpret bitmap of type: " + draw_copy.data.src_bitmap.lz_rgb.type); return false; } @@ -359,7 +359,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg) draw_fill.base.box.bottom - draw_fill.base.box.top); document.getElementById(this.parent.dump_id).appendChild(debug_canvas); } - + this.surfaces[draw_fill.base.surface_id].draw_count++; } @@ -484,9 +484,9 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg) this.surfaces = []; var m = new SpiceMsgSurfaceCreate(msg.data); - DEBUG > 1 && console.log(this.type + ": MsgSurfaceCreate id " + m.surface.surface_id + DEBUG > 1 && console.log(this.type + ": MsgSurfaceCreate id " + m.surface.surface_id + "; " + m.surface.width + "x" + m.surface.height - + "; format " + m.surface.format + + "; format " + m.surface.format + "; flags " + m.surface.flags); if (m.surface.format != SPICE_SURFACE_FMT_32_xRGB && m.surface.format != SPICE_SURFACE_FMT_32_ARGB) @@ -745,7 +745,7 @@ SpiceDisplayConn.prototype.draw_copy_helper = function(o) SpiceDisplayConn.prototype.log_draw = function(prefix, draw) { var str = prefix + "." + draw.base.surface_id + "." + this.surfaces[draw.base.surface_id].draw_count + ": "; - str += "base.box " + draw.base.box.left + ", " + draw.base.box.top + " to " + + str += "base.box " + draw.base.box.left + ", " + draw.base.box.top + " to " + draw.base.box.right + ", " + draw.base.box.bottom; str += "; clip.type " + draw.base.clip.type; @@ -763,12 +763,12 @@ SpiceDisplayConn.prototype.log_draw = function(prefix, draw) if (draw.data.src_bitmap.surface_id !== undefined) str += "; src_bitmap surface_id " + draw.data.src_bitmap.surface_id; if (draw.data.src_bitmap.quic) - str += "; QUIC type " + draw.data.src_bitmap.quic.type + - "; width " + draw.data.src_bitmap.quic.width + + str += "; QUIC type " + draw.data.src_bitmap.quic.type + + "; width " + draw.data.src_bitmap.quic.width + "; height " + draw.data.src_bitmap.quic.height ; if (draw.data.src_bitmap.lz_rgb) str += "; LZ_RGB length " + draw.data.src_bitmap.lz_rgb.length + - "; magic " + draw.data.src_bitmap.lz_rgb.magic + + "; magic " + draw.data.src_bitmap.lz_rgb.magic + "; version 0x" + draw.data.src_bitmap.lz_rgb.version.toString(16) + "; type " + draw.data.src_bitmap.lz_rgb.type + "; width " + draw.data.src_bitmap.lz_rgb.width + @@ -885,7 +885,7 @@ function handle_draw_jpeg_onload() { // This can happen; if the jpeg image loads after our surface // has been destroyed (e.g. open a menu, close it quickly), - // we'll find we have no surface. + // we'll find we have no surface. DEBUG > 2 && this.o.sc.log_info("Discarding jpeg; presumed lost surface " + this.o.base.surface_id); temp_canvas = document.createElement("canvas"); temp_canvas.setAttribute('width', this.o.base.box.right); @@ -904,16 +904,16 @@ function handle_draw_jpeg_onload() t.putImageData(this.alpha_img, 0, 0); t.globalCompositeOperation = 'source-in'; t.drawImage(this, 0, 0); - + context.drawImage(c, this.o.base.box.left, this.o.base.box.top); - if (this.o.descriptor && + if (this.o.descriptor && (this.o.descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME)) { if (! ("cache" in this.o.sc)) this.o.sc.cache = {}; - this.o.sc.cache[this.o.descriptor.id] = + this.o.sc.cache[this.o.descriptor.id] = t.getImageData(0, 0, this.alpha_img.width, this.alpha_img.height); @@ -927,13 +927,13 @@ function handle_draw_jpeg_onload() // fairly massive memory leaks during video playback this.src = null; - if (this.o.descriptor && + if (this.o.descriptor && (this.o.descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME)) { if (! ("cache" in this.o.sc)) this.o.sc.cache = {}; - this.o.sc.cache[this.o.descriptor.id] = + this.o.sc.cache[this.o.descriptor.id] = context.getImageData(this.o.base.box.left, this.o.base.box.top, this.o.base.box.right - this.o.base.box.left, this.o.base.box.bottom - this.o.base.box.top); diff --git a/enums.js b/enums.js index 3ef36dc..301fea0 100644 --- a/enums.js +++ b/enums.js @@ -264,7 +264,7 @@ var SPICE_MOUSE_BUTTON_MASK_LEFT = (1 << 0), SPICE_MOUSE_BUTTON_MASK_MIDDLE = (1 << 1), SPICE_MOUSE_BUTTON_MASK_RIGHT = (1 << 2), SPICE_MOUSE_BUTTON_MASK_MASK = 0x7; - + var SPICE_MOUSE_BUTTON_INVALID = 0; var SPICE_MOUSE_BUTTON_LEFT = 1; var SPICE_MOUSE_BUTTON_MIDDLE = 2; diff --git a/main.js b/main.js index afe69bf..874a038 100644 --- a/main.js +++ b/main.js @@ -22,7 +22,7 @@ ** SpiceMainConn ** This is the master Javascript class for establishing and ** managing a connection to a Spice Server. -** +** ** Invocation: You must pass an object with properties as follows: ** uri (required) Uri of a WebSocket listener that is ** connected to a spice server. diff --git a/playback.js b/playback.js index 53b6983..e5f4661 100644 --- a/playback.js +++ b/playback.js @@ -114,7 +114,7 @@ SpicePlaybackConn.prototype.process_channel_message = function(msg) if (this.last_data_time && data.time >= (this.last_data_time + GAP_DETECTION_THRESHOLD)) { this.skip_until = data.time; - this.gap_time = (data.time - this.start_time) - + this.gap_time = (data.time - this.start_time) - (this.source_buffer.buffered.end(this.source_buffer.buffered.end.length - 1) * 1000.0).toFixed(0); } diff --git a/simulatecursor.js b/simulatecursor.js index b1fce06..ffd9089 100644 --- a/simulatecursor.js +++ b/simulatecursor.js @@ -71,7 +71,7 @@ simulate_cursor: function (spicecursor, cursor, screen, pngstr) if (window.getComputedStyle(screen, null).cursor == 'auto') { - SpiceSimulateCursor.unknown_cursor(cursor_sha, + SpiceSimulateCursor.unknown_cursor(cursor_sha, SpiceSimulateCursor.create_icondir(cursor.header.width, cursor.header.height, cursor.data.byteLength, cursor.header.hot_spot_x, cursor.header.hot_spot_y) + pngstr); @@ -99,7 +99,7 @@ simulate_cursor: function (spicecursor, cursor, screen, pngstr) spicecursor.spice_simulated_cursor.style.pointerEvents = "none"; } else - { + { if (spicecursor.spice_simulated_cursor) { spicecursor.spice_simulated_cursor.spice_screen.removeChild(spicecursor.spice_simulated_cursor); @@ -162,7 +162,7 @@ create_icondir: function (width, height, bytes, hot_x, hot_y) }; -SpiceSimulateCursor.ICONDIR.prototype = +SpiceSimulateCursor.ICONDIR.prototype = { to_buffer: function(a, at) { diff --git a/spice.css b/spice.css index 5d092ba..ee1b2f3 100644 --- a/spice.css +++ b/spice.css @@ -115,4 +115,3 @@ body .spice-message-error { color: red; } - diff --git a/spice.html b/spice.html index f2f9ed0..c473678 100644 --- a/spice.html +++ b/spice.html @@ -28,26 +28,26 @@