From 6e9405d418e27caa982c5ada70b440563add210b Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 12 Nov 2011 16:40:08 -0800 Subject: [PATCH] fix for alt-gr win7 control key --- xup/xup.c | 37 +++++++++++++++++++++++++++++++++++++ xup/xup.h | 1 + 2 files changed, 38 insertions(+) diff --git a/xup/xup.c b/xup/xup.c index ecbec731..e3397bc3 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -261,10 +261,47 @@ lib_mod_event(struct mod* mod, int msg, tbus param1, tbus param2, { struct stream* s; int len; + int key; int rv; LIB_DEBUG(mod, "in lib_mod_event"); make_stream(s); + if ((msg >= 15) && (msg <= 16)) /* key events */ + { + key = param2; + if (key > 0) + { + if (key == 65027) /* altgr */ + { + if (mod->shift_state) + { + g_writeln("special"); + /* fix for mstsc sending left control down with altgr */ + /* control down / up + msg param1 param2 param3 param4 + 15 0 65507 29 0 + 16 0 65507 29 49152 */ + init_stream(s, 8192); + s_push_layer(s, iso_hdr, 4); + out_uint16_le(s, 103); + out_uint32_le(s, 16); /* key up */ + out_uint32_le(s, 0); + out_uint32_le(s, 65507); /* left control */ + out_uint32_le(s, 29); /* RDP scan code */ + out_uint32_le(s, 0xc000); /* flags */ + s_mark_end(s); + len = (int)(s->end - s->data); + s_pop_layer(s, iso_hdr); + out_uint32_le(s, len); + lib_send(mod, s->data, len); + } + } + if (key == 65507) /* left control */ + { + mod->shift_state = msg == 15; + } + } + } init_stream(s, 8192); s_push_layer(s, iso_hdr, 4); out_uint16_le(s, 103); diff --git a/xup/xup.h b/xup/xup.h index 47db7cad..5d6ee9c6 100644 --- a/xup/xup.h +++ b/xup/xup.h @@ -104,4 +104,5 @@ struct mod char ip[256]; char port[256]; tbus sck_obj; + int shift_state; };