Adding a layer should not remove ALL contents of display (the on-screen keyboard, for example, is a child of the display)

This commit is contained in:
Michael Jumper
2011-02-17 02:05:36 -08:00
parent fabeca7414
commit 299eb56d79

View File

@@ -476,18 +476,25 @@ function GuacamoleClient(display, tunnelURL) {
layer = new Layer(displayWidth, displayHeight); layer = new Layer(displayWidth, displayHeight);
layers[index] = layer; layers[index] = layer;
// Remove all children // (Re)-add existing layers in order
display.innerHTML = "";
// Add existing layers in order
for (var i=0; i<layers.length; i++) { for (var i=0; i<layers.length; i++) {
if (layers[i]) if (layers[i]) {
// If already present, remove
if (layers[i].parentNode === display)
display.removeNode(layers[i]);
// Add to end
display.appendChild(layers[i]); display.appendChild(layers[i]);
}
} }
// Add cursor layer last // Add cursor layer last
if (cursor != null) if (cursor != null) {
if (cursor.parentNode === display)
display.removeNode(cursor);
display.appendChild(cursor); display.appendChild(cursor);
}
} }
else { else {