diff --git a/libguac/include/protocol.h b/libguac/include/protocol.h index d7d282ed..77a0c6a4 100644 --- a/libguac/include/protocol.h +++ b/libguac/include/protocol.h @@ -240,6 +240,18 @@ int guac_protocol_send_size(guac_socket* socket, const guac_layer* layer, int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer, const guac_layer* parent, int x, int y, int z); +/** + * Sends a dispose instruction over the given guac_socket connection. + * + * If an error occurs sending the instruction, a non-zero value is + * returned, and guac_error is set appropriately. + * + * @param socket The guac_socket connection to use. + * @param layer The layer to dispose. + * @return Zero on success, non-zero on error. + */ +int guac_protocol_send_dispose(guac_socket* socket, const guac_layer* layer); + /** * Sends a copy instruction over the given guac_socket connection. * diff --git a/libguac/src/protocol.c b/libguac/src/protocol.c index 6039494c..1075e46c 100644 --- a/libguac/src/protocol.c +++ b/libguac/src/protocol.c @@ -142,6 +142,15 @@ int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer, } +int guac_protocol_send_dispose(guac_socket* socket, const guac_layer* layer) { + + return + guac_socket_write_string(socket, "7.dispose,") + || __guac_socket_write_length_int(socket, layer->index) + || guac_socket_write_string(socket, ";"); + +} + int guac_protocol_send_clipboard(guac_socket* socket, const char* data) { return