GUACAMOLE-231: Add "mouse" instruction for server reporting of mouse position.

This commit is contained in:
Michael Jumper 2017-03-10 12:27:24 -08:00
parent cf05eca68b
commit 1a96c5b415
2 changed files with 37 additions and 0 deletions

View File

@ -144,6 +144,26 @@ int guac_protocol_send_log(guac_socket* socket, const char* format, ...);
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.
*

View File

@ -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) {