From 28e2d41e163a1046aeca337d55f220125f3e61cd Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 20 Feb 2012 12:41:23 -0800 Subject: [PATCH] Added dispose instruction. --- libguac/include/protocol.h | 12 ++++++++++++ libguac/src/protocol.c | 9 +++++++++ 2 files changed, 21 insertions(+) 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