diff --git a/guacamole-common-js/src/main/resources/guacamole.js b/guacamole-common-js/src/main/resources/guacamole.js index 9c549f896..7d182d616 100644 --- a/guacamole-common-js/src/main/resources/guacamole.js +++ b/guacamole-common-js/src/main/resources/guacamole.js @@ -1470,21 +1470,35 @@ Guacamole.Client = function(tunnel) { var srcY = parseInt(parameters[2]); var srcWidth = parseInt(parameters[3]); var srcHeight = parseInt(parameters[4]); - var transferFunction = Guacamole.Client.DefaultTransferFunction[parameters[5]]; + var function_index = parseInt(parameters[5]); var dstL = getLayer(parseInt(parameters[6])); var dstX = parseInt(parameters[7]); var dstY = parseInt(parameters[8]); - dstL.transfer( - srcL, - srcX, - srcY, - srcWidth, - srcHeight, - dstX, - dstY, - transferFunction - ); + /* SRC */ + if (function_index === 0x3) + dstL.put( + srcL, + srcX, + srcY, + srcWidth, + srcHeight, + dstX, + dstY + ); + + /* Anything else that isn't a NO-OP */ + else if (function_index !== 0x5) + dstL.transfer( + srcL, + srcX, + srcY, + srcWidth, + srcHeight, + dstX, + dstY, + Guacamole.Client.DefaultTransferFunction[function_index] + ); }, diff --git a/guacamole-common-js/src/main/resources/layer.js b/guacamole-common-js/src/main/resources/layer.js index b5db45841..d91b8a4e4 100644 --- a/guacamole-common-js/src/main/resources/layer.js +++ b/guacamole-common-js/src/main/resources/layer.js @@ -647,6 +647,51 @@ Guacamole.Layer = function(width, height) { }); }; + /** + * Put a rectangle of image data from one Layer to this Layer directly + * without performing any alpha blending. Simply copy the data. + * + * @param {Guacamole.Layer} srcLayer The Layer to copy image data from. + * @param {Number} srcx The X coordinate of the upper-left corner of the + * rectangle within the source Layer's coordinate + * space to copy data from. + * @param {Number} srcy The Y coordinate of the upper-left corner of the + * rectangle within the source Layer's coordinate + * space to copy data from. + * @param {Number} srcw The width of the rectangle within the source Layer's + * coordinate space to copy data from. + * @param {Number} srch The height of the rectangle within the source + * Layer's coordinate space to copy data from. + * @param {Number} x The destination X coordinate. + * @param {Number} y The destination Y coordinate. + */ + this.put = function(srcLayer, srcx, srcy, srcw, srch, x, y) { + scheduleTaskSynced(srcLayer, function() { + + var srcCanvas = srcLayer.getCanvas(); + + // If entire rectangle outside source canvas, stop + if (srcx >= srcCanvas.width || srcy >= srcCanvas.height) return; + + // Otherwise, clip rectangle to area + if (srcx + srcw > srcCanvas.width) + srcw = srcCanvas.width - srcx; + + if (srcy + srch > srcCanvas.height) + srch = srcCanvas.height - srcy; + + // Stop if nothing to draw. + if (srcw == 0 || srch == 0) return; + + if (layer.autosize != 0) fitRect(x, y, srcw, srch); + + // Get image data from src and dst + var src = srcLayer.getCanvas().getContext("2d").getImageData(srcx, srcy, srcw, srch); + displayContext.putImageData(src, x, y); + + }); + }; + /** * Copy a rectangle of image data from one Layer to this Layer. This * operation will copy exactly the image data that will be drawn once all diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js index a0c896981..f24b9b59a 100644 --- a/guacamole/src/main/webapp/scripts/client-ui.js +++ b/guacamole/src/main/webapp/scripts/client-ui.js @@ -933,24 +933,6 @@ GuacUI.Client.attach = function(guac) { }; - var thumbnail_update_interval = null; - - window.onblur = function() { - - // Regularly update screenshot if window not visible - if (!thumbnail_update_interval) - thumbnail_update_interval = - window.setInterval(GuacUI.Client.updateThumbnail, 1000); - - }; - - window.onfocus = function() { - if (thumbnail_update_interval) { - window.clearInterval(thumbnail_update_interval); - thumbnail_update_interval = null; - } - }; - /* * Disconnect and update thumbnail on close */