1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-28 19:21:10 +00:00

spice-html5 updated.

This commit is contained in:
catborise 2018-08-08 14:00:35 +03:00
parent 12c80c5021
commit b05a252d7c
36 changed files with 1356 additions and 1415 deletions
static/js/spice-html5

83
static/js/spice-html5/main.js Normal file → Executable file
View file

@ -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.
@ -59,11 +59,24 @@ function SpiceMainConn()
this.file_xfer_tasks = {};
this.file_xfer_task_id = 0;
this.file_xfer_read_queue = [];
this.ports = [];
}
SpiceMainConn.prototype = Object.create(SpiceConn.prototype);
SpiceMainConn.prototype.process_channel_message = function(msg)
{
if (msg.type == SPICE_MSG_MAIN_MIGRATE_BEGIN)
{
this.known_unimplemented(msg.type, "Main Migrate Begin");
return true;
}
if (msg.type == SPICE_MSG_MAIN_MIGRATE_CANCEL)
{
this.known_unimplemented(msg.type, "Main Migrate Cancel");
return true;
}
if (msg.type == SPICE_MSG_MAIN_INIT)
{
this.log_info("Connected to " + this.ws.url);
@ -86,6 +99,9 @@ SpiceMainConn.prototype.process_channel_message = function(msg)
" ; ram_hint " + this.main_init.ram_hint);
}
this.our_mm_time = Date.now();
this.mm_time = this.main_init.multi_media_time;
this.handle_mouse_mode(this.main_init.current_mouse_mode,
this.main_init.supported_mouse_modes);
@ -107,6 +123,12 @@ SpiceMainConn.prototype.process_channel_message = function(msg)
return true;
}
if (msg.type == SPICE_MSG_MAIN_MULTI_MEDIA_TIME)
{
this.known_unimplemented(msg.type, "Main Multi Media Time");
return true;
}
if (msg.type == SPICE_MSG_MAIN_CHANNELS_LIST)
{
var i;
@ -123,7 +145,12 @@ SpiceMainConn.prototype.process_channel_message = function(msg)
chan_id : chans.channels[i].id
};
if (chans.channels[i].type == SPICE_CHANNEL_DISPLAY)
this.display = new SpiceDisplayConn(conn);
{
if (this.display !== undefined)
this.log_warn("The spice-html5 client does not handle multiple heads.");
else
this.display = new SpiceDisplayConn(conn);
}
else if (chans.channels[i].type == SPICE_CHANNEL_INPUTS)
{
this.inputs = new SpiceInputsConn(conn);
@ -133,12 +160,14 @@ SpiceMainConn.prototype.process_channel_message = function(msg)
this.cursor = new SpiceCursorConn(conn);
else if (chans.channels[i].type == SPICE_CHANNEL_PLAYBACK)
this.cursor = new SpicePlaybackConn(conn);
else if (chans.channels[i].type == SPICE_CHANNEL_PORT)
this.ports.push(new SpicePortConn(conn));
else
{
this.log_err("Channel type " + chans.channels[i].type + " unknown.");
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");
}
}
@ -201,6 +230,48 @@ SpiceMainConn.prototype.process_channel_message = function(msg)
return false;
}
if (msg.type == SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST)
{
this.known_unimplemented(msg.type, "Main Migrate Switch Host");
return true;
}
if (msg.type == SPICE_MSG_MAIN_MIGRATE_END)
{
this.known_unimplemented(msg.type, "Main Migrate End");
return true;
}
if (msg.type == SPICE_MSG_MAIN_NAME)
{
this.known_unimplemented(msg.type, "Main Name");
return true;
}
if (msg.type == SPICE_MSG_MAIN_UUID)
{
this.known_unimplemented(msg.type, "Main UUID");
return true;
}
if (msg.type == SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS)
{
this.known_unimplemented(msg.type, "Main Migrate Begin Seamless");
return true;
}
if (msg.type == SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK)
{
this.known_unimplemented(msg.type, "Main Migrate Dst Seamless ACK");
return true;
}
if (msg.type == SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK)
{
this.known_unimplemented(msg.type, "Main Migrate Dst Seamless NACK");
return true;
}
return false;
}
@ -415,3 +486,9 @@ SpiceMainConn.prototype.handle_mouse_mode = function(current, supported)
this.inputs.mouse_mode = current;
}
/* Shift current time to attempt to get a time matching that of the server */
SpiceMainConn.prototype.relative_now = function()
{
var ret = (Date.now() - this.our_mm_time) + this.mm_time;
return ret;
}