You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/01/30 19:08:36 UTC
[08/11] guacamole-server git commit: GUACAMOLE-313: Add missing
keysyms. Track modifier keys only.
GUACAMOLE-313: Add missing keysyms. Track modifier keys only.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/5e5f1fcb
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/5e5f1fcb
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/5e5f1fcb
Branch: refs/heads/master
Commit: 5e5f1fcb3e0d5d2fb2c1c679aacd337142f47393
Parents: 5b612b8
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Dec 8 12:56:27 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Jan 26 16:24:45 2018 -0800
----------------------------------------------------------------------
src/guaclog/keydef.c | 58 +++++++++++++++++++++++++++++++++++------------
src/guaclog/keydef.h | 8 +++++++
src/guaclog/state.c | 24 ++++++++++++--------
3 files changed, 66 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/5e5f1fcb/src/guaclog/keydef.c
----------------------------------------------------------------------
diff --git a/src/guaclog/keydef.c b/src/guaclog/keydef.c
index 9616500..427e3ca 100644
--- a/src/guaclog/keydef.c
+++ b/src/guaclog/keydef.c
@@ -30,24 +30,53 @@
* All known keys.
*/
const guaclog_keydef known_keys[] = {
- { 0xFE03, "AltGr" },
+ { 0xFE03, "AltGr", "", true },
{ 0xFF08, "Backspace" },
- { 0xFF09, "Tab", "<Tab>" },
+ { 0xFF09, "Tab" },
{ 0xFF0B, "Clear" },
{ 0xFF0D, "Return", "\n" },
{ 0xFF13, "Pause" },
+ { 0xFF14, "Scroll" },
+ { 0xFF15, "SysReq" },
{ 0xFF1B, "Escape" },
+ { 0xFF50, "Home" },
{ 0xFF51, "Left" },
{ 0xFF52, "Up" },
{ 0xFF53, "Right" },
{ 0xFF54, "Down" },
{ 0xFF55, "Page Up" },
{ 0xFF56, "Page Down" },
+ { 0xFF57, "End" },
{ 0xFF63, "Insert" },
{ 0xFF65, "Undo" },
{ 0xFF6A, "Help" },
+ { 0xFF7F, "Num" },
{ 0xFF80, "Space", " " },
{ 0xFF8D, "Enter", "\n" },
+ { 0xFF95, "Home" },
+ { 0xFF96, "Left" },
+ { 0xFF97, "Up" },
+ { 0xFF98, "Right" },
+ { 0xFF99, "Down" },
+ { 0xFF9A, "Page Up" },
+ { 0xFF9B, "Page Down" },
+ { 0xFF9C, "End" },
+ { 0xFF9E, "Insert" },
+ { 0xFFAA, "*", "*" },
+ { 0xFFAB, "+", "+" },
+ { 0xFFAD, "-", "-" },
+ { 0xFFAE, ".", "." },
+ { 0xFFAF, "/", "/" },
+ { 0xFFB0, "0", "0" },
+ { 0xFFB1, "1", "1" },
+ { 0xFFB2, "2", "2" },
+ { 0xFFB3, "3", "3" },
+ { 0xFFB4, "4", "4" },
+ { 0xFFB5, "5", "5" },
+ { 0xFFB6, "6", "6" },
+ { 0xFFB7, "7", "7" },
+ { 0xFFB8, "8", "8" },
+ { 0xFFB9, "9", "9" },
{ 0xFFBE, "F1" },
{ 0xFFBF, "F2" },
{ 0xFFC0, "F3" },
@@ -72,20 +101,19 @@ const guaclog_keydef known_keys[] = {
{ 0xFFD3, "F22" },
{ 0xFFD4, "F23" },
{ 0xFFD5, "F24" },
- { 0xFFE1, "Shift", "" },
- { 0xFFE2, "Shift", "" },
- { 0xFFE3, "Ctrl" },
- { 0xFFE4, "Ctrl" },
+ { 0xFFE1, "Shift", "", true },
+ { 0xFFE2, "Shift", "", true },
+ { 0xFFE3, "Ctrl", NULL, true },
+ { 0xFFE4, "Ctrl", NULL, true },
{ 0xFFE5, "Caps" },
- { 0xFFE7, "Meta" },
- { 0xFFE8, "Meta" },
- { 0xFFE9, "Alt" },
- { 0xFFEA, "Alt" },
- { 0xFFEB, "Super" },
- { 0xFFEB, "Win" },
- { 0xFFEC, "Super" },
- { 0xFFED, "Hyper" },
- { 0xFFEE, "Hyper" },
+ { 0xFFE7, "Meta", NULL, true },
+ { 0xFFE8, "Meta", NULL, true },
+ { 0xFFE9, "Alt", NULL, true },
+ { 0xFFEA, "Alt", NULL, true },
+ { 0xFFEB, "Super", NULL, true },
+ { 0xFFEC, "Super", NULL, true },
+ { 0xFFED, "Hyper", NULL, true },
+ { 0xFFEE, "Hyper", NULL, true },
{ 0xFFFF, "Delete" }
};
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/5e5f1fcb/src/guaclog/keydef.h
----------------------------------------------------------------------
diff --git a/src/guaclog/keydef.h b/src/guaclog/keydef.h
index d0b2720..147fe20 100644
--- a/src/guaclog/keydef.h
+++ b/src/guaclog/keydef.h
@@ -22,6 +22,8 @@
#include "config.h"
+#include <stdbool.h>
+
/**
* A mapping of X11 keysym to its corresponding human-readable name.
*/
@@ -44,6 +46,12 @@ typedef struct guaclog_keydef {
*/
char* value;
+ /**
+ * Whether this key is a modifier which may affect the interpretation of
+ * other keys, and thus should be tracked as it is held down.
+ */
+ bool modifier;
+
} guaclog_keydef;
/**
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/5e5f1fcb/src/guaclog/state.c
----------------------------------------------------------------------
diff --git a/src/guaclog/state.c b/src/guaclog/state.c
index 4965985..5e18708 100644
--- a/src/guaclog/state.c
+++ b/src/guaclog/state.c
@@ -217,14 +217,16 @@ int guaclog_state_update_key(guaclog_state* state, int keysym, bool pressed) {
if (keydef == NULL)
return 0;
- /* Update tracked key state */
- if (guaclog_state_add_key(state, keydef, pressed))
- guaclog_keydef_free(keydef);
- else
- guaclog_state_trim_keys(state);
+ /* Update tracked key state for modifiers */
+ if (keydef->modifier) {
+ if (guaclog_state_add_key(state, keydef, pressed))
+ guaclog_keydef_free(keydef);
+ else
+ guaclog_state_trim_keys(state);
+ }
/* Output key states only for printable keys */
- if (pressed && keydef->value != NULL) {
+ else if (pressed) {
if (guaclog_state_is_shortcut(state)) {
@@ -244,13 +246,17 @@ int guaclog_state_update_key(guaclog_state* state, int keysym, bool pressed) {
}
- fprintf(state->output, ">");
+ fprintf(state->output, "%s>", keydef->value);
}
/* Print the key itself */
- else
- fprintf(state->output, "%s", keydef->value);
+ else {
+ if (keydef->value != NULL)
+ fprintf(state->output, "%s", keydef->value);
+ else
+ fprintf(state->output, "<%s>", keydef->name);
+ }
}