diff --git a/src/common/common/recording.h b/src/common/common/recording.h index 03d42574..fb2fd87f 100644 --- a/src/common/common/recording.h +++ b/src/common/common/recording.h @@ -129,5 +129,22 @@ void guac_common_recording_free(guac_common_recording* recording); void guac_common_recording_report_mouse(guac_common_recording* recording, 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 diff --git a/src/common/recording.c b/src/common/recording.c index 875dcc3e..14a6acdf 100644 --- a/src/common/recording.c +++ b/src/common/recording.c @@ -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()); + +} + diff --git a/src/protocols/rdp/input.c b/src/protocols/rdp/input.c index df9c5439..96507db2 100644 --- a/src/protocols/rdp/input.c +++ b/src/protocols/rdp/input.c @@ -128,6 +128,11 @@ int guac_rdp_user_key_handler(guac_user* user, int keysym, int pressed) { guac_client* client = user->client; 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 */ if (rdp_client->keyboard == NULL) return 0; diff --git a/src/protocols/ssh/input.c b/src/protocols/ssh/input.c index 154c9ab4..4ad54199 100644 --- a/src/protocols/ssh/input.c +++ b/src/protocols/ssh/input.c @@ -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_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 */ if (term == NULL) return 0; diff --git a/src/protocols/telnet/input.c b/src/protocols/telnet/input.c index de551dd0..9a63da40 100644 --- a/src/protocols/telnet/input.c +++ b/src/protocols/telnet/input.c @@ -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_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 */ if (term == NULL) return 0; diff --git a/src/protocols/vnc/input.c b/src/protocols/vnc/input.c index 1dec1c99..2637cce8 100644 --- a/src/protocols/vnc/input.c +++ b/src/protocols/vnc/input.c @@ -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; 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 */ if (rfb_client != NULL) SendKeyEvent(rfb_client, keysym, pressed);