--- README | 4 ++-- TODO | 2 +- cursor.js | 2 +- display.js | 36 ++++++++++++++++++------------------ enums.js | 2 +- main.js | 2 +- playback.js | 2 +- simulatecursor.js | 6 +++--- spice.css | 1 - spice.html | 40 ++++++++++++++++++++-------------------- spice_auto.html | 2 +- spicedataview.js | 8 ++++---- spicemsg.js | 6 +++--- spicetype.js | 2 +- thirdparty/jsbn.js | 6 +++--- thirdparty/prng4.js | 6 +++--- thirdparty/rng.js | 8 ++++---- thirdparty/rsa.js | 6 +++--- wire.js | 2 +- 19 files changed, 71 insertions(+), 72 deletions(-) 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 @@ <head> <title>Spice Javascript client</title> - <script src="spicearraybuffer.js"></script> - <script src="enums.js"></script> - <script src="atKeynames.js"></script> - <script src="utils.js"></script> - <script src="png.js"></script> - <script src="lz.js"></script> - <script src="quic.js"></script> - <script src="bitmap.js"></script> - <script src="spicedataview.js"></script> - <script src="spicetype.js"></script> - <script src="spicemsg.js"></script> - <script src="wire.js"></script> - <script src="spiceconn.js"></script> - <script src="display.js"></script> - <script src="main.js"></script> - <script src="inputs.js"></script> + <script src="spicearraybuffer.js"></script> + <script src="enums.js"></script> + <script src="atKeynames.js"></script> + <script src="utils.js"></script> + <script src="png.js"></script> + <script src="lz.js"></script> + <script src="quic.js"></script> + <script src="bitmap.js"></script> + <script src="spicedataview.js"></script> + <script src="spicetype.js"></script> + <script src="spicemsg.js"></script> + <script src="wire.js"></script> + <script src="spiceconn.js"></script> + <script src="display.js"></script> + <script src="main.js"></script> + <script src="inputs.js"></script> <script src="webm.js"></script> <script src="playback.js"></script> <script src="simulatecursor.js"></script> - <script src="cursor.js"></script> + <script src="cursor.js"></script> <script src="thirdparty/jsbn.js"></script> <script src="thirdparty/rsa.js"></script> <script src="thirdparty/prng4.js"></script> @@ -71,8 +71,8 @@ { var host, port, password, scheme = "ws://", uri; - host = document.getElementById("host").value; - port = document.getElementById("port").value; + host = document.getElementById("host").value; + port = document.getElementById("port").value; password = document.getElementById("password").value; @@ -92,7 +92,7 @@ try { - sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", dump_id: "debug-div", + sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", dump_id: "debug-div", message_id: "message-div", password: password, onerror: spice_error, onagent: agent_connected }); } catch (e) diff --git a/spice_auto.html b/spice_auto.html index 9aae118..1179ebe 100644 --- a/spice_auto.html +++ b/spice_auto.html @@ -28,7 +28,7 @@ <head> <title>Spice Javascript client</title> - <script src="spicearraybuffer.js"></script> + <script src="spicearraybuffer.js"></script> <script src="enums.js"></script> <script src="atKeynames.js"></script> <script src="utils.js"></script> diff --git a/spicedataview.js b/spicedataview.js index 800df03..719d968 100644 --- a/spicedataview.js +++ b/spicedataview.js @@ -20,10 +20,10 @@ /*---------------------------------------------------------------------------- ** SpiceDataView -** FIXME FIXME +** FIXME FIXME ** This is used because Firefox does not have DataView yet. -** We should use DataView if we have it, because it *has* to -** be faster than this code +** We should use DataView if we have it, because it *has* to +** be faster than this code **--------------------------------------------------------------------------*/ function SpiceDataView(buffer, byteOffset, byteLength) { @@ -63,7 +63,7 @@ SpiceDataView.prototype = { high = 2; } - return (this.getUint16(byteOffset + high, littleEndian) << 16) | + return (this.getUint16(byteOffset + high, littleEndian) << 16) | this.getUint16(byteOffset + low, littleEndian); }, getUint64: function (byteOffset, littleEndian) diff --git a/spicemsg.js b/spicemsg.js index db6625a..0321cc7 100644 --- a/spicemsg.js +++ b/spicemsg.js @@ -21,7 +21,7 @@ /*---------------------------------------------------------------------------- ** Spice messages ** This file contains classes for passing messages to and from -** a spice server. This file should arguably be generated from +** a spice server. This file should arguably be generated from ** spice.proto, but it was instead put together by hand. **--------------------------------------------------------------------------*/ function SpiceLinkHeader(a, at) @@ -63,7 +63,7 @@ SpiceLinkHeader.prototype = dv.setUint32(at, this.size, true); at += 4; }, buffer_size: function() - { + { return 16; }, } @@ -938,7 +938,7 @@ function SpiceMsgcMousePosition(sc, e) this.x = e.clientX - sc.display.surfaces[sc.display.primary_surface].canvas.offsetLeft + scrollLeft; this.y = e.clientY - sc.display.surfaces[sc.display.primary_surface].canvas.offsetTop + scrollTop; sc.mousex = this.x; - sc.mousey = this.y; + sc.mousey = this.y; } else { diff --git a/spicetype.js b/spicetype.js index 951b277..e145abc 100644 --- a/spicetype.js +++ b/spicetype.js @@ -469,5 +469,5 @@ SpiceSurface.prototype = }, } -/* FIXME - SpiceImage types lz_plt, jpeg, zlib_glz, and jpeg_alpha are +/* FIXME - SpiceImage types lz_plt, jpeg, zlib_glz, and jpeg_alpha are completely unimplemented */ diff --git a/thirdparty/jsbn.js b/thirdparty/jsbn.js index 9b9476e..d88ec54 100644 --- a/thirdparty/jsbn.js +++ b/thirdparty/jsbn.js @@ -15,9 +15,9 @@ * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER diff --git a/thirdparty/prng4.js b/thirdparty/prng4.js index 4715372..ef3efd6 100644 --- a/thirdparty/prng4.js +++ b/thirdparty/prng4.js @@ -15,9 +15,9 @@ * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER diff --git a/thirdparty/rng.js b/thirdparty/rng.js index 829a23c..efbf382 100644 --- a/thirdparty/rng.js +++ b/thirdparty/rng.js @@ -15,9 +15,9 @@ * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER @@ -66,7 +66,7 @@ if(rng_pool == null) { var z = window.crypto.random(32); for(t = 0; t < z.length; ++t) rng_pool[rng_pptr++] = z.charCodeAt(t) & 255; - } + } while(rng_pptr < rng_psize) { // extract some randomness from Math.random() t = Math.floor(65536 * Math.random()); rng_pool[rng_pptr++] = t >>> 8; diff --git a/thirdparty/rsa.js b/thirdparty/rsa.js index 1bbf249..ea0e45b 100644 --- a/thirdparty/rsa.js +++ b/thirdparty/rsa.js @@ -15,9 +15,9 @@ * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER diff --git a/wire.js b/wire.js index 7407ce7..2c7f096 100644 --- a/wire.js +++ b/wire.js @@ -96,7 +96,7 @@ SpiceWireReader.prototype = this.callback.call(this.sc, mb, this.saved_msg_header || undefined); } - + }, request: function(n) -- 2.9.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel