Repository: guacamole-server
Updated Branches:
  refs/heads/master ebc6b9429 -> 4d7191147


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


Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/876516a1
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/876516a1
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/876516a1

Branch: refs/heads/master
Commit: 876516a1fbd1a8f2912d1e523437177e687a5ed1
Parents: b21aef5
Author: Michael Jumper <mjum...@apache.org>
Authored: Mon Nov 27 23:50:45 2017 -0800
Committer: Michael Jumper <mjum...@apache.org>
Committed: Fri Jan 26 16:42:14 2018 -0800

----------------------------------------------------------------------
 src/common/common/recording.h | 17 +++++++++++++++++
 src/common/recording.c        |  9 +++++++++
 src/protocols/rdp/input.c     |  5 +++++
 src/protocols/ssh/input.c     |  5 +++++
 src/protocols/telnet/input.c  |  5 +++++
 src/protocols/vnc/input.c     |  5 +++++
 6 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/876516a1/src/common/common/recording.h
----------------------------------------------------------------------
diff --git a/src/common/common/recording.h b/src/common/common/recording.h
index 03d4257..fb2fd87 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
 

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/876516a1/src/common/recording.c
----------------------------------------------------------------------
diff --git a/src/common/recording.c b/src/common/recording.c
index 875dcc3..14a6acd 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());
+
+}
+

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/876516a1/src/protocols/rdp/input.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/input.c b/src/protocols/rdp/input.c
index df9c543..96507db 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;

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/876516a1/src/protocols/ssh/input.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/input.c b/src/protocols/ssh/input.c
index 154c9ab..4ad5419 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;

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/876516a1/src/protocols/telnet/input.c
----------------------------------------------------------------------
diff --git a/src/protocols/telnet/input.c b/src/protocols/telnet/input.c
index de551dd..9a63da4 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;

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/876516a1/src/protocols/vnc/input.c
----------------------------------------------------------------------
diff --git a/src/protocols/vnc/input.c b/src/protocols/vnc/input.c
index 1dec1c9..2637cce 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);

Reply via email to