GUACAMOLE-313: Add support for including mouse location within session recordings.

This commit is contained in:
Michael Jumper 2017-11-27 13:03:21 -08:00
parent b37e73488f
commit df770ae4ea
6 changed files with 44 additions and 0 deletions

View File

@ -101,5 +101,20 @@ guac_common_recording* guac_common_recording_create(guac_client* client,
*/ */
void guac_common_recording_free(guac_common_recording* recording); void guac_common_recording_free(guac_common_recording* recording);
/**
* Reports the current mouse position within the recording.
*
* @param recording
* The guac_common_recording associated with the mouse that has moved.
*
* @param x
* The new X coordinate of the mouse cursor, in pixels.
*
* @param y
* The new Y coordinate of the mouse cursor, in pixels.
*/
void guac_common_recording_report_mouse(guac_common_recording* recording,
int x, int y);
#endif #endif

View File

@ -20,6 +20,7 @@
#include "common/recording.h" #include "common/recording.h"
#include <guacamole/client.h> #include <guacamole/client.h>
#include <guacamole/protocol.h>
#include <guacamole/socket.h> #include <guacamole/socket.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
@ -177,3 +178,11 @@ void guac_common_recording_free(guac_common_recording* recording) {
free(recording); free(recording);
} }
void guac_common_recording_report_mouse(guac_common_recording* recording,
int x, int y) {
/* Report mouse location */
guac_protocol_send_mouse(recording->socket, x, y);
}

View File

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include "client.h" #include "client.h"
#include "common/recording.h"
#include "input.h" #include "input.h"
#include "keyboard.h" #include "keyboard.h"
#include "rdp.h" #include "rdp.h"
@ -49,6 +50,10 @@ int guac_rdp_user_mouse_handler(guac_user* user, int x, int y, int mask) {
/* Store current mouse location */ /* Store current mouse location */
guac_common_cursor_move(rdp_client->display->cursor, user, x, y); guac_common_cursor_move(rdp_client->display->cursor, user, x, y);
/* Report mouse position within recording */
if (rdp_client->recording != NULL)
guac_common_recording_report_mouse(rdp_client->recording, x, y);
/* If button mask unchanged, just send move event */ /* If button mask unchanged, just send move event */
if (mask == rdp_client->mouse_button_mask) if (mask == rdp_client->mouse_button_mask)
rdp_inst->input->MouseEvent(rdp_inst->input, PTR_FLAGS_MOVE, x, y); rdp_inst->input->MouseEvent(rdp_inst->input, PTR_FLAGS_MOVE, x, y);

View File

@ -21,6 +21,7 @@
#include "common/cursor.h" #include "common/cursor.h"
#include "common/display.h" #include "common/display.h"
#include "common/recording.h"
#include "ssh.h" #include "ssh.h"
#include "terminal/terminal.h" #include "terminal/terminal.h"
@ -40,6 +41,10 @@ int guac_ssh_user_mouse_handler(guac_user* user, int x, int y, int mask) {
if (term == NULL) if (term == NULL)
return 0; return 0;
/* Report mouse position within recording */
if (ssh_client->recording != NULL)
guac_common_recording_report_mouse(ssh_client->recording, x, y);
/* Send mouse event */ /* Send mouse event */
guac_terminal_send_mouse(term, user, x, y, mask); guac_terminal_send_mouse(term, user, x, y, mask);
return 0; return 0;

View File

@ -18,6 +18,7 @@
*/ */
#include "config.h" #include "config.h"
#include "common/recording.h"
#include "input.h" #include "input.h"
#include "terminal/terminal.h" #include "terminal/terminal.h"
#include "telnet.h" #include "telnet.h"
@ -42,6 +43,10 @@ int guac_telnet_user_mouse_handler(guac_user* user, int x, int y, int mask) {
if (term == NULL) if (term == NULL)
return 0; return 0;
/* Report mouse position within recording */
if (telnet_client->recording != NULL)
guac_common_recording_report_mouse(telnet_client->recording, x, y);
/* Send mouse if not searching for password or username */ /* Send mouse if not searching for password or username */
if (settings->password_regex == NULL && settings->username_regex == NULL) if (settings->password_regex == NULL && settings->username_regex == NULL)
guac_terminal_send_mouse(term, user, x, y, mask); guac_terminal_send_mouse(term, user, x, y, mask);

View File

@ -21,6 +21,7 @@
#include "common/cursor.h" #include "common/cursor.h"
#include "common/display.h" #include "common/display.h"
#include "common/recording.h"
#include "vnc.h" #include "vnc.h"
#include <guacamole/user.h> #include <guacamole/user.h>
@ -35,6 +36,10 @@ int guac_vnc_user_mouse_handler(guac_user* user, int x, int y, int mask) {
/* Store current mouse location */ /* Store current mouse location */
guac_common_cursor_move(vnc_client->display->cursor, user, x, y); guac_common_cursor_move(vnc_client->display->cursor, user, x, y);
/* Report mouse position within recording */
if (vnc_client->recording != NULL)
guac_common_recording_report_mouse(vnc_client->recording, x, y);
/* Send VNC event only if finished connecting */ /* Send VNC event only if finished connecting */
if (rfb_client != NULL) if (rfb_client != NULL)
SendPointerEvent(rfb_client, x, y, mask); SendPointerEvent(rfb_client, x, y, mask);