GUACAMOLE-231: Add "mouse" instruction for server reporting of mouse position.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/1a96c5b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/1a96c5b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/1a96c5b4 Branch: refs/heads/staging/0.9.12-incubating Commit: 1a96c5b41506b67aad556f885ad4a424812e2930 Parents: cf05eca Author: Michael Jumper <[email protected]> Authored: Fri Mar 10 12:27:24 2017 -0800 Committer: Michael Jumper <[email protected]> Committed: Sat Mar 11 14:57:09 2017 -0800 ---------------------------------------------------------------------- src/libguac/guacamole/protocol.h | 20 ++++++++++++++++++++ src/libguac/protocol.c | 17 +++++++++++++++++ 2 files changed, 37 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/1a96c5b4/src/libguac/guacamole/protocol.h ---------------------------------------------------------------------- diff --git a/src/libguac/guacamole/protocol.h b/src/libguac/guacamole/protocol.h index 638d7b2..88a0a18 100644 --- a/src/libguac/guacamole/protocol.h +++ b/src/libguac/guacamole/protocol.h @@ -145,6 +145,26 @@ int vguac_protocol_send_log(guac_socket* socket, const char* format, va_list args); /** + * Sends a mouse 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 x + * The X coordinate of the current mouse position. + * + * @param y + * The Y coordinate of the current mouse position. + * + * @return + * Zero on success, non-zero on error. + */ +int guac_protocol_send_mouse(guac_socket* socket, int x, int y); + +/** * Sends a nest instruction over the given guac_socket connection. * * If an error occurs sending the instruction, a non-zero value is http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/1a96c5b4/src/libguac/protocol.c ---------------------------------------------------------------------- diff --git a/src/libguac/protocol.c b/src/libguac/protocol.c index 1040fb1..8da1824 100644 --- a/src/libguac/protocol.c +++ b/src/libguac/protocol.c @@ -684,6 +684,23 @@ int guac_protocol_send_lstroke(guac_socket* socket, } +int guac_protocol_send_mouse(guac_socket* socket, int x, int y) { + + int ret_val; + + guac_socket_instruction_begin(socket); + ret_val = + guac_socket_write_string(socket, "5.mouse,") + || __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_instruction_end(socket); + return ret_val; + +} + int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer, const guac_layer* parent, int x, int y, int z) {
