GUACAMOLE-313: Add support for including key states within session recordings.

This commit is contained in:
Michael Jumper 2017-11-27 23:50:45 -08:00
parent b21aef565b
commit 876516a1fb
6 changed files with 46 additions and 0 deletions

View File

@ -129,5 +129,22 @@ void guac_common_recording_free(guac_common_recording* recording);
void guac_common_recording_report_mouse(guac_common_recording* recording, void guac_common_recording_report_mouse(guac_common_recording* recording,
int x, int y, int button_mask); int x, int y, int button_mask);
/**
* Reports a change in the state of an individual key within the recording.
*
* @param recording
* The guac_common_recording associated with the key that was pressed or
* released.
*
* @param keysym
* The X11 keysym of the key that was pressed or released.
*
* @param pressed
* Non-zero if the key represented by the given keysym is currently
* pressed, zero if it is released.
*/
void guac_common_recording_report_key(guac_common_recording* recording,
int keysym, int pressed);
#endif #endif

View File

@ -188,3 +188,12 @@ void guac_common_recording_report_mouse(guac_common_recording* recording,
} }
void guac_common_recording_report_key(guac_common_recording* recording,
int keysym, int pressed) {
/* Report key state */
guac_protocol_send_key(recording->socket, keysym, pressed,
guac_timestamp_current());
}

View File

@ -128,6 +128,11 @@ int guac_rdp_user_key_handler(guac_user* user, int keysym, int pressed) {
guac_client* client = user->client; guac_client* client = user->client;
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
/* Report key state within recording */
if (rdp_client->recording != NULL)
guac_common_recording_report_key(rdp_client->recording,
keysym, pressed);
/* Skip if keyboard not yet ready */ /* Skip if keyboard not yet ready */
if (rdp_client->keyboard == NULL) if (rdp_client->keyboard == NULL)
return 0; return 0;

View File

@ -56,6 +56,11 @@ int guac_ssh_user_key_handler(guac_user* user, int keysym, int pressed) {
guac_ssh_client* ssh_client = (guac_ssh_client*) client->data; guac_ssh_client* ssh_client = (guac_ssh_client*) client->data;
guac_terminal* term = ssh_client->term; guac_terminal* term = ssh_client->term;
/* Report key state within recording */
if (ssh_client->recording != NULL)
guac_common_recording_report_key(ssh_client->recording,
keysym, pressed);
/* Skip if terminal not yet ready */ /* Skip if terminal not yet ready */
if (term == NULL) if (term == NULL)
return 0; return 0;

View File

@ -63,6 +63,11 @@ int guac_telnet_user_key_handler(guac_user* user, int keysym, int pressed) {
guac_telnet_settings* settings = telnet_client->settings; guac_telnet_settings* settings = telnet_client->settings;
guac_terminal* term = telnet_client->term; guac_terminal* term = telnet_client->term;
/* Report key state within recording */
if (telnet_client->recording != NULL)
guac_common_recording_report_key(telnet_client->recording,
keysym, pressed);
/* Skip if terminal not yet ready */ /* Skip if terminal not yet ready */
if (term == NULL) if (term == NULL)
return 0; return 0;

View File

@ -52,6 +52,11 @@ int guac_vnc_user_key_handler(guac_user* user, int keysym, int pressed) {
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data; guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
rfbClient* rfb_client = vnc_client->rfb_client; rfbClient* rfb_client = vnc_client->rfb_client;
/* Report key state within recording */
if (vnc_client->recording != NULL)
guac_common_recording_report_key(vnc_client->recording,
keysym, pressed);
/* Send VNC event only if finished connecting */ /* Send VNC event only if finished connecting */
if (rfb_client != NULL) if (rfb_client != NULL)
SendKeyEvent(rfb_client, keysym, pressed); SendKeyEvent(rfb_client, keysym, pressed);