From 8cf3c7eaaaae32d473b1bdac84c3d3f08864916b Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Mon, 9 Oct 2006 07:04:32 +0000 Subject: [PATCH] altgr fix --- xrdp/lang.c | 10 ++++++++++ xrdp/xrdp_bitmap.c | 2 +- xrdp/xrdp_wm.c | 14 ++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/xrdp/lang.c b/xrdp/lang.c index 8fedb287..a45eeb84 100644 --- a/xrdp/lang.c +++ b/xrdp/lang.c @@ -299,24 +299,28 @@ get_char_from_scan_code(int device_flags, int scan_code, int* keys, int shift; int altgr; int ext; + int has_altgr; if (keylayout == 0x40c) /* france */ { keys_noshift = fr_noshift; keys_shift = fr_shift; keys_altgr = fr_altgr; + has_altgr = 1; } else if (keylayout == 0x809) /* en-uk or en-gb */ { keys_noshift = en_uk_noshift; keys_shift = en_uk_shift; keys_altgr = en_uk_altgr; + has_altgr = 1; } else if (keylayout == 0x407) /* german */ { keys_noshift = de_noshift; keys_shift = de_shift; keys_altgr = de_altgr; + has_altgr = 1; } /* italy else if (keylayout == 0x410) @@ -327,6 +331,12 @@ get_char_from_scan_code(int device_flags, int scan_code, int* keys, keys_noshift = en_us_noshift; keys_shift = en_us_shift; keys_altgr = en_us_altgr; + has_altgr = 0; + } + /* don't send altgr */ + if (has_altgr && (scan_code == 56) && (device_flags & 0x100)) + { + return 1; } /*g_writeln("%d %d %x", scan_code, device_flags, keylayout);*/ shift = keys[42] || keys[54]; diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c index 2cb38aff..56b8f7e7 100644 --- a/xrdp/xrdp_bitmap.c +++ b/xrdp/xrdp_bitmap.c @@ -1385,7 +1385,7 @@ xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg, self->wm->num_lock, self->wm->scroll_lock, self->wm->session->client_info->keylayout); - if (c != 0) + if ((unsigned char)c >= 32) { add_char_at(self->caption1, c, self->edit_pos); self->edit_pos++; diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index d2ef8fa5..4a9baecd 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1171,12 +1171,18 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code) self->num_lock, self->scroll_lock, self->session->client_info->keylayout); - /*g_printf("%x\n", c);*/ - if (c != 0) + /* this means don't send anything */ + /* used to qvoid sending alt to xserver eg altgr */ + /* if alt state is down, the xserver avoids the keystroke */ + if (c == 1) { - self->mod->mod_event(self->mod, msg, c, 0xffff, + } + else if (c != 0) + { + self->mod->mod_event(self->mod, msg, (unsigned char)c, 0xffff, scan_code, device_flags); - xrdp_add_key_down(self, c, 0xffff, scan_code, device_flags); + xrdp_add_key_down(self, (unsigned char)c, 0xffff, scan_code, + device_flags); } else {