From bf15e05cb85bf4bce231a6090d72e18a6cbfcebf Mon Sep 17 00:00:00 2001 From: Jocelyn DELALANDE Date: Tue, 15 May 2012 12:02:28 +0200 Subject: [PATCH] cosmetic and comments for guacamole integration Signed-off-by: Michael Jumper --- protocols/rdp/include/rdp_keymap.h | 1 - protocols/rdp/include/unicode_convtable.h | 11 +++----- protocols/rdp/src/guac_handlers.c | 32 +++++++---------------- protocols/rdp/src/rdp_keymap_en_us.c | 1 - protocols/rdp/tools/ini2dot_h_unimap.py | 6 ++++- 5 files changed, 18 insertions(+), 33 deletions(-) diff --git a/protocols/rdp/include/rdp_keymap.h b/protocols/rdp/include/rdp_keymap.h index eec3a611..63460e17 100644 --- a/protocols/rdp/include/rdp_keymap.h +++ b/protocols/rdp/include/rdp_keymap.h @@ -40,7 +40,6 @@ #include - /** * Represents a keysym-to-scancode mapping for RDP, with extra information * about the state of prerequisite keysyms. diff --git a/protocols/rdp/include/unicode_convtable.h b/protocols/rdp/include/unicode_convtable.h index 46b42299..d74b55b5 100644 --- a/protocols/rdp/include/unicode_convtable.h +++ b/protocols/rdp/include/unicode_convtable.h @@ -1,16 +1,13 @@ - #ifndef _GUAC_UNICODE_CONVTABLE_H #define _GUAC_UNICODE_CONVTABLE_H int keysym2uni(int keysym); /* Keysym->unicode Exceptions tables */ -int keysym2uni_base[65536];// = { 0x0 }; -int keysym2uni_ext0[4096];// = { 0x0 }; -int keysym2uni_ext1[4096];// = { 0x0 }; -int keysym2uni_ext2[4096];// = { 0x0 }; - - +int keysym2uni_base[65536]; +int keysym2uni_ext0[4096]; +int keysym2uni_ext1[4096]; +int keysym2uni_ext2[4096]; /* Fill global tables, if needed (only on first call) */ void init_unicode_tables(); diff --git a/protocols/rdp/src/guac_handlers.c b/protocols/rdp/src/guac_handlers.c index f8c161db..ebc33079 100644 --- a/protocols/rdp/src/guac_handlers.c +++ b/protocols/rdp/src/guac_handlers.c @@ -345,12 +345,12 @@ int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) { /* Send actual key */ rdp_inst->input->KeyboardEvent( - rdp_inst->input, + rdp_inst->input, keysym_desc->flags - | (pressed ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE), - keysym_desc->scancode); + | (pressed ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE), + keysym_desc->scancode); - guac_client_log_info(client, "Base flags are %d", keysym_desc->flags); + guac_client_log_info(client, "Base flags are %d", keysym_desc->flags); /* If defined, release any keys that were originally released */ if (keysym_desc->set_keysyms != NULL) @@ -361,35 +361,21 @@ int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) { __guac_rdp_update_keysyms(client, keysym_desc->clear_keysyms, 1, 1); - - /* /\* If undefined but has Alt-code, use Alt-Code *\/ */ - /* else if (keysym <= 0xFF) { */ - - /* /\* NOTE: The Alt-codes are conveniently identical to keysyms. *\/ */ - - /* /\* Only send Alt-code on press *\/ */ - /* if (pressed) */ - /* __guac_rdp_send_altcode(client, keysym); */ - - /* } */ - - /* /\* If no defined Alt-code, log warning *\/ */ - /* else */ - /* guac_client_log_info(client, "unmapped keysym: 0x%x", keysym); */ - } else { - /* Fall back to unicode events */ + /* Fall back to unicode events if undefined inside current keymap */ int unicode_code = keysym2uni(keysym); guac_client_log_info(client, "Translated keysym:0x%x to unicode:0x%x (pressed=%d flag=%d)", keysym, unicode_code, pressed, pressed ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE); /* LibfreeRDP seems not to take into account the DOWN/RELEASE flags. - * So we send only the key once. + * So we send only on of the two key events. */ if (pressed) { rdp_inst->input->UnicodeKeyboardEvent( rdp_inst->input, - 0,//pressed ? KBD_FLAGS_DOW : KBD_FLAGS_RELEASE, + //pressed ? KBD_FLAGS_DOW : KBD_FLAGS_RELEASE, <- not + // taken into account + 0, unicode_code); } else { diff --git a/protocols/rdp/src/rdp_keymap_en_us.c b/protocols/rdp/src/rdp_keymap_en_us.c index 22f61422..a8ffef79 100644 --- a/protocols/rdp/src/rdp_keymap_en_us.c +++ b/protocols/rdp/src/rdp_keymap_en_us.c @@ -37,7 +37,6 @@ * ***** END LICENSE BLOCK ***** */ #include - #include #include "rdp_keymap.h" diff --git a/protocols/rdp/tools/ini2dot_h_unimap.py b/protocols/rdp/tools/ini2dot_h_unimap.py index 68a523fb..8de63409 100644 --- a/protocols/rdp/tools/ini2dot_h_unimap.py +++ b/protocols/rdp/tools/ini2dot_h_unimap.py @@ -1,5 +1,5 @@ #!/usr/bin/env python - +# # Copyright (C) 2012 Ulteo SAS # http://www.ulteo.com # Author Jocelyn DELALANDE 2012 @@ -9,6 +9,10 @@ # # Used to extract the keysym<->unicode mapping exceptions from # unicode_exception.ini (can be found in Ulteo patched version of xrdp) +# +# Such an ini file can be found at +# http://www.ulteo.com/home/en/download/sourcecode (xrdp folder) +# import sys import ConfigParser