mirror of
				https://github.com/retspen/webvirtcloud
				synced 2025-07-31 12:41:08 +00:00 
			
		
		
		
	update spice-html5 packages to release 0.30
This commit is contained in:
		
							parent
							
								
									7bb5d6f313
								
							
						
					
					
						commit
						d0e3c11ccf
					
				
					 37 changed files with 236 additions and 138 deletions
				
			
		
							
								
								
									
										0
									
								
								static/js/spice-html5/atKeynames.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/atKeynames.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/bitmap.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/bitmap.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/cursor.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/cursor.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										7
									
								
								static/js/spice-html5/display.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										7
									
								
								static/js/spice-html5/display.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -559,6 +559,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
 | 
			
		|||
            var v = document.createElement("video");
 | 
			
		||||
            v.src = window.URL.createObjectURL(media);
 | 
			
		||||
 | 
			
		||||
            v.setAttribute('muted', true);
 | 
			
		||||
            v.setAttribute('autoplay', true);
 | 
			
		||||
            v.setAttribute('width', m.stream_width);
 | 
			
		||||
            v.setAttribute('height', m.stream_height);
 | 
			
		||||
| 
						 | 
				
			
			@ -571,7 +572,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
 | 
			
		|||
                top += this.surfaces[m.surface_id].canvas.offsetTop;
 | 
			
		||||
            }
 | 
			
		||||
            document.getElementById(this.parent.screen_id).appendChild(v);
 | 
			
		||||
            v.setAttribute('style', "position: absolute; top:" + top + "px; left:" + left + "px;");
 | 
			
		||||
            v.setAttribute('style', "pointer-events:none; position: absolute; top:" + top + "px; left:" + left + "px;");
 | 
			
		||||
 | 
			
		||||
            media.addEventListener('sourceopen', handle_video_source_open, false);
 | 
			
		||||
            media.addEventListener('sourceended', handle_video_source_ended, false);
 | 
			
		||||
| 
						 | 
				
			
			@ -1146,6 +1147,10 @@ function handle_append_video_buffer_done(e)
 | 
			
		|||
        stream.video.currentTime = stream.video.buffered.start(stream.video.buffered.length - 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Modern browsers try not to auto play video. */
 | 
			
		||||
    if (this.stream.video.paused && this.stream.video.readyState >= 2)
 | 
			
		||||
        var promise = this.stream.video.play();
 | 
			
		||||
 | 
			
		||||
    if (Utils.STREAM_DEBUG > 1)
 | 
			
		||||
        console.log(stream.video.currentTime + ":id " +  stream.id + " updateend " + Utils.dump_media_element(stream.video));
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										0
									
								
								static/js/spice-html5/enums.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/enums.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/filexfer.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/filexfer.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										99
									
								
								static/js/spice-html5/inputs.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										99
									
								
								static/js/spice-html5/inputs.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -38,7 +38,8 @@ var Meta_state = -1;
 | 
			
		|||
**  SpiceInputsConn
 | 
			
		||||
**      Drive the Spice Inputs channel (e.g. mouse + keyboard)
 | 
			
		||||
**--------------------------------------------------------------------------*/
 | 
			
		||||
function SpiceInputsConn() {
 | 
			
		||||
function SpiceInputsConn()
 | 
			
		||||
{
 | 
			
		||||
    SpiceConn.apply(this, arguments);
 | 
			
		||||
 | 
			
		||||
    this.mousex = undefined;
 | 
			
		||||
| 
						 | 
				
			
			@ -48,22 +49,26 @@ function SpiceInputsConn() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
SpiceInputsConn.prototype = Object.create(SpiceConn.prototype);
 | 
			
		||||
SpiceInputsConn.prototype.process_channel_message = function (msg) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_INPUTS_INIT) {
 | 
			
		||||
SpiceInputsConn.prototype.process_channel_message = function(msg)
 | 
			
		||||
{
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_INPUTS_INIT)
 | 
			
		||||
    {
 | 
			
		||||
        var inputs_init = new Messages.SpiceMsgInputsInit(msg.data);
 | 
			
		||||
        this.keyboard_modifiers = inputs_init.keyboard_modifiers;
 | 
			
		||||
        DEBUG > 1 && console.log("MsgInputsInit - modifier " + this.keyboard_modifiers);
 | 
			
		||||
        // FIXME - We don't do anything with the keyboard modifiers...
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_INPUTS_KEY_MODIFIERS) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_INPUTS_KEY_MODIFIERS)
 | 
			
		||||
    {
 | 
			
		||||
        var key = new Messages.SpiceMsgInputsKeyModifiers(msg.data);
 | 
			
		||||
        this.keyboard_modifiers = key.keyboard_modifiers;
 | 
			
		||||
        DEBUG > 1 && console.log("MsgInputsKeyModifiers - modifier " + this.keyboard_modifiers);
 | 
			
		||||
        // FIXME - We don't do anything with the keyboard modifiers...
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK)
 | 
			
		||||
    {
 | 
			
		||||
        DEBUG > 1 && console.log("mouse motion ack");
 | 
			
		||||
        this.waiting_for_ack -= Constants.SPICE_INPUT_MOTION_ACK_BUNCH;
 | 
			
		||||
        return true;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,28 +78,35 @@ SpiceInputsConn.prototype.process_channel_message = function (msg) {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function handle_mousemove(e) {
 | 
			
		||||
function handle_mousemove(e)
 | 
			
		||||
{
 | 
			
		||||
    var msg = new Messages.SpiceMiniData();
 | 
			
		||||
    var move;
 | 
			
		||||
    if (this.sc.mouse_mode == Constants.SPICE_MOUSE_MODE_CLIENT) {
 | 
			
		||||
    if (this.sc.mouse_mode == Constants.SPICE_MOUSE_MODE_CLIENT)
 | 
			
		||||
    {
 | 
			
		||||
        move = new Messages.SpiceMsgcMousePosition(this.sc, e)
 | 
			
		||||
        msg.build_msg(Constants.SPICE_MSGC_INPUTS_MOUSE_POSITION, move);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        move = new Messages.SpiceMsgcMouseMotion(this.sc, e)
 | 
			
		||||
        msg.build_msg(Constants.SPICE_MSGC_INPUTS_MOUSE_MOTION, move);
 | 
			
		||||
    }
 | 
			
		||||
    if (this.sc && this.sc.inputs && this.sc.inputs.state === "ready") {
 | 
			
		||||
        if (this.sc.inputs.waiting_for_ack < (2 * Constants.SPICE_INPUT_MOTION_ACK_BUNCH)) {
 | 
			
		||||
    if (this.sc && this.sc.inputs && this.sc.inputs.state === "ready")
 | 
			
		||||
    {
 | 
			
		||||
        if (this.sc.inputs.waiting_for_ack < (2 * Constants.SPICE_INPUT_MOTION_ACK_BUNCH))
 | 
			
		||||
        {
 | 
			
		||||
            this.sc.inputs.send_msg(msg);
 | 
			
		||||
            this.sc.inputs.waiting_for_ack++;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            DEBUG > 0 && this.sc.log_info("Discarding mouse motion");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.sc && this.sc.cursor && this.sc.cursor.spice_simulated_cursor) {
 | 
			
		||||
    if (this.sc && this.sc.cursor && this.sc.cursor.spice_simulated_cursor)
 | 
			
		||||
    {
 | 
			
		||||
        this.sc.cursor.spice_simulated_cursor.style.display = 'block';
 | 
			
		||||
        this.sc.cursor.spice_simulated_cursor.style.left = e.pageX - this.sc.cursor.spice_simulated_cursor.spice_hot_x + 'px';
 | 
			
		||||
        this.sc.cursor.spice_simulated_cursor.style.top = e.pageY - this.sc.cursor.spice_simulated_cursor.spice_hot_y + 'px';
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +115,8 @@ function handle_mousemove(e) {
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function handle_mousedown(e) {
 | 
			
		||||
function handle_mousedown(e)
 | 
			
		||||
{
 | 
			
		||||
    var press = new Messages.SpiceMsgcMousePress(this.sc, e)
 | 
			
		||||
    var msg = new Messages.SpiceMiniData();
 | 
			
		||||
    msg.build_msg(Constants.SPICE_MSGC_INPUTS_MOUSE_PRESS, press);
 | 
			
		||||
| 
						 | 
				
			
			@ -113,12 +126,14 @@ function handle_mousedown(e) {
 | 
			
		|||
    e.preventDefault();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function handle_contextmenu(e) {
 | 
			
		||||
function handle_contextmenu(e)
 | 
			
		||||
{
 | 
			
		||||
    e.preventDefault();
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function handle_mouseup(e) {
 | 
			
		||||
function handle_mouseup(e)
 | 
			
		||||
{
 | 
			
		||||
    var release = new Messages.SpiceMsgcMouseRelease(this.sc, e)
 | 
			
		||||
    var msg = new Messages.SpiceMiniData();
 | 
			
		||||
    msg.build_msg(Constants.SPICE_MSGC_INPUTS_MOUSE_RELEASE, release);
 | 
			
		||||
| 
						 | 
				
			
			@ -128,7 +143,8 @@ function handle_mouseup(e) {
 | 
			
		|||
    e.preventDefault();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function handle_mousewheel(e) {
 | 
			
		||||
function handle_mousewheel(e)
 | 
			
		||||
{
 | 
			
		||||
    var press = new Messages.SpiceMsgcMousePress;
 | 
			
		||||
    var release = new Messages.SpiceMsgcMouseRelease;
 | 
			
		||||
    if (e.deltaY < 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -150,7 +166,8 @@ function handle_mousewheel(e) {
 | 
			
		|||
    e.preventDefault();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function handle_keydown(e) {
 | 
			
		||||
function handle_keydown(e)
 | 
			
		||||
{
 | 
			
		||||
    var key = new Messages.SpiceMsgcKeyDown(e)
 | 
			
		||||
    var msg = new Messages.SpiceMiniData();
 | 
			
		||||
    check_and_update_modifiers(e, key.code, this.sc);
 | 
			
		||||
| 
						 | 
				
			
			@ -161,7 +178,8 @@ function handle_keydown(e) {
 | 
			
		|||
    e.preventDefault();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function handle_keyup(e) {
 | 
			
		||||
function handle_keyup(e)
 | 
			
		||||
{
 | 
			
		||||
    var key = new Messages.SpiceMsgcKeyUp(e)
 | 
			
		||||
    var msg = new Messages.SpiceMiniData();
 | 
			
		||||
    check_and_update_modifiers(e, key.code, this.sc);
 | 
			
		||||
| 
						 | 
				
			
			@ -172,8 +190,9 @@ function handle_keyup(e) {
 | 
			
		|||
    e.preventDefault();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function sendCtrlAltDel(sc) {
 | 
			
		||||
    if (sc && sc.inputs && sc.inputs.state === "ready") {
 | 
			
		||||
function sendCtrlAltDel(sc)
 | 
			
		||||
{
 | 
			
		||||
    if (sc && sc.inputs && sc.inputs.state === "ready"){
 | 
			
		||||
        var key = new Messages.SpiceMsgcKeyDown();
 | 
			
		||||
        var msg = new Messages.SpiceMiniData();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -227,14 +246,17 @@ function sendCtrlAltFN(sc, f) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function update_modifier(state, code, sc) {
 | 
			
		||||
function update_modifier(state, code, sc)
 | 
			
		||||
{
 | 
			
		||||
    var msg = new Messages.SpiceMiniData();
 | 
			
		||||
    if (!state) {
 | 
			
		||||
    if (!state)
 | 
			
		||||
    {
 | 
			
		||||
        var key = new Messages.SpiceMsgcKeyUp()
 | 
			
		||||
        key.code = (0x80 | code);
 | 
			
		||||
        key.code =(0x80|code);
 | 
			
		||||
        msg.build_msg(Constants.SPICE_MSGC_INPUTS_KEY_UP, key);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        var key = new Messages.SpiceMsgcKeyDown()
 | 
			
		||||
        key.code = code;
 | 
			
		||||
        msg.build_msg(Constants.SPICE_MSGC_INPUTS_KEY_DOWN, key);
 | 
			
		||||
| 
						 | 
				
			
			@ -243,8 +265,10 @@ function update_modifier(state, code, sc) {
 | 
			
		|||
    sc.inputs.send_msg(msg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function check_and_update_modifiers(e, code, sc) {
 | 
			
		||||
    if (Shift_state === -1) {
 | 
			
		||||
function check_and_update_modifiers(e, code, sc)
 | 
			
		||||
{
 | 
			
		||||
    if (Shift_state === -1)
 | 
			
		||||
    {
 | 
			
		||||
        Shift_state = e.shiftKey;
 | 
			
		||||
        Ctrl_state = e.ctrlKey;
 | 
			
		||||
        Alt_state = e.altKey;
 | 
			
		||||
| 
						 | 
				
			
			@ -259,32 +283,37 @@ function check_and_update_modifiers(e, code, sc) {
 | 
			
		|||
        Ctrl_state = true;
 | 
			
		||||
    else if (code === 0xE0B5)
 | 
			
		||||
        Meta_state = true;
 | 
			
		||||
    else if (code === (0x80 | KeyNames.KEY_ShiftL))
 | 
			
		||||
    else if (code === (0x80|KeyNames.KEY_ShiftL))
 | 
			
		||||
        Shift_state = false;
 | 
			
		||||
    else if (code === (0x80 | KeyNames.KEY_Alt))
 | 
			
		||||
    else if (code === (0x80|KeyNames.KEY_Alt))
 | 
			
		||||
        Alt_state = false;
 | 
			
		||||
    else if (code === (0x80 | KeyNames.KEY_LCtrl))
 | 
			
		||||
    else if (code === (0x80|KeyNames.KEY_LCtrl))
 | 
			
		||||
        Ctrl_state = false;
 | 
			
		||||
    else if (code === (0x80 | 0xE0B5))
 | 
			
		||||
    else if (code === (0x80|0xE0B5))
 | 
			
		||||
        Meta_state = false;
 | 
			
		||||
 | 
			
		||||
    if (sc && sc.inputs && sc.inputs.state === "ready") {
 | 
			
		||||
        if (Shift_state != e.shiftKey) {
 | 
			
		||||
    if (sc && sc.inputs && sc.inputs.state === "ready")
 | 
			
		||||
    {
 | 
			
		||||
        if (Shift_state != e.shiftKey)
 | 
			
		||||
        {
 | 
			
		||||
            console.log("Shift state out of sync");
 | 
			
		||||
            update_modifier(e.shiftKey, KeyNames.KEY_ShiftL, sc);
 | 
			
		||||
            Shift_state = e.shiftKey;
 | 
			
		||||
        }
 | 
			
		||||
        if (Alt_state != e.altKey) {
 | 
			
		||||
        if (Alt_state != e.altKey)
 | 
			
		||||
        {
 | 
			
		||||
            console.log("Alt state out of sync");
 | 
			
		||||
            update_modifier(e.altKey, KeyNames.KEY_Alt, sc);
 | 
			
		||||
            Alt_state = e.altKey;
 | 
			
		||||
        }
 | 
			
		||||
        if (Ctrl_state != e.ctrlKey) {
 | 
			
		||||
        if (Ctrl_state != e.ctrlKey)
 | 
			
		||||
        {
 | 
			
		||||
            console.log("Ctrl state out of sync");
 | 
			
		||||
            update_modifier(e.ctrlKey, KeyNames.KEY_LCtrl, sc);
 | 
			
		||||
            Ctrl_state = e.ctrlKey;
 | 
			
		||||
        }
 | 
			
		||||
        if (Meta_state != e.metaKey) {
 | 
			
		||||
        if (Meta_state != e.metaKey)
 | 
			
		||||
        {
 | 
			
		||||
            console.log("Meta state out of sync");
 | 
			
		||||
            update_modifier(e.metaKey, 0xE0B5, sc);
 | 
			
		||||
            Meta_state = e.metaKey;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										0
									
								
								static/js/spice-html5/lz.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/lz.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										168
									
								
								static/js/spice-html5/main.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										168
									
								
								static/js/spice-html5/main.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -63,7 +63,8 @@ import { resize_helper, handle_resize } from './resize.js';
 | 
			
		|||
**      browser, including WebSocket and WebSocket.binaryType == arraybuffer
 | 
			
		||||
**
 | 
			
		||||
**--------------------------------------------------------------------------*/
 | 
			
		||||
function SpiceMainConn() {
 | 
			
		||||
function SpiceMainConn()
 | 
			
		||||
{
 | 
			
		||||
    if (typeof WebSocket === "undefined")
 | 
			
		||||
        throw new Error("WebSocket unavailable.  You need to use a different browser.");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -77,25 +78,30 @@ function SpiceMainConn() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype = Object.create(SpiceConn.prototype);
 | 
			
		||||
SpiceMainConn.prototype.process_channel_message = function (msg) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_BEGIN) {
 | 
			
		||||
SpiceMainConn.prototype.process_channel_message = function(msg)
 | 
			
		||||
{
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_BEGIN)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Migrate Begin");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_CANCEL) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_CANCEL)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Migrate Cancel");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_INIT) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_INIT)
 | 
			
		||||
    {
 | 
			
		||||
        this.log_info("Connected to " + this.ws.url);
 | 
			
		||||
        this.report_success("Connected")
 | 
			
		||||
        this.main_init = new Messages.SpiceMsgMainInit(msg.data);
 | 
			
		||||
        this.connection_id = this.main_init.session_id;
 | 
			
		||||
        this.agent_tokens = this.main_init.agent_tokens;
 | 
			
		||||
 | 
			
		||||
        if (DEBUG > 0) {
 | 
			
		||||
        if (DEBUG > 0)
 | 
			
		||||
        {
 | 
			
		||||
            // FIXME - there is a lot here we don't handle; mouse modes, agent,
 | 
			
		||||
            //          ram_hint, multi_media_time
 | 
			
		||||
            this.log_info("session id "                 + this.main_init.session_id +
 | 
			
		||||
| 
						 | 
				
			
			@ -124,39 +130,45 @@ SpiceMainConn.prototype.process_channel_message = function (msg) {
 | 
			
		|||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MOUSE_MODE) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MOUSE_MODE)
 | 
			
		||||
    {
 | 
			
		||||
        var mode = new Messages.SpiceMsgMainMouseMode(msg.data);
 | 
			
		||||
        DEBUG > 0 && this.log_info("Mouse supported modes " + mode.supported_modes + "; current " + mode.current_mode);
 | 
			
		||||
        this.handle_mouse_mode(mode.current_mode, mode.supported_modes);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MULTI_MEDIA_TIME) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MULTI_MEDIA_TIME)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Multi Media Time");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_CHANNELS_LIST) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_CHANNELS_LIST)
 | 
			
		||||
    {
 | 
			
		||||
        var i;
 | 
			
		||||
        var chans;
 | 
			
		||||
        DEBUG > 0 && console.log("channels");
 | 
			
		||||
        chans = new Messages.SpiceMsgChannels(msg.data);
 | 
			
		||||
        for (i = 0; i < chans.channels.length; i++) {
 | 
			
		||||
        for (i = 0; i < chans.channels.length; i++)
 | 
			
		||||
        {
 | 
			
		||||
            var conn = {
 | 
			
		||||
                        uri: this.ws.url,
 | 
			
		||||
                        parent: this,
 | 
			
		||||
                connection_id: this.connection_id,
 | 
			
		||||
                type: chans.channels[i].type,
 | 
			
		||||
                chan_id: chans.channels[i].id
 | 
			
		||||
                        connection_id : this.connection_id,
 | 
			
		||||
                        type : chans.channels[i].type,
 | 
			
		||||
                        chan_id : chans.channels[i].id
 | 
			
		||||
                    };
 | 
			
		||||
            if (chans.channels[i].type == Constants.SPICE_CHANNEL_DISPLAY) {
 | 
			
		||||
            if (chans.channels[i].type == Constants.SPICE_CHANNEL_DISPLAY)
 | 
			
		||||
            {
 | 
			
		||||
                if (chans.channels[i].id == 0) {
 | 
			
		||||
                    this.display = new SpiceDisplayConn(conn);
 | 
			
		||||
                } else {
 | 
			
		||||
                    this.log_warn("The spice-html5 client does not handle multiple heads.");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else if (chans.channels[i].type == Constants.SPICE_CHANNEL_INPUTS) {
 | 
			
		||||
            else if (chans.channels[i].type == Constants.SPICE_CHANNEL_INPUTS)
 | 
			
		||||
            {
 | 
			
		||||
                this.inputs = new SpiceInputsConn(conn);
 | 
			
		||||
                this.inputs.mouse_mode = this.mouse_mode;
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -166,8 +178,9 @@ SpiceMainConn.prototype.process_channel_message = function (msg) {
 | 
			
		|||
                this.cursor = new SpicePlaybackConn(conn);
 | 
			
		||||
            else if (chans.channels[i].type == Constants.SPICE_CHANNEL_PORT)
 | 
			
		||||
                this.ports.push(new SpicePortConn(conn));
 | 
			
		||||
            else {
 | 
			
		||||
                if (!("extra_channels" in this))
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                if (! ("extra_channels" in this))
 | 
			
		||||
                    this.extra_channels = [];
 | 
			
		||||
                this.extra_channels[i] = new SpiceConn(conn);
 | 
			
		||||
                this.log_err("Channel type " + this.extra_channels[i].channel_type() + " not implemented");
 | 
			
		||||
| 
						 | 
				
			
			@ -178,25 +191,29 @@ SpiceMainConn.prototype.process_channel_message = function (msg) {
 | 
			
		|||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_CONNECTED) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_CONNECTED)
 | 
			
		||||
    {
 | 
			
		||||
        this.connect_agent();
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS)
 | 
			
		||||
    {
 | 
			
		||||
        var connected_tokens = new Messages.SpiceMsgMainAgentTokens(msg.data);
 | 
			
		||||
        this.agent_tokens = connected_tokens.num_tokens;
 | 
			
		||||
        this.connect_agent();
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_TOKEN) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_TOKEN)
 | 
			
		||||
    {
 | 
			
		||||
        var remaining_tokens, tokens = new Messages.SpiceMsgMainAgentTokens(msg.data);
 | 
			
		||||
        this.agent_tokens += tokens.num_tokens;
 | 
			
		||||
        this.send_agent_message_queue();
 | 
			
		||||
 | 
			
		||||
        remaining_tokens = this.agent_tokens;
 | 
			
		||||
        while (remaining_tokens > 0 && this.file_xfer_read_queue.length > 0) {
 | 
			
		||||
        while (remaining_tokens > 0 && this.file_xfer_read_queue.length > 0)
 | 
			
		||||
        {
 | 
			
		||||
            var xfer_task = this.file_xfer_read_queue.shift();
 | 
			
		||||
            this.file_xfer_read(xfer_task, xfer_task.read_bytes);
 | 
			
		||||
            remaining_tokens--;
 | 
			
		||||
| 
						 | 
				
			
			@ -204,20 +221,24 @@ SpiceMainConn.prototype.process_channel_message = function (msg) {
 | 
			
		|||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_DISCONNECTED) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_DISCONNECTED)
 | 
			
		||||
    {
 | 
			
		||||
        this.agent_connected = false;
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_DATA) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_AGENT_DATA)
 | 
			
		||||
    {
 | 
			
		||||
        var agent_data = new Messages.SpiceMsgMainAgentData(msg.data);
 | 
			
		||||
        if (agent_data.type == Constants.VD_AGENT_ANNOUNCE_CAPABILITIES) {
 | 
			
		||||
        if (agent_data.type == Constants.VD_AGENT_ANNOUNCE_CAPABILITIES)
 | 
			
		||||
        {
 | 
			
		||||
            var agent_caps = new Messages.VDAgentAnnounceCapabilities(agent_data.data);
 | 
			
		||||
            if (agent_caps.request)
 | 
			
		||||
                this.announce_agent_capabilities(0);
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        else if (agent_data.type == Constants.VD_AGENT_FILE_XFER_STATUS) {
 | 
			
		||||
        else if (agent_data.type == Constants.VD_AGENT_FILE_XFER_STATUS)
 | 
			
		||||
        {
 | 
			
		||||
            this.handle_file_xfer_status(new Messages.VDAgentFileXferStatusMessage(agent_data.data));
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -225,37 +246,44 @@ SpiceMainConn.prototype.process_channel_message = function (msg) {
 | 
			
		|||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Migrate Switch Host");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_END) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_END)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Migrate End");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_NAME) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_NAME)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Name");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_UUID) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_UUID)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main UUID");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Migrate Begin Seamless");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Migrate Dst Seamless ACK");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK) {
 | 
			
		||||
    if (msg.type == Constants.SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK)
 | 
			
		||||
    {
 | 
			
		||||
        this.known_unimplemented(msg.type, "Main Migrate Dst Seamless NACK");
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -263,20 +291,24 @@ SpiceMainConn.prototype.process_channel_message = function (msg) {
 | 
			
		|||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.stop = function (msg) {
 | 
			
		||||
SpiceMainConn.prototype.stop = function(msg)
 | 
			
		||||
{
 | 
			
		||||
    this.state = "closing";
 | 
			
		||||
 | 
			
		||||
    if (this.inputs) {
 | 
			
		||||
    if (this.inputs)
 | 
			
		||||
    {
 | 
			
		||||
        this.inputs.cleanup();
 | 
			
		||||
        this.inputs = undefined;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.cursor) {
 | 
			
		||||
    if (this.cursor)
 | 
			
		||||
    {
 | 
			
		||||
        this.cursor.cleanup();
 | 
			
		||||
        this.cursor = undefined;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (this.display) {
 | 
			
		||||
    if (this.display)
 | 
			
		||||
    {
 | 
			
		||||
        this.display.cleanup();
 | 
			
		||||
        this.display.destroy_surfaces();
 | 
			
		||||
        this.display = undefined;
 | 
			
		||||
| 
						 | 
				
			
			@ -290,26 +322,30 @@ SpiceMainConn.prototype.stop = function (msg) {
 | 
			
		|||
    this.extra_channels = undefined;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.send_agent_message_queue = function (message) {
 | 
			
		||||
SpiceMainConn.prototype.send_agent_message_queue = function(message)
 | 
			
		||||
{
 | 
			
		||||
    if (!this.agent_connected)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (message)
 | 
			
		||||
        this.agent_msg_queue.push(message);
 | 
			
		||||
 | 
			
		||||
    while (this.agent_tokens > 0 && this.agent_msg_queue.length > 0) {
 | 
			
		||||
    while (this.agent_tokens > 0 && this.agent_msg_queue.length > 0)
 | 
			
		||||
    {
 | 
			
		||||
        var mr = this.agent_msg_queue.shift();
 | 
			
		||||
        this.send_msg(mr);
 | 
			
		||||
        this.agent_tokens--;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.send_agent_message = function (type, message) {
 | 
			
		||||
SpiceMainConn.prototype.send_agent_message = function(type, message)
 | 
			
		||||
{
 | 
			
		||||
    var agent_data = new Messages.SpiceMsgcMainAgentData(type, message);
 | 
			
		||||
    var sb = 0, maxsize = Constants.VD_AGENT_MAX_DATA_SIZE - Messages.SpiceMiniData.prototype.buffer_size();
 | 
			
		||||
    var data = new ArrayBuffer(agent_data.buffer_size());
 | 
			
		||||
    agent_data.to_buffer(data);
 | 
			
		||||
    while (sb < agent_data.buffer_size()) {
 | 
			
		||||
    while (sb < agent_data.buffer_size())
 | 
			
		||||
    {
 | 
			
		||||
        var eb = Math.min(sb + maxsize, agent_data.buffer_size());
 | 
			
		||||
        var mr = new Messages.SpiceMiniData();
 | 
			
		||||
        mr.type = Constants.SPICE_MSGC_MAIN_AGENT_DATA;
 | 
			
		||||
| 
						 | 
				
			
			@ -320,19 +356,22 @@ SpiceMainConn.prototype.send_agent_message = function (type, message) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.announce_agent_capabilities = function (request) {
 | 
			
		||||
SpiceMainConn.prototype.announce_agent_capabilities = function(request)
 | 
			
		||||
{
 | 
			
		||||
    var caps = new Messages.VDAgentAnnounceCapabilities(request, (1 << Constants.VD_AGENT_CAP_MOUSE_STATE) |
 | 
			
		||||
                                                        (1 << Constants.VD_AGENT_CAP_MONITORS_CONFIG) |
 | 
			
		||||
                                                        (1 << Constants.VD_AGENT_CAP_REPLY));
 | 
			
		||||
    this.send_agent_message(Constants.VD_AGENT_ANNOUNCE_CAPABILITIES, caps);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.resize_window = function (flags, width, height, depth, x, y) {
 | 
			
		||||
SpiceMainConn.prototype.resize_window = function(flags, width, height, depth, x, y)
 | 
			
		||||
{
 | 
			
		||||
    var monitors_config = new Messages.VDAgentMonitorsConfig(flags, width, height, depth, x, y);
 | 
			
		||||
    this.send_agent_message(Constants.VD_AGENT_MONITORS_CONFIG, monitors_config);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.file_xfer_start = function (file) {
 | 
			
		||||
SpiceMainConn.prototype.file_xfer_start = function(file)
 | 
			
		||||
{
 | 
			
		||||
    var task_id, xfer_start, task;
 | 
			
		||||
 | 
			
		||||
    task_id = this.file_xfer_task_id++;
 | 
			
		||||
| 
						 | 
				
			
			@ -343,13 +382,16 @@ SpiceMainConn.prototype.file_xfer_start = function (file) {
 | 
			
		|||
    this.send_agent_message(Constants.VD_AGENT_FILE_XFER_START, xfer_start);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.handle_file_xfer_status = function (file_xfer_status) {
 | 
			
		||||
SpiceMainConn.prototype.handle_file_xfer_status = function(file_xfer_status)
 | 
			
		||||
{
 | 
			
		||||
    var xfer_error, xfer_task;
 | 
			
		||||
    if (!this.file_xfer_tasks[file_xfer_status.id]) {
 | 
			
		||||
    if (!this.file_xfer_tasks[file_xfer_status.id])
 | 
			
		||||
    {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    xfer_task = this.file_xfer_tasks[file_xfer_status.id];
 | 
			
		||||
    switch (file_xfer_status.result) {
 | 
			
		||||
    switch (file_xfer_status.result)
 | 
			
		||||
    {
 | 
			
		||||
        case Constants.VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA:
 | 
			
		||||
            this.file_xfer_read(xfer_task);
 | 
			
		||||
            return;
 | 
			
		||||
| 
						 | 
				
			
			@ -369,7 +411,8 @@ SpiceMainConn.prototype.handle_file_xfer_status = function (file_xfer_status) {
 | 
			
		|||
    this.file_xfer_completed(xfer_task, xfer_error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.file_xfer_read = function (file_xfer_task, start_byte) {
 | 
			
		||||
SpiceMainConn.prototype.file_xfer_read = function(file_xfer_task, start_byte)
 | 
			
		||||
{
 | 
			
		||||
    var FILE_XFER_CHUNK_SIZE = 32 * Constants.VD_AGENT_MAX_DATA_SIZE;
 | 
			
		||||
    var _this = this;
 | 
			
		||||
    var sb, eb;
 | 
			
		||||
| 
						 | 
				
			
			@ -377,11 +420,13 @@ SpiceMainConn.prototype.file_xfer_read = function (file_xfer_task, start_byte) {
 | 
			
		|||
 | 
			
		||||
    if (!file_xfer_task ||
 | 
			
		||||
        !this.file_xfer_tasks[file_xfer_task.id] ||
 | 
			
		||||
        (start_byte > 0 && start_byte == file_xfer_task.file.size)) {
 | 
			
		||||
        (start_byte > 0 && start_byte == file_xfer_task.file.size))
 | 
			
		||||
    {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (file_xfer_task.cancelled) {
 | 
			
		||||
    if (file_xfer_task.cancelled)
 | 
			
		||||
    {
 | 
			
		||||
        var xfer_status = new Messages.VDAgentFileXferStatusMessage(file_xfer_task.id,
 | 
			
		||||
                                                           Constants.VD_AGENT_FILE_XFER_STATUS_CANCELLED);
 | 
			
		||||
        this.send_agent_message(Constants.VD_AGENT_FILE_XFER_STATUS, xfer_status);
 | 
			
		||||
| 
						 | 
				
			
			@ -392,14 +437,16 @@ SpiceMainConn.prototype.file_xfer_read = function (file_xfer_task, start_byte) {
 | 
			
		|||
    sb = start_byte || 0,
 | 
			
		||||
    eb = Math.min(sb + FILE_XFER_CHUNK_SIZE, file_xfer_task.file.size);
 | 
			
		||||
 | 
			
		||||
    if (!this.agent_tokens) {
 | 
			
		||||
    if (!this.agent_tokens)
 | 
			
		||||
    {
 | 
			
		||||
        file_xfer_task.read_bytes = sb;
 | 
			
		||||
        this.file_xfer_read_queue.push(file_xfer_task);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    reader = new FileReader();
 | 
			
		||||
    reader.onload = function (e) {
 | 
			
		||||
    reader.onload = function(e)
 | 
			
		||||
    {
 | 
			
		||||
        var xfer_data = new Messages.VDAgentFileXferDataMessage(file_xfer_task.id,
 | 
			
		||||
                                                       e.target.result.byteLength,
 | 
			
		||||
                                                       e.target.result);
 | 
			
		||||
| 
						 | 
				
			
			@ -412,18 +459,20 @@ SpiceMainConn.prototype.file_xfer_read = function (file_xfer_task, start_byte) {
 | 
			
		|||
    reader.readAsArrayBuffer(slice);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.file_xfer_completed = function (file_xfer_task, error) {
 | 
			
		||||
SpiceMainConn.prototype.file_xfer_completed = function(file_xfer_task, error)
 | 
			
		||||
{
 | 
			
		||||
    if (error)
 | 
			
		||||
        this.log_err(error);
 | 
			
		||||
    else
 | 
			
		||||
        this.log_info("transfer of '" + file_xfer_task.file.name + "' was successful");
 | 
			
		||||
        this.log_info("transfer of '" + file_xfer_task.file.name +"' was successful");
 | 
			
		||||
 | 
			
		||||
    file_xfer_task.remove_progressbar();
 | 
			
		||||
 | 
			
		||||
    delete this.file_xfer_tasks[file_xfer_task.id];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.connect_agent = function () {
 | 
			
		||||
SpiceMainConn.prototype.connect_agent = function()
 | 
			
		||||
{
 | 
			
		||||
    this.agent_connected = true;
 | 
			
		||||
 | 
			
		||||
    var agent_start = new Messages.SpiceMsgcMainAgentStart(~0);
 | 
			
		||||
| 
						 | 
				
			
			@ -438,9 +487,11 @@ SpiceMainConn.prototype.connect_agent = function () {
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SpiceMainConn.prototype.handle_mouse_mode = function (current, supported) {
 | 
			
		||||
SpiceMainConn.prototype.handle_mouse_mode = function(current, supported)
 | 
			
		||||
{
 | 
			
		||||
    this.mouse_mode = current;
 | 
			
		||||
    if (current != Constants.SPICE_MOUSE_MODE_CLIENT && (supported & Constants.SPICE_MOUSE_MODE_CLIENT)) {
 | 
			
		||||
    if (current != Constants.SPICE_MOUSE_MODE_CLIENT && (supported & Constants.SPICE_MOUSE_MODE_CLIENT))
 | 
			
		||||
    {
 | 
			
		||||
        var mode_request = new Messages.SpiceMsgcMainMouseModeRequest(Constants.SPICE_MOUSE_MODE_CLIENT);
 | 
			
		||||
        var mr = new Messages.SpiceMiniData();
 | 
			
		||||
        mr.build_msg(Constants.SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST, mode_request);
 | 
			
		||||
| 
						 | 
				
			
			@ -452,7 +503,8 @@ SpiceMainConn.prototype.handle_mouse_mode = function (current, supported) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* Shift current time to attempt to get a time matching that of the server */
 | 
			
		||||
SpiceMainConn.prototype.relative_now = function () {
 | 
			
		||||
SpiceMainConn.prototype.relative_now = function()
 | 
			
		||||
{
 | 
			
		||||
    var ret = (Date.now() - this.our_mm_time) + this.mm_time;
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -464,5 +516,5 @@ export {
 | 
			
		|||
  resize_helper,
 | 
			
		||||
  handle_resize,
 | 
			
		||||
  sendCtrlAltDel,
 | 
			
		||||
    sendCtrlAltFN,
 | 
			
		||||
  sendCtrlAltFN
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										0
									
								
								static/js/spice-html5/playback.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/playback.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/png.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/png.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										2
									
								
								static/js/spice-html5/port.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										2
									
								
								static/js/spice-html5/port.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -20,7 +20,7 @@
 | 
			
		|||
*/
 | 
			
		||||
 | 
			
		||||
import { Constants } from './enums.js';
 | 
			
		||||
import { DEBUG } from './utils.js';
 | 
			
		||||
import { DEBUG, arraybuffer_to_str } from './utils.js';
 | 
			
		||||
import { SpiceConn } from './spiceconn.js';
 | 
			
		||||
import { SpiceMsgPortInit } from './spicemsg.js';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										0
									
								
								static/js/spice-html5/quic.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/quic.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/resize.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/resize.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/simulatecursor.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/simulatecursor.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/spicearraybuffer.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/spicearraybuffer.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/spiceconn.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/spiceconn.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/spicedataview.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/spicedataview.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/spicemsg.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/spicemsg.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/spicetype.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/spicetype.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/.npmignore
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/.npmignore
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/README.md
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/README.md
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/dist/babel-worker.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/dist/babel-worker.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/dist/browser-es-module-loader.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/dist/browser-es-module-loader.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/dist/browser-es-module-loader.js.map
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/dist/browser-es-module-loader.js.map
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/rollup.config.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/rollup.config.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/src/babel-worker.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/src/babel-worker.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/src/browser-es-module-loader.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/browser-es-module-loader/src/browser-es-module-loader.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/jsbn.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/jsbn.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/prng4.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/prng4.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/rng.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/rng.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/rsa.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/rsa.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/thirdparty/sha1.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/thirdparty/sha1.js
									
										
									
									
										vendored
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/ticket.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/ticket.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										0
									
								
								static/js/spice-html5/utils.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/utils.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										30
									
								
								static/js/spice-html5/webm.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										30
									
								
								static/js/spice-html5/webm.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -62,6 +62,7 @@ var WEBM_CODEC_PRIVATE =                    [ 0x63, 0xA2 ];
 | 
			
		|||
var WEBM_CODEC_ID =                         [ 0x86 ];
 | 
			
		||||
 | 
			
		||||
var WEBM_VIDEO =                            [ 0xE0 ] ;
 | 
			
		||||
var WEBM_FLAG_INTERLACED =                  [ 0x9A ] ;
 | 
			
		||||
var WEBM_PIXEL_WIDTH =                      [ 0xB0 ] ;
 | 
			
		||||
var WEBM_PIXEL_HEIGHT =                     [ 0xBA ] ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -303,6 +304,7 @@ webm_Audio.prototype =
 | 
			
		|||
function webm_Video(width, height)
 | 
			
		||||
{
 | 
			
		||||
    this.id = WEBM_VIDEO;
 | 
			
		||||
    this.flag_interlaced = 0;
 | 
			
		||||
    this.width = width;
 | 
			
		||||
    this.height = height;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -315,6 +317,7 @@ webm_Video.prototype =
 | 
			
		|||
        var dv = new DataView(a);
 | 
			
		||||
        at = EBML_write_array(this.id, dv, at);
 | 
			
		||||
        at = EBML_write_u64_data_len(this.buffer_size() - 8 - this.id.length, dv, at);
 | 
			
		||||
        at = EBML_write_u8_value(WEBM_FLAG_INTERLACED, this.flag_interlaced, dv, at);
 | 
			
		||||
        at = EBML_write_u16_value(WEBM_PIXEL_WIDTH, this.width, dv, at)
 | 
			
		||||
        at = EBML_write_u16_value(WEBM_PIXEL_HEIGHT, this.height, dv, at)
 | 
			
		||||
        return at;
 | 
			
		||||
| 
						 | 
				
			
			@ -322,6 +325,7 @@ webm_Video.prototype =
 | 
			
		|||
    buffer_size: function()
 | 
			
		||||
    {
 | 
			
		||||
        return this.id.length + 8 +
 | 
			
		||||
            WEBM_FLAG_INTERLACED.length + 1 + 1 +
 | 
			
		||||
            WEBM_PIXEL_WIDTH.length + 1 + 2 +
 | 
			
		||||
            WEBM_PIXEL_HEIGHT.length + 1 + 2;
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			@ -397,7 +401,7 @@ function webm_AudioTrackEntry()
 | 
			
		|||
{
 | 
			
		||||
    this.id = WEBM_TRACK_ENTRY;
 | 
			
		||||
    this.number = 1;
 | 
			
		||||
    this.uid = 1;
 | 
			
		||||
    this.uid = 2;  // Arbitrary id; most likely makes no difference
 | 
			
		||||
    this.type = 2; // Audio
 | 
			
		||||
    this.flag_enabled = 1;
 | 
			
		||||
    this.flag_default = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -471,20 +475,30 @@ webm_AudioTrackEntry.prototype =
 | 
			
		|||
 | 
			
		||||
function webm_VideoTrackEntry(width, height)
 | 
			
		||||
{
 | 
			
		||||
    /*
 | 
			
		||||
    ** In general, we follow specifications found by looking here:
 | 
			
		||||
    **   https://www.webmproject.org/docs/container/
 | 
			
		||||
    ** which points here:
 | 
			
		||||
    **   https://www.matroska.org/technical/specs/index.html
 | 
			
		||||
    ** and here:
 | 
			
		||||
    **   https://datatracker.ietf.org/doc/draft-ietf-cellar-matroska/
 | 
			
		||||
    ** Our goal is to supply mandatory values, and note where we differ
 | 
			
		||||
    ** from the default.
 | 
			
		||||
    */
 | 
			
		||||
    this.id = WEBM_TRACK_ENTRY;
 | 
			
		||||
    this.number = 1;
 | 
			
		||||
    this.uid = 1;
 | 
			
		||||
    this.type = 1; // Video
 | 
			
		||||
    this.flag_enabled = 1;
 | 
			
		||||
    this.flag_default = 1;
 | 
			
		||||
    this.flag_forced = 1;
 | 
			
		||||
    this.flag_lacing = 0;
 | 
			
		||||
    this.min_cache = 0; // fixme - check
 | 
			
		||||
    this.flag_forced = 1;  // Different than default; we wish to force
 | 
			
		||||
    this.flag_lacing = 1;
 | 
			
		||||
    this.min_cache = 0;
 | 
			
		||||
    this.max_block_addition_id = 0;
 | 
			
		||||
    this.codec_decode_all = 0; // fixme - check
 | 
			
		||||
    this.seek_pre_roll = 0; // 80000000; // fixme - check
 | 
			
		||||
    this.codec_delay =   80000000; // Must match codec_private.preskip
 | 
			
		||||
    this.codec_id = "V_VP8";
 | 
			
		||||
    this.codec_decode_all = 1;
 | 
			
		||||
    this.seek_pre_roll = 0;
 | 
			
		||||
 | 
			
		||||
    this.video = new webm_Video(width, height);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -506,7 +520,6 @@ webm_VideoTrackEntry.prototype =
 | 
			
		|||
        at = EBML_write_u8_value(WEBM_MIN_CACHE, this.min_cache, dv, at);
 | 
			
		||||
        at = EBML_write_u8_value(WEBM_MAX_BLOCK_ADDITION_ID, this.max_block_addition_id, dv, at);
 | 
			
		||||
        at = EBML_write_u8_value(WEBM_CODEC_DECODE_ALL, this.codec_decode_all, dv, at);
 | 
			
		||||
        at = EBML_write_u32_value(WEBM_CODEC_DELAY, this.codec_delay, dv, at);
 | 
			
		||||
        at = EBML_write_u32_value(WEBM_SEEK_PRE_ROLL, this.seek_pre_roll, dv, at);
 | 
			
		||||
        at = EBML_write_u8_value(WEBM_TRACK_TYPE, this.type, dv, at);
 | 
			
		||||
        at = this.video.to_buffer(a, at);
 | 
			
		||||
| 
						 | 
				
			
			@ -525,7 +538,6 @@ webm_VideoTrackEntry.prototype =
 | 
			
		|||
            WEBM_MIN_CACHE.length + 1 + 1 +
 | 
			
		||||
            WEBM_MAX_BLOCK_ADDITION_ID.length + 1 + 1 +
 | 
			
		||||
            WEBM_CODEC_DECODE_ALL.length + 1 + 1 +
 | 
			
		||||
            WEBM_CODEC_DELAY.length + 1 + 4 +
 | 
			
		||||
            WEBM_SEEK_PRE_ROLL.length + 1 + 4 +
 | 
			
		||||
            WEBM_TRACK_TYPE.length + 1 + 1 +
 | 
			
		||||
            this.video.buffer_size();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										0
									
								
								static/js/spice-html5/wire.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								static/js/spice-html5/wire.js
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue