From 422bbf3a8991f30496c20f095bcb03c3e299f07a Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Tue, 24 Jul 2007 05:29:35 +0000 Subject: [PATCH] started work on unicode --- xrdp/lang.c | 222 ++++++++++++++++++++++++++++++++----------------- xrdp/xrdp.h | 2 +- xrdp/xrdp_wm.c | 6 +- 3 files changed, 151 insertions(+), 79 deletions(-) diff --git a/xrdp/lang.c b/xrdp/lang.c index 6bd2e946..0c6728df 100644 --- a/xrdp/lang.c +++ b/xrdp/lang.c @@ -26,7 +26,7 @@ /* us english */ /* non shift chars */ -char en_us_noshift[] = +int en_us_noshift[] = { 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0, @@ -47,7 +47,7 @@ char en_us_noshift[] = }; /* shift chars */ -char en_us_shift[] = +int en_us_shift[] = { 0, 0, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 0, @@ -68,7 +68,7 @@ char en_us_shift[] = }; /* right alt chars */ -char en_us_altgr[] = +int en_us_altgr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -92,7 +92,7 @@ char en_us_altgr[] = /* italy */ /* non shift chars ec*/ -char it_noshift[] = +int it_noshift[] = { 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', 0xec, 0, 0, @@ -113,7 +113,7 @@ char it_noshift[] = }; /* shift chars */ -char it_shift[] = +int it_shift[] = { 0, 0, '!', '"', 0xa3, '$', '%', '&', '/', '(', ')', '=', '?', '^', 0, 0, @@ -134,7 +134,7 @@ char it_shift[] = }; /* right alt chars */ -char it_altgr[] = +int it_altgr[] = { 0, 0, 0, 0, 0, 0, 0x80, 0, '{', 0, 0, '}', 0, 0, 0, 0, @@ -158,7 +158,7 @@ char it_altgr[] = /* Portuguese (Brazil) */ /* non shift chars */ -char pt_br_noshift[] = +int pt_br_noshift[] = { 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0, @@ -179,7 +179,7 @@ char pt_br_noshift[] = }; /* shift chars */ -char pt_br_shift[] = +int pt_br_shift[] = { 0, 0, '!', '@', '#', '$', '%', 0xa8, '&', '*', '(', ')', '_', '+', 0, 0, @@ -200,7 +200,7 @@ char pt_br_shift[] = }; /* right alt chars */ -char pt_br_altgr[] = +int pt_br_altgr[] = { 0, 0, 0xb9, 0xb2, 0xb3, 0xa3, 0xa2, 0xac, 0, 0, 0, 0, 0, 0xa7, 0, 0, @@ -224,7 +224,7 @@ char pt_br_altgr[] = /* uk english */ /* non shift chars */ -char en_uk_noshift[] = +int en_uk_noshift[] = { 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0, @@ -245,7 +245,7 @@ char en_uk_noshift[] = }; /* shift chars */ -char en_uk_shift[] = +int en_uk_shift[] = { 0, 0, '!', '"', 0xa3, '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 0, @@ -266,7 +266,7 @@ char en_uk_shift[] = }; /* right alt chars */ -char en_uk_altgr[] = +int en_uk_altgr[] = { 0, 0, 0, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -290,7 +290,7 @@ char en_uk_altgr[] = /* german */ /* non shift chars */ -char de_noshift[] = +int de_noshift[] = { 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0xdf, 0xb4, 0, 0, @@ -311,7 +311,7 @@ char de_noshift[] = }; /* shift chars */ -char de_shift[] = +int de_shift[] = { 0, 0, '!', '"', 0xa7, '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, 0, @@ -332,7 +332,7 @@ char de_shift[] = }; /* right alt chars */ -char de_altgr[] = +int de_altgr[] = { 0, 0, 0, 0xb2, 0xb3, 0, 0, 0, '{', '[', ']', '}', '\\', 0, 0, 0, @@ -356,7 +356,7 @@ char de_altgr[] = /* french */ /* non shift chars */ -char fr_noshift[] = +int fr_noshift[] = { 0, 0, '&', 0xe9, '"', '\'', '(', '-', 0xe8, '_', 0xe7, 0xe0, ')', '=', 0, 0, @@ -377,7 +377,7 @@ char fr_noshift[] = }; /* shift chars */ -char fr_shift[] = +int fr_shift[] = { 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0xb0, '+', 0, 0, @@ -398,7 +398,7 @@ char fr_shift[] = }; /* right alt chars */ -char fr_altgr[] = +int fr_altgr[] = { 0, 0, 0, '~', '#', '{', '[', '|', '`', '\\', '^', '@', ']', '}', 0, 0, @@ -422,78 +422,144 @@ char fr_altgr[] = /* swedish */ /* non shift chars */ -char se_noshift[] = +int se_noshift[] = { - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '+', 0xb4, 0, 0, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', 0xe5, 0x22, 0, 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xf6, - 0xe4, 0xa7, 0, '\'', 'z', 'x', 'c', 'v', - 'b', 'n', 'm', ',', '.', '-', 0, '*', - 0, ' ', 0, 0, 0, 0, 0, 0, - 0 , 0, 0, 0, 0, 0, 0, '7', - '8', '9', '-', '4', '5', '6', '+', '1', - '2', '3', '0', '.', 0, 0, '<', 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '+', 0x00b4, 0, 0, + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', 0x00e5, 0x0022, 0, 0, 'a', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0x00f6, + 0x00e4, 0x00a7, 0, '\'', 'z', 'x', 'c', 'v', + 'b', 'n', 'm', ',', '.', '-', 0, '*', + 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '7', + '8', '9', '-', '4', '5', '6', '+', '1', + '2', '3', '0', '.', 0, 0, '<', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; /* shift chars */ -char se_shift[] = +int se_shift[] = { - 0, 0, '!', '"', '#', 0xa4, '%', '&', - '/', '(', ')', '=', '?', '`', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', 0xc5, 0x5e, 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xd6, - 0xc4, 0xbd, 0, '*', 'Z', 'X', 'C', 'V', - 'B', 'N', 'M', ';', ':', '_', 0, '*', - 0, ' ', 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, '7', - '8', '9', '-', '4', '5', '6', '+', '1', - '2', '3', '0', '.', 0, 0, '>', 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, '!', '"', '#', 0x00a4, '%', '&', + '/', '(', ')', '=', '?', '`', 0, 0, + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', + 'O', 'P', 0x00c5, 0x005e, 0, 0, 'A', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0x00d6, + 0x00c4, 0x00bd, 0, '*', 'Z', 'X', 'C', 'V', + 'B', 'N', 'M', ';', ':', '_', 0, '*', + 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '7', + '8', '9', '-', '4', '5', '6', '+', '1', + '2', '3', '0', '.', 0, 0, '>', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; /* right alt chars */ -char se_altgr[] = +int se_altgr[] = { - 0, 0, 0, '@', 0xa3, '$', 0, 0, - '{', '[', ']', '}', '\\', 0, 0, 0, - '@', 0, 0x80, 0, 0, 0, 0, 0, - 0, 0, 0, '~', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xb5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, '$', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, '|', 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, '@', 0x00a3, '$', 0, 0, + '{', '[', ']', '}', '\\', 0, 0, 0, + '@', 0, 0x0080, 0, 0, 0, 0, 0, + 0, 0, 0, '~', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0x00b5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, '$', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, '|', 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/*****************************************************************************/ +/* czech - todo */ + +/* non shift chars */ +int cs_noshift[] = +{ + 0, 0, '+', 0x011b, 0x0161, 0x010d, 0x0159, 0x017e, + 0x00fd, 0x00e1, 0x00ed, 0x00e9, '-', '=', 0, 0, + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '[', ']', 0, 0, 'a', 's', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', + 'b', 'n', 'm', ',', '.', '/', 0, '*', + 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '7', + '8', '9', '-', '4', '5', '6', '+', '1', + '2', '3', '0', '.', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* shift chars */ +int cs_shift[] = +{ + 0, 0, '!', '@', '#', '$', '%', '^', + '&', '*', '(', ')', '_', '+', 0, 0, + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', + 'O', 'P', '{', '}', 0, 0, 'A', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', + '"', '~', 0, '|', 'Z', 'X', 'C', 'V', + 'B', 'N', 'M', '<', '>', '?', 0, '*', + 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '7', + '8', '9', '-', '4', '5', '6', '+', '1', + '2', '3', '0', '.', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* right alt chars */ +int cs_altgr[] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; /*****************************************************************************/ -char APP_CC +int APP_CC get_char_from_scan_code(int device_flags, int scan_code, int* keys, int caps_lock, int num_lock, int scroll_lock, int keylayout) { - char rv; - char* keys_noshift; - char* keys_shift; - char* keys_altgr; + int rv; + int* keys_noshift; + int* keys_shift; + int* keys_altgr; int shift; int altgr; int ext; @@ -534,13 +600,19 @@ get_char_from_scan_code(int device_flags, int scan_code, int* keys, keys_shift = se_shift; keys_altgr = se_altgr; } + else if (keylayout == 0x405) /* czech */ + { + keys_noshift = cs_noshift; + keys_shift = cs_shift; + keys_altgr = cs_altgr; + } else /* english us 0x409 */ { keys_noshift = en_us_noshift; keys_shift = en_us_shift; keys_altgr = en_us_altgr; } - /*g_writeln("%d %d %x", scan_code, device_flags, keylayout);*/ + /*g_writeln("%d %d $%x", scan_code, device_flags, keylayout);*/ shift = keys[42] || keys[54]; altgr = keys[56]; /* right alt */ ext = device_flags & 0x0100; diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index c1a99909..63276ebb 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -290,7 +290,7 @@ int APP_CC set_string(char** in_str, const char* in); /* in lang.c */ -char APP_CC +int APP_CC get_char_from_scan_code(int device_flags, int scan_code, int* keys, int caps_lock, int num_lock, int scroll_lock, int keylayout); diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 4fa9f405..a8e57056 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1039,7 +1039,7 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code) { int msg; int key_down_index; - char c; + int c; struct xrdp_key_down* key_down; /*g_printf("count %d\n", self->key_down_list->count);*/ @@ -1091,9 +1091,9 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code) self->session->client_info->keylayout); if (c != 0) { - self->mm->mod->mod_event(self->mm->mod, msg, (unsigned char)c, + self->mm->mod->mod_event(self->mm->mod, msg, c, 0xffff, scan_code, device_flags); - xrdp_add_key_down(self, (unsigned char)c, 0xffff, scan_code, + xrdp_add_key_down(self, c, 0xffff, scan_code, device_flags); } else