From a17cd6202ba0896148ba8492391726c10bd5b895 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 11 Feb 2012 19:00:55 -0800 Subject: [PATCH] Modified size to be layer-specific, adding layer move instruction. --- libguac/configure.in | 2 +- libguac/include/protocol.h | 26 +++++++++++++++++++++++--- libguac/src/protocol.c | 23 ++++++++++++++++++++++- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/libguac/configure.in b/libguac/configure.in index 174df1bc..28cb34bd 100644 --- a/libguac/configure.in +++ b/libguac/configure.in @@ -35,7 +35,7 @@ # ***** END LICENSE BLOCK ***** AC_INIT(src/client.c) -AM_INIT_AUTOMAKE(libguac, 0.5.0) +AM_INIT_AUTOMAKE(libguac, 0.6.0) AC_CONFIG_MACRO_DIR([m4]) # Checks for programs. diff --git a/libguac/include/protocol.h b/libguac/include/protocol.h index f075f8c5..da5b7c7d 100644 --- a/libguac/include/protocol.h +++ b/libguac/include/protocol.h @@ -214,11 +214,31 @@ int guac_protocol_send_clipboard(guac_socket* socket, const char* data); * returned, and guac_error is set appropriately. * * @param socket The guac_socket connection to use. - * @param w The width of the display. - * @param h The height of the display. + * @param layer The layer to resize. + * @param w The new width of the layer. + * @param h The new height of the layer. * @return Zero on success, non-zero on error. */ -int guac_protocol_send_size(guac_socket* socket, int w, int h); +int guac_protocol_send_size(guac_socket* socket, const guac_layer* layer, + int w, int h); + +/** + * Sends a move 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 move. + * @param parent The parent layer the specified layer will be positioned + * relative to. + * @param x The X coordinate of the layer. + * @param y The Y coordinate of the layer. + * @param z The Z index of the layer, relative to other layers in its parent. + * @return Zero on success, non-zero on error. + */ +int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer, + const guac_layer* parent, int x, int y, int z); /** * Sends a copy instruction over the given guac_socket connection. diff --git a/libguac/src/protocol.c b/libguac/src/protocol.c index 89fe785a..4f5c0678 100644 --- a/libguac/src/protocol.c +++ b/libguac/src/protocol.c @@ -110,10 +110,13 @@ int guac_protocol_send_name(guac_socket* socket, const char* name) { } -int guac_protocol_send_size(guac_socket* socket, int w, int h) { +int guac_protocol_send_size(guac_socket* socket, const guac_layer* layer, + int w, int h) { return guac_socket_write_string(socket, "4.size,") + || __guac_socket_write_length_int(socket, layer->index) + || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, w) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, h) @@ -121,6 +124,24 @@ int guac_protocol_send_size(guac_socket* socket, int w, int h) { } +int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer, + const guac_layer* parent, int x, int y, int z) { + + return + guac_socket_write_string(socket, "4.move,") + || __guac_socket_write_length_int(socket, layer->index) + || guac_socket_write_string(socket, ",") + || __guac_socket_write_length_int(socket, parent->index) + || guac_socket_write_string(socket, ",") + || __guac_socket_write_length_int(socket, x) + || guac_socket_write_string(socket, ",") + || __guac_socket_write_length_int(socket, y) + || guac_socket_write_string(socket, ",") + || __guac_socket_write_length_int(socket, z) + || guac_socket_write_string(socket, ";"); + +} + int guac_protocol_send_clipboard(guac_socket* socket, const char* data) { return