mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Support for newly added ready message
This commit is contained in:
@@ -440,6 +440,21 @@ function GuacamoleClient(display) {
|
||||
|
||||
var instructionHandlers = {
|
||||
|
||||
"ready": function(parameters) {
|
||||
|
||||
// If done drawing, send ready response
|
||||
if (background.isReady())
|
||||
sendMessage("ready;");
|
||||
|
||||
// If not done drawing, set callback which will send response
|
||||
else
|
||||
background.setReadyHandler(function() {
|
||||
sendMessage("ready;");
|
||||
background.setReadyHandler(null);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
"error": function(parameters) {
|
||||
showError(unescapeGuacamoleString(parameters[0]));
|
||||
},
|
||||
@@ -572,6 +587,9 @@ function GuacamoleClient(display) {
|
||||
setState(STATE_WAITING);
|
||||
handleResponse(makeRequest());
|
||||
|
||||
// Send "ready" message to server
|
||||
sendMessage("ready;");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@@ -31,6 +31,7 @@ function Layer(width, height) {
|
||||
|
||||
var displayContext = display.getContext("2d");
|
||||
|
||||
var readyHandler = null;
|
||||
var nextUpdateToDraw = 0;
|
||||
var currentUpdate = 0;
|
||||
var updates = new Array();
|
||||
@@ -47,11 +48,15 @@ function Layer(width, height) {
|
||||
|
||||
// Draw all pending updates.
|
||||
var updateCallback;
|
||||
while (updateCallback = updates[++nextUpdateToDraw]) {
|
||||
while ((updateCallback = updates[++nextUpdateToDraw])) {
|
||||
updateCallback();
|
||||
delete updates[nextUpdateToDraw];
|
||||
}
|
||||
|
||||
// If done with updates, call ready handler
|
||||
if (display.isReady() && readyHandler != null)
|
||||
readyHandler();
|
||||
|
||||
}
|
||||
|
||||
// If not next to draw, set callback and wait.
|
||||
@@ -60,6 +65,15 @@ function Layer(width, height) {
|
||||
|
||||
}
|
||||
|
||||
display.isReady = function() {
|
||||
return currentUpdate == nextUpdateToDraw;
|
||||
}
|
||||
|
||||
display.setReadyHandler = function(handler) {
|
||||
readyHandler = handler;
|
||||
}
|
||||
|
||||
|
||||
display.drawImage = function(x, y, image) {
|
||||
var updateId = currentUpdate++;
|
||||
|
||||
|
Reference in New Issue
Block a user