diff options
author | jsorg71 <jsorg71> | 2009-08-12 02:13:29 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2009-08-12 02:13:29 +0000 |
commit | 4369219ae305d3616ae65691bfd1fda787ed5281 (patch) | |
tree | 985ccd8d035c40b4ab000e9c1f6c52c476b6d3c1 | |
parent | 85ae1cd27e76204b0a196d9a8dab3d5262a3bb9a (diff) | |
download | xrdp-proprietary-4369219ae305d3616ae65691bfd1fda787ed5281.tar.gz xrdp-proprietary-4369219ae305d3616ae65691bfd1fda787ed5281.zip |
keymap changes
-rw-r--r-- | rdp/rdp.c | 4 | ||||
-rw-r--r-- | vnc/vnc.c | 354 | ||||
-rw-r--r-- | xrdp/lang.c | 1186 | ||||
-rw-r--r-- | xrdp/xrdp.h | 8 | ||||
-rw-r--r-- | xrdp/xrdp_types.h | 16 | ||||
-rw-r--r-- | xrdp/xrdp_wm.c | 13 |
6 files changed, 133 insertions, 1448 deletions
@@ -82,11 +82,11 @@ lib_mod_event(struct mod* mod, int msg, long param1, long param2, { case 15: rdp_rdp_send_input(mod->rdp_layer, s, 0, RDP_INPUT_SCANCODE, - param4, param3, 0); + param2, param1, 0); break; case 16: rdp_rdp_send_input(mod->rdp_layer, s, 0, RDP_INPUT_SCANCODE, - param4, param3, 0); + param2, param1, 0); break; case 17: rdp_rdp_send_input(mod->rdp_layer, s, 0, RDP_INPUT_SYNCHRONIZE, @@ -203,222 +203,6 @@ lib_process_channel_data(struct vnc* v, int chanid, int size, struct stream* s) } /******************************************************************************/ -static int APP_CC -unicode_to_keysym(int unicode) -{ - int keysym; - - switch (unicode) - { - case 0x017e: - keysym = 0x01be; /* XK_zcaron */ - break; - case 0x0401: - keysym = 0x06b3; /* XK_Cyrillic_IO */ - break; - case 0x0410: - keysym = 0x06e1; /* XK_Cyrillic_A */ - break; - case 0x0411: - keysym = 0x06e2; /* XK_Cyrillic_BE */ - break; - case 0x0412: - keysym = 0x06f7; /* XK_Cyrillic_VE */ - break; - case 0x0413: - keysym = 0x06e7; /* XK_Cyrillic_GHE */ - break; - case 0x0414: - keysym = 0x06e4; /* XK_Cyrillic_DE */ - break; - case 0x0415: - keysym = 0x06e5; /* XK_Cyrillic_IE */ - break; - case 0x0416: - keysym = 0x06f6; /* XK_Cyrillic_ZHE */ - break; - case 0x0417: - keysym = 0x06fa; /* XK_Cyrillic_ZE */ - break; - case 0x0418: - keysym = 0x06e9; /* XK_Cyrillic_I */ - break; - case 0x0419: - keysym = 0x06ea; /* XK_Cyrillic_SHORTI */ - break; - case 0x041a: - keysym = 0x06eb; /* XK_Cyrillic_KA */ - break; - case 0x041b: - keysym = 0x06ec; /* XK_Cyrillic_EL */ - break; - case 0x041c: - keysym = 0x06ed; /* XK_Cyrillic_EM */ - break; - case 0x041d: - keysym = 0x06ee; /* XK_Cyrillic_EN */ - break; - case 0x041e: - keysym = 0x06ef; /* XK_Cyrillic_O */ - break; - case 0x041f: - keysym = 0x06f0; /* XK_Cyrillic_PE */ - break; - case 0x0420: - keysym = 0x06f2; /* XK_Cyrillic_ER */ - break; - case 0x0423: - keysym = 0x06f5; /* XK_Cyrillic_U */ - break; - case 0x0424: - keysym = 0x06e6; /* XK_Cyrillic_EF */ - break; - case 0x0425: - keysym = 0x06e8; /* XK_Cyrillic_HA */ - break; - case 0x0426: - keysym = 0x06e3; /* XK_Cyrillic_TSE */ - break; - case 0x0428: - keysym = 0x06fb; /* XK_Cyrillic_SHA */ - break; - case 0x0429: - keysym = 0x06fd; /* XK_Cyrillic_SHCHA */ - break; - case 0x042a: - keysym = 0x06ff; /* XK_Cyrillic_HARDSIGN */ - break; - case 0x042b: - keysym = 0x06f9; /* XK_Cyrillic_YERU */ - break; - case 0x042d: - keysym = 0x06fc; /* XK_Cyrillic_E */ - break; - case 0x042f: - keysym = 0x06f1; /* XK_Cyrillic_YA */ - break; - case 0x0427: - keysym = 0x06fe; /* XK_Cyrillic_CHE */ - break; - case 0x0421: - keysym = 0x06f3; /* XK_Cyrillic_ES */ - break; - case 0x0422: - keysym = 0x06f4; /* XK_Cyrillic_TE */ - break; - case 0x042c: - keysym = 0x06f8; /* XK_Cyrillic_SOFTSIGN */ - break; - case 0x042e: - keysym = 0x06e0; /* XK_Cyrillic_YU */ - break; - case 0x0430: - keysym = 0x06c1; /* XK_Cyrillic_a */ - break; - case 0x0431: - keysym = 0x06c2; /* XK_Cyrillic_be */ - break; - case 0x0432: - keysym = 0x06d7; /* XK_Cyrillic_ve */ - break; - case 0x0433: - keysym = 0x06c7; /* XK_Cyrillic_ghe */ - break; - case 0x0434: - keysym = 0x06c4; /* XK_Cyrillic_de */ - break; - case 0x0435: - keysym = 0x06c5; /* XK_Cyrillic_ie */ - break; - case 0x0436: - keysym = 0x06d6; /* XK_Cyrillic_zhe */ - break; - case 0x0437: - keysym = 0x06da; /* XK_Cyrillic_ze */ - break; - case 0x0438: - keysym = 0x06c9; /* XK_Cyrillic_i */ - break; - case 0x0439: - keysym = 0x06ca; /* XK_Cyrillic_shorti */ - break; - case 0x043a: - keysym = 0x06cb; /* XK_Cyrillic_ka */ - break; - case 0x043b: - keysym = 0x06cc; /* XK_Cyrillic_el */ - break; - case 0x043c: - keysym = 0x06cd; /* XK_Cyrillic_em */ - break; - case 0x043d: - keysym = 0x06ce; /* XK_Cyrillic_en */ - break; - case 0x043e: - keysym = 0x06cf; /* XK_Cyrillic_o */ - break; - case 0x043f: - keysym = 0x06d0; /* XK_Cyrillic_pe */ - break; - case 0x0440: - keysym = 0x06d2; /* XK_Cyrillic_er */ - break; - case 0x0441: - keysym = 0x06d3; /* XK_Cyrillic_es */ - break; - case 0x0442: - keysym = 0x06d4; /* XK_Cyrillic_te */ - break; - case 0x0443: - keysym = 0x06d5; /* XK_Cyrillic_u */ - break; - case 0x0444: - keysym = 0x06c6; /* XK_Cyrillic_ef */ - break; - case 0x0445: - keysym = 0x06c8; /* XK_Cyrillic_ha */ - break; - case 0x0446: - keysym = 0x06c3; /* XK_Cyrillic_tse */ - break; - case 0x0447: - keysym = 0x06de; /* XK_Cyrillic_che */ - break; - case 0x0448: - keysym = 0x06db; /* XK_Cyrillic_sha */ - break; - case 0x0449: - keysym = 0x06dd; /* XK_Cyrillic_shcha */ - break; - case 0x044a: - keysym = 0x06df; /* XK_Cyrillic_hardsign */ - break; - case 0x044b: - keysym = 0x06d9; /* XK_Cyrillic_yeru */ - break; - case 0x044c: - keysym = 0x06d8; /* XK_Cyrillic_softsign */ - break; - case 0x044d: - keysym = 0x06dc; /* XK_Cyrillic_e */ - break; - case 0x044e: - keysym = 0x06c0; /* XK_Cyrillic_yu */ - break; - case 0x044f: - keysym = 0x06d1; /* XK_Cyrillic_ya */ - break; - case 0x0451: - keysym = 0x06a3; /* XK_Cyrillic_io */ - break; - default: - keysym = unicode; - break; - } - return keysym; -} - -/******************************************************************************/ int DEFAULT_CC lib_mod_event(struct vnc* v, int msg, long param1, long param2, long param3, long param4) @@ -457,143 +241,7 @@ lib_mod_event(struct vnc* v, int msg, long param1, long param2, } else if ((msg >= 15) && (msg <= 16)) /* key events */ { - key = 0; - if (param2 == 0xffff) /* ascii char */ - { - key = unicode_to_keysym(param1); - } - else /* non ascii key event */ - { - switch (param1) - { - case 0x0001: /* ecs */ - key = 0xff1b; /* XK_Escape */ - break; - case 0x000e: /* backspace */ - key = 0xff08; /* XK_BackSpace */ - break; - case 0x000f: /* tab(0xff09) or left tab(0xfe20) */ - /* some documentation says don't send left tab */ - /* just send tab and if the shift modifier is down */ - /* the server will know */ - /* for now, sending left tab, I don't know which is best */ - /* nope, sending tab always */ - /* key = (v->shift_state) ? 0xfe20 : 0xff09; */ - key = 0xff09; /* XK_Tab */ - break; - case 0x001c: /* enter */ - key = 0xff0d; /* XK_Return */ - break; - case 0x001d: /* left-right control */ - key = (param2 & 0x0100) ? 0xffe4 : 0xffe3; /* XK_Control_R */ - /* XK_Control_L */ - break; - case 0x002a: /* left shift */ - key = 0xffe1; /* XK_Shift_L */ - v->shift_state = (msg == 15); - break; - case 0x0036: /* right shift */ - key = 0xffe2; /* XK_Shift_R */ - v->shift_state = (msg == 15); - break; - case 0x0038: /* left-right alt */ - if (param2 & 0x0100) /* right alt */ - { - /* only en-us keymap can send right alt(alt-gr) */ - if (v->keylayout == 0x409) /* todo */ - { - key = 0xffea; /* XK_Alt_R */ - } - } - else /* left alt */ - { - key = 0xffe9; /* XK_Alt_L */ - } - break; - case 0x003b: /* F1 */ - key = 0xffbe; /* XK_F1 */ - break; - case 0x003c: /* F2 */ - key = 0xffbf; /* XK_F2 */ - break; - case 0x003d: /* F3 */ - key = 0xffc0; /* XK_F3 */ - break; - case 0x003e: /* F4 */ - key = 0xffc1; /* XK_F4 */ - break; - case 0x003f: /* F5 */ - key = 0xffc2; /* XK_F5 */ - break; - case 0x0040: /* F6 */ - key = 0xffc3; /* XK_F6 */ - break; - case 0x0041: /* F7 */ - key = 0xffc4; /* XK_F7 */ - break; - case 0x0042: /* F8 */ - key = 0xffc5; /* XK_F8 */ - break; - case 0x0043: /* F9 */ - key = 0xffc6; /* XK_F9 */ - break; - case 0x0044: /* F10 */ - key = 0xffc7; /* XK_F10 */ - break; - case 0x0047: /* home */ - key = 0xff50; /* XK_Home */ - break; - case 0x0048: /* up arrow */ - key = 0xff52; /* XK_Up */ - break; - case 0x0049: /* page up */ - key = 0xff55; /* XK_Prior */ - break; - case 0x004b: /* left arrow */ - key = 0xff51; /* XK_Left */ - break; - case 0x004d: /* right arrow */ - key = 0xff53; /* XK_Right */ - break; - case 0x004f: /* end */ - key = 0xff57; /* XK_End */ - break; - case 0x0050: /* down arrow */ - key = 0xff54; /* XK_Down */ - break; - case 0x0051: /* page down */ - key = 0xff56; /* XK_Next */ - break; - case 0x0052: /* insert */ - key = 0xff63; /* XK_Insert */ - break; - case 0x0053: /* delete */ - key = 0xffff; /* XK_Delete */ - break; - case 0x0057: /* F11 */ - key = 0xffc8; /* XK_F11 */ - break; - case 0x0058: /* F12 */ - key = 0xffc9; /* XK_F12 */ - break; - /* not sure about the next three, I don't think rdesktop */ - /* sends them right */ - case 0x0037: /* Print Screen */ - key = 0xff61; /* XK_Print */ - break; - case 0x0046: /* Scroll Lock */ - key = 0xff14; /* XK_Scroll_Lock */ - break; - case 0x0045: /* Pause */ - key = 0xff13; /* XK_Pause */ - break; - default: - g_sprintf(text, "unkown key lib_mod_event msg %d \ -param1 0x%4.4x param2 0x%4.4x", msg, param1, param2); - v->server_msg(v, text, 1); - break; - } - } + key = param3; if (key > 0) { init_stream(s, 8192); diff --git a/xrdp/lang.c b/xrdp/lang.c index c0c51311..256619a2 100644 --- a/xrdp/lang.c +++ b/xrdp/lang.c @@ -23,1042 +23,138 @@ #include "xrdp.h" -/*****************************************************************************/ -/* us english 0x409 */ - -/* non shift chars */ -int en_us_noshift[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '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 -}; - -/* shift chars */ -int en_us_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 -}; - -/* right alt chars */ -int en_us_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 -}; - -/* caps lock chars */ -int en_us_capslock[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '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 -}; - -/* shift caps lock chars */ -int en_us_shiftcapslock[] = -{ - 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 -}; - -/*****************************************************************************/ -/* italy 0x410 */ - -/* non shift chars */ -int it_noshift[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '\'', 0xec, 0, 0, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', 0xe8, '+', 0, 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xf2, - 0xe0, '\\', 0, 0xf9, '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 */ -int it_shift[] = -{ - 0, 0, '!', '"', 0xa3, '$', '%', '&', - '/', '(', ')', '=', '?', '^', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', 0xe9, '*', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xe7, - 0xb0, '|', 0, 0xa7, '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 */ -int it_altgr[] = -{ - 0, 0, 0, 0, 0, 0, 0x20ac, 0, - '{', 0, 0, '}', 0x60, '~', 0, 0, - 0, 0, 0x20ac, 0, 0, 0, 0, 0, - 0, 0, '[', ']', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, '@', - '#', 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int it_capslock[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '\'', 0xec, 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', 0xe8, '+', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xf2, - 0xe0, '\\', 0, 0xf9, '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 -}; - -int it_shiftcapslock[] = -{ - 0, 0, '!', '"', 0xa3, '$', '%', '&', - '/', '(', ')', '=', '?', '^', 0, 0, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', 0xe9, '*', 0, 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xe7, - 0xb0, '|', 0, 0xa7, '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 -}; - -/*****************************************************************************/ -/* Portuguese (Brazil) 0x416 */ - -/* non shift chars */ -int pt_br_noshift[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', 0, 0, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', 0xb4, '[', 0, 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xe7, - '~', '`', 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 */ -int pt_br_shift[] = -{ - 0, 0, '!', '@', '#', '$', '%', 0xa8, - '&', '*', '(', ')', '_', '+', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', '`', '{', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xc7, - '^', '"', 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 */ -int pt_br_altgr[] = -{ - 0, 0, 0xb9, 0xb2, 0xb3, 0xa3, 0xa2, 0xac, - 0, 0, 0, 0, 0, 0xa7, 0, 0, - '/', '?', 0xb0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xaa, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xba, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int pt_br_capslock[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', 0xb4, '[', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xc7, - '~', '`', 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 -}; - -int pt_br_shiftcapslock[] = -{ - 0, 0, '!', '@', '#', '$', '%', 0xa8, - '&', '*', '(', ')', '_', '+', 0, 0, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '`', '{', 0, 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xe7, - '^', '"', 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 +struct codepair +{ + tui8 code1; + tui8 code2; +}; +static struct codepair g_map[] = +{ + { 0, 0 }, { 9, 0 }, { 10, 0 }, { 11, 0 }, { 12, 0 }, /* 0 - 4 */ + { 13, 0 }, { 14, 0 }, { 15, 0 }, { 16, 0 }, { 17, 0 }, /* 5 - 9 */ + { 18, 0 }, { 19, 0 }, { 20, 0 }, { 21, 0 }, { 22, 0 }, /* 10 - 14 */ + { 23, 0 }, { 24, 0 }, { 25, 0 }, { 26, 0 }, { 27, 0 }, /* 15 - 19 */ + { 28, 0 }, { 29, 0 }, { 30, 0 }, { 31, 0 }, { 32, 0 }, /* 20 - 24 */ + { 33, 0 }, { 34, 0 }, { 35, 0 }, { 36, 108 }, { 37, 109 }, /* 25 - 29 */ + { 38, 0 }, { 39, 0 }, { 40, 0 }, { 41, 0 }, { 42, 0 }, /* 30 - 34 */ + { 43, 0 }, { 44, 0 }, { 45, 0 }, { 46, 0 }, { 47, 0 }, /* 35 - 39 */ + { 48, 0 }, { 49, 0 }, { 50, 0 }, { 51, 0 }, { 52, 0 }, /* 40 - 44 */ + { 53, 0 }, { 54, 0 }, { 55, 0 }, { 56, 0 }, { 57, 0 }, /* 45 - 49 */ + { 58, 0 }, { 59, 0 }, { 60, 0 }, { 61, 112 }, { 62, 0 }, /* 50 - 54 */ + { 63, 111 }, { 64, 113 }, { 65, 0 }, { 66, 0 }, { 67, 0 }, /* 55 - 59 */ + { 68, 0 }, { 69, 0 }, { 70, 0 }, { 71, 0 }, { 72, 0 }, /* 60 - 64 */ + { 73, 0 }, { 74, 0 }, { 75, 0 }, { 76, 0 }, { 77, 0 }, /* 65 - 69 */ + { 78, 0 }, { 79, 97 }, { 80, 98 }, { 81, 99 }, { 82, 0 }, /* 70 - 74 */ + { 83, 100 }, { 84, 0 }, { 85, 102 }, { 86, 0 }, { 87, 103 }, /* 75 - 79 */ + { 88, 104 }, { 89, 105 }, { 90, 106 }, { 91, 107 }, { 92, 0 }, /* 80 - 84 */ + { 93, 0 }, { 94, 0 }, { 95, 0 }, { 96, 0 }, { 97, 0 }, /* 85 - 89 */ + { 98, 0 }, { 0, 115 }, { 0, 116 }, { 0, 117 }, { 102, 0 }, /* 90 - 94 */ + { 103, 0 }, { 104, 0 }, { 105, 0 }, { 106, 0 }, { 107, 0 }, /* 95 - 99 */ + { 108, 0 }, { 109, 0 }, { 110, 0 }, { 111, 0 }, { 112, 0 }, /* 100 - 104 */ }; /*****************************************************************************/ -/* uk english 0x809 */ - -/* non shift chars */ -int en_uk_noshift[] = +struct xrdp_key_info* APP_CC +get_key_info_from_scan_code(int device_flags, int scan_code, int* keys, + int caps_lock, int num_lock, int scroll_lock, + struct xrdp_keymap* keymap) { - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '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 -}; - -/* shift chars */ -int en_uk_shift[] = -{ - 0, 0, '!', '"', 0xa3, '$', '%', '^', - '&', '*', '(', ')', '_', '+', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', '{', '}', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', - '@', 0xac, 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 */ -int en_uk_altgr[] = -{ - 0, 0, 0, 0, 0, 0x20ac, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xe9, 0, 0, 0, 0xfa, 0xed, - 0xf3, 0, 0, 0, 0, 0, 0xe1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xa6, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xa6, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int en_uk_capslock[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', '[', ']', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', - '\'', 0xac, 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 -}; - -int en_uk_shiftcapslock[] = -{ - 0, 0, '!', '"', 0xa3, '$', '%', '^', - '&', '*', '(', ')', '_', '+', 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 -}; - -/*****************************************************************************/ -/* german 0x407 */ - -/* non shift chars */ -int de_noshift[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', 0xdf, 0xb4, 0, 0, - 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', - 'o', 'p', 0xfc, '+', 0, 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xf6, - 0xe4, '^', 0, '#', 'y', '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 de_shift[] = -{ - 0, 0, '!', '"', 0xa7, '$', '%', '&', - '/', '(', ')', '=', '?', '`', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', - 'O', 'P', 0xdc, '*', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xd6, - 0xc4, 0xb0, 0, '\'', 'Y', '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 de_altgr[] = -{ - 0, 0, 0, 0xb2, 0xb3, 0, 0, 0, - '{', '[', ']', '}', '\\', 0, 0, 0, - '@', 0, 0x20ac, 0, 0, 0, 0, 0, - 0, 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 -}; - -int de_capslock[] = -{ - 0, 0, '!', '"', 0xa7, '$', '%', '&', - '/', '(', ')', '=', '?', '`', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', - 'O', 'P', 0xdc, '*', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xd6, - 0xc4, 0xb0, 0, '\'', 'Y', '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 -}; - -int de_shiftcapslock[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', 0xdf, 0xb4, 0, 0, - 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', - 'o', 'p', 0xfc, '+', 0, 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xf6, - 0xe4, '^', 0, '#', 'y', '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 -}; - -/*****************************************************************************/ -/* french 0x40c */ - -/* non shift chars */ -int fr_noshift[] = -{ - 0, 0, '&', 0xe9, '"', '\'', '(', '-', - 0xe8, '_', 0xe7, 0xe0, ')', '=', 0, 0, - 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '^', '$', 0, 0, 'q', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', - 0xf9, 0xb2, 0, '*', 'w', 'x', 'c', 'v', - 'b', 'n', ',', ';', ':', '!', 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 fr_shift[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', 0xb0, '+', 0, 0, - 'A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', 0xa8, 0xa3, 0, 0, 'Q', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', - '%', '~', 0, 0xb5, 'W', 'X', 'C', 'V', - 'B', 'N', '?', '.', '/', 0xa7, 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 fr_altgr[] = -{ - 0, 0, 0, '~', '#', '{', '[', '|', - '`', '\\', '^', '@', ']', '}', 0, 0, - 0, 0, 0x20ac, 0, 0, 0, 0, 0, - 0, 0, 0, 0xa4, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int fr_capslock[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int fr_shiftcapslock[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/*****************************************************************************/ -/* swedish 0x41d */ - -/* non shift chars */ -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 -}; - -/* shift chars */ -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 -}; - -/* right alt chars */ -int se_altgr[] = -{ - 0, 0, 0, '@', 0xa3, '$', 0, 0, - '{', '[', ']', '}', '\\', 0, 0, 0, - '@', 0, 0x20ac, 0, 0, 0, 0, 0, - 0, 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 -}; - -int se_capslock[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int se_shiftcapslock[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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 0x405 */ - -/* non shift chars */ -int cs_noshift[] = -{ - 0, 0, '+', 0x11b, 0x161, 0x10d, 0x159, 0x17e, - 0xfd, 0xe1, 0xed, 0xe9, '=', 0xb4, 0, 0, - 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', - 'o', 'p', 0xfa, ')', 0, 0, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0x16f, - 0xa7, ';', 0, 0xa8, 'y', '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, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '%', 0x2c7, 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', - 'O', 'P', '/', '(', 0, 0, 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', '"', - '!', 0xb0, 0, 0x2c7, 'Y', '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, '~', 0x2c7, '^', 0x2d8, 0xb0, 0x2db, - '`', 0xb7, 0xb4, 0x2dd, 0xa8, 0xb8, 0, 0, - '\\', '|', 0x20ac, 0, 0, 0, 0, 0, - 0, 0, 0xf7, 0xd7, 0, 0, 0, 0x111, - 0x110, '[', ']', 0, 0, 0x142, 0x141, '$', - 0xdf, 0, 0, 0, 0, '#', '&', '@', - '{', '}', 0, '<', '>', '*', 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int cs_capslock[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int cs_shiftcapslock[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/*****************************************************************************/ -/* russian 0x419 */ - -/* non shift chars */ -int ru_noshift[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', 0, 0, - 0x439, 0x446, 0x443, 0x43a, 0x435, 0x43d, 0x433, 0x448, - 0x449, 0x437, 0x445, 0x44a, 0, 0, 0x444, 0x44b, - 0x432, 0x430, 0x43f, 0x440, 0x43e, 0x43b, 0x434, 0x436, - 0x44d, 0x451, 0, '\\', 0x44f, 0x447, 0x441, 0x43c, - 0x438, 0x442, 0x44c, 0x431, 0x44e, '.', 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 ru_shift[] = -{ - 0, 0, '!', '"', 0x2116, ';', '%', ':', - '?', '*', '(', ')', '_', '+', 0, 0, - 0x419, 0x426, 0x423, 0x41a, 0x415, 0x41d, 0x413, 0x428, - 0x429, 0x417, 0x425, 0x42a, 0, 0, 0x424, 0x42b, - 0x412, 0x410, 0x41f, 0x420, 0x41e, 0x41b, 0x414, 0x416, - 0x42d, 0x401, 0, '/', 0x42f, 0x427, 0x421, 0x41c, - 0x418, 0x422, 0x42c, 0x411, 0x42e, ',', 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 ru_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 -}; - -int ru_capslock[] = -{ - 0, 0, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', 0, 0, - 0x419, 0x426, 0x423, 0x41a, 0x415, 0x41d, 0x413, 0x428, - 0x429, 0x417, 0x425, 0x42a, 0, 0, 0x424, 0x42b, - 0x412, 0x410, 0x41f, 0x420, 0x41e, 0x41b, 0x414, 0x416, - 0x42d, 0x401, 0, '\\', 0x42f, 0x427, 0x421, 0x41c, - 0x418, 0x422, 0x42c, 0x411, 0x42e, '.', 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 -}; - -int ru_shiftcapslock[] = -{ - 0, 0, '!', '"', 0x2116, ';', '%', ':', - '?', '*', '(', ')', '_', '+', 0, 0, - 0x439, 0x446, 0x443, 0x43a, 0x435, 0x43d, 0x433, 0x448, - 0x449, 0x437, 0x445, 0x44a, 0, 0, 0x444, 0x44b, - 0x432, 0x430, 0x43f, 0x440, 0x43e, 0x43b, 0x434, 0x436, - 0x44d, 0x451, 0, '/', 0x44f, 0x447, 0x441, 0x43c, - 0x438, 0x442, 0x44c, 0x431, 0x44e, ',', 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 -}; - -/*****************************************************************************/ -twchar APP_CC -get_char_from_scan_code(int device_flags, int scan_code, int* keys, - int caps_lock, int num_lock, int scroll_lock, - struct xrdp_keymap* keymap) -{ - int rv; + struct xrdp_key_info* rv; int shift; int altgr; int ext; + int index; - /*g_writeln("%d %d", scan_code, device_flags);*/ + ext = device_flags & 0x0100; shift = keys[42] || keys[54]; altgr = keys[56]; /* right alt */ - ext = device_flags & 0x0100; rv = 0; - if (scan_code >= 128) + scan_code = scan_code % 128; + index = 0; + if (scan_code <= (sizeof(g_map) / sizeof(g_map[0]))) { - scan_code = scan_code % 128; - num_lock = 0; + index = ext ? g_map[scan_code].code2 : g_map[scan_code].code1; } - if (!num_lock) + /* keymap file is created with numlock off so we have to do this */ + if ((index >= 79) && (index <= 91)) { - switch (scan_code) - { - case 71: /* 7 */ - case 72: /* 8 */ - case 73: /* 9 */ - case 75: /* 4 */ - case 76: /* 5 */ - case 77: /* 6 */ - case 79: /* 1 */ - case 80: /* 2 */ - case 81: /* 3 */ - case 82: /* 0 */ - case 83: /* . */ - return (twchar)rv; - } + if (num_lock) + { + rv = &(keymap->keys_shift[index]); + } + else + { + rv = &(keymap->keys_noshift[index]); + } } - if (ext) + else if (shift && caps_lock) { - if (scan_code == 53) - { - rv = '/'; - } + rv = &(keymap->keys_shiftcapslock[index]); + } + else if (shift) + { + rv = &(keymap->keys_shift[index]); + } + else if (caps_lock) + { + rv = &(keymap->keys_capslock[index]); + } + else if (altgr) + { + rv = &(keymap->keys_altgr[index]); } else { - if (shift && caps_lock) - { - rv = keymap->keys_shiftcapslock[scan_code]; - } - else if (shift) - { - rv = keymap->keys_shift[scan_code]; - } - else if (caps_lock) - { - rv = keymap->keys_capslock[scan_code]; - } - else if (altgr) - { - rv = keymap->keys_altgr[scan_code]; - } - else - { - rv = keymap->keys_noshift[scan_code]; - } + rv = &(keymap->keys_noshift[index]); } - return (twchar)rv; + return rv; +} + +/*****************************************************************************/ +int APP_CC +get_keysym_from_scan_code(int device_flags, int scan_code, int* keys, + int caps_lock, int num_lock, int scroll_lock, + struct xrdp_keymap* keymap) +{ + struct xrdp_key_info* ki; + + ki = get_key_info_from_scan_code(device_flags, scan_code, keys, + caps_lock, num_lock, scroll_lock, + keymap); + if (ki == 0) + { + return 0; + } + return ki->sym; +} + +/*****************************************************************************/ +twchar APP_CC +get_char_from_scan_code(int device_flags, int scan_code, int* keys, + int caps_lock, int num_lock, int scroll_lock, + struct xrdp_keymap* keymap) +{ + struct xrdp_key_info* ki; + + ki = get_key_info_from_scan_code(device_flags, scan_code, keys, + caps_lock, num_lock, scroll_lock, + keymap); + if (ki == 0) + { + return 0; + } + return (twchar)(ki->chr); } /*****************************************************************************/ static int APP_CC -km_read_section(int fd, const char* section_name, int* keymap) +km_read_section(int fd, const char* section_name, struct xrdp_key_info* keymap) { struct list* names; struct list* values; int index; int code; + int pos1; char* name; char* value; @@ -1084,14 +180,12 @@ km_read_section(int fd, const char* section_name, int* keymap) } if ((code >= 0) && (code < 128)) { - if (g_strncasecmp(value, "0x", 2) == 0) - { - keymap[code] = g_htoi(value + 2); - } - else + pos1 = g_pos(value, ":"); + if (pos1 >= 0) { - keymap[code] = g_atoi(value); + keymap[code].chr = g_atoi(value + pos1 + 1); } + keymap[code].sym = g_atoi(value); } } } @@ -1111,72 +205,6 @@ get_keymaps(int keylayout, struct xrdp_keymap* keymap) struct xrdp_keymap lkeymap; ks = sizeof(int) * 128; - switch (keylayout) - { - case 0x40c: /* france */ - g_memcpy(keymap->keys_noshift, fr_noshift, ks); - g_memcpy(keymap->keys_shift, fr_shift, ks); - g_memcpy(keymap->keys_altgr, fr_altgr, ks); - g_memcpy(keymap->keys_capslock, fr_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, fr_shiftcapslock, ks); - break; - case 0x809: /* en-uk or en-gb */ - g_memcpy(keymap->keys_noshift, en_uk_noshift, ks); - g_memcpy(keymap->keys_shift, en_uk_shift, ks); - g_memcpy(keymap->keys_altgr, en_uk_altgr, ks); - g_memcpy(keymap->keys_capslock, en_uk_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, en_uk_shiftcapslock, ks); - break; - case 0x407: /* german */ - g_memcpy(keymap->keys_noshift, de_noshift, ks); - g_memcpy(keymap->keys_shift, de_shift, ks); - g_memcpy(keymap->keys_altgr, de_altgr, ks); - g_memcpy(keymap->keys_capslock, de_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, de_shiftcapslock, ks); - break; - case 0x416: /* Portuguese (Brazil) */ - g_memcpy(keymap->keys_noshift, pt_br_noshift, ks); - g_memcpy(keymap->keys_shift, pt_br_shift, ks); - g_memcpy(keymap->keys_altgr, pt_br_altgr, ks); - g_memcpy(keymap->keys_capslock, pt_br_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, pt_br_shiftcapslock, ks); - break; - case 0x410: /* italy */ - g_memcpy(keymap->keys_noshift, it_noshift, ks); - g_memcpy(keymap->keys_shift, it_shift, ks); - g_memcpy(keymap->keys_altgr, it_altgr, ks); - g_memcpy(keymap->keys_capslock, it_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, it_shiftcapslock, ks); - break; - case 0x41d: /* swedish */ - g_memcpy(keymap->keys_noshift, se_noshift, ks); - g_memcpy(keymap->keys_shift, se_shift, ks); - g_memcpy(keymap->keys_altgr, se_altgr, ks); - g_memcpy(keymap->keys_capslock, se_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, se_shiftcapslock, ks); - break; - case 0x405: /* czech */ - g_memcpy(keymap->keys_noshift, cs_noshift, ks); - g_memcpy(keymap->keys_shift, cs_shift, ks); - g_memcpy(keymap->keys_altgr, cs_altgr, ks); - g_memcpy(keymap->keys_capslock, cs_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, cs_shiftcapslock, ks); - break; - case 0x419: /* russian */ - g_memcpy(keymap->keys_noshift, ru_noshift, ks); - g_memcpy(keymap->keys_shift, ru_shift, ks); - g_memcpy(keymap->keys_altgr, ru_altgr, ks); - g_memcpy(keymap->keys_capslock, ru_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, ru_shiftcapslock, ks); - break; - default: /* default 0x409 us en */ - g_memcpy(keymap->keys_noshift, en_us_noshift, ks); - g_memcpy(keymap->keys_shift, en_us_shift, ks); - g_memcpy(keymap->keys_altgr, en_us_altgr, ks); - g_memcpy(keymap->keys_capslock, en_us_capslock, ks); - g_memcpy(keymap->keys_shiftcapslock, en_us_shiftcapslock, ks); - break; - } /* check if there is a keymap file */ g_snprintf(filename, 255, "%s/km-%4.4x.ini", XRDP_CFG_PATH, keylayout); if (g_file_exist(filename)) diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index 14c5ea0b..5742a72a 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -307,6 +307,14 @@ int APP_CC wchar_repeat(twchar* dest, int dest_size_in_wchars, twchar ch, int repeat); /* in lang.c */ +struct xrdp_key_info* APP_CC +get_key_info_from_scan_code(int device_flags, int scan_code, int* keys, + int caps_lock, int num_lock, int scroll_lock, + struct xrdp_keymap* keymap); +int APP_CC +get_keysym_from_scan_code(int device_flags, int scan_code, int* keys, + int caps_lock, int num_lock, int scroll_lock, + struct xrdp_keymap* keymap); twchar APP_CC get_char_from_scan_code(int device_flags, int scan_code, int* keys, int caps_lock, int num_lock, int scroll_lock, diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index 146aa364..97466af4 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -191,13 +191,19 @@ struct xrdp_mm int chan_trans_up; }; +struct xrdp_key_info +{ + int sym; + int chr; +}; + struct xrdp_keymap { - int keys_noshift[128]; - int keys_shift[128]; - int keys_altgr[128]; - int keys_capslock[128]; - int keys_shiftcapslock[128]; + struct xrdp_key_info keys_noshift[128]; + struct xrdp_key_info keys_shift[128]; + struct xrdp_key_info keys_altgr[128]; + struct xrdp_key_info keys_capslock[128]; + struct xrdp_key_info keys_shiftcapslock[128]; }; /* the window manager */ diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 1bdc961f..ed55efd3 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1090,7 +1090,7 @@ int APP_CC xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code) { int msg; - int c; + struct xrdp_key_info* ki; /*g_printf("count %d\n", self->key_down_list->count);*/ scan_code = scan_code % 128; @@ -1125,19 +1125,14 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code) { if (self->mm->mod->mod_event != 0) { - c = get_char_from_scan_code + ki = get_key_info_from_scan_code (device_flags, scan_code, self->keys, self->caps_lock, self->num_lock, self->scroll_lock, &(self->keymap)); - if (c != 0) - { - self->mm->mod->mod_event(self->mm->mod, msg, c, - 0xffff, scan_code, device_flags); - } - else + if (ki != 0) { self->mm->mod->mod_event(self->mm->mod, msg, scan_code, - device_flags, scan_code, device_flags); + device_flags, ki->sym, ki->chr); } } } |