[locale,xkbfile] improve mapping

* Add missing keycodes to mapping
* Use sorted list to create mapping table
This commit is contained in:
Armin Novak 2024-04-02 13:10:13 +02:00 committed by akallabeth
parent 18612bb513
commit e5799ec947

View File

@ -47,265 +47,254 @@ typedef struct
} XKB_KEY_NAME_SCANCODE; } XKB_KEY_NAME_SCANCODE;
static const XKB_KEY_NAME_SCANCODE XKB_KEY_NAME_SCANCODE_TABLE[] = { static const XKB_KEY_NAME_SCANCODE XKB_KEY_NAME_SCANCODE_TABLE[] = {
{ "AB00", RDP_SCANCODE_LSHIFT }, { "", RDP_SCANCODE_UNKNOWN }, /* 008: [(null)] */
{ "AB01", RDP_SCANCODE_KEY_Z }, // evdev 52 { "ESC", RDP_SCANCODE_ESCAPE }, /* 009: ESC [Escape] */
{ "AB02", RDP_SCANCODE_KEY_X }, // evdev 53 { "AE01", RDP_SCANCODE_KEY_1 }, /* 010: AE01 [1] */
{ "AB03", RDP_SCANCODE_KEY_C }, // evdev 54 { "AE02", RDP_SCANCODE_KEY_2 }, /* 011: AE02 [2] */
{ "AB04", RDP_SCANCODE_KEY_V }, // evdev 55 { "AE03", RDP_SCANCODE_KEY_3 }, /* 012: AE03 [3] */
{ "AB05", RDP_SCANCODE_KEY_B }, // evdev 56 { "AE04", RDP_SCANCODE_KEY_4 }, /* 013: AE04 [4] */
{ "AB06", RDP_SCANCODE_KEY_N }, // evdev 57 { "AE05", RDP_SCANCODE_KEY_5 }, /* 014: AE05 [5] */
{ "AB07", RDP_SCANCODE_KEY_M }, // evdev 58 { "AE06", RDP_SCANCODE_KEY_6 }, /* 015: AE06 [6] */
{ "AB08", RDP_SCANCODE_OEM_COMMA }, // evdev 59 { "AE07", RDP_SCANCODE_KEY_7 }, /* 016: AE07 [7] */
{ "AB09", RDP_SCANCODE_OEM_PERIOD }, // evdev 60 { "AE08", RDP_SCANCODE_KEY_8 }, /* 017: AE08 [8] */
{ "AB10", RDP_SCANCODE_OEM_2 }, // evdev 61. Not KP, not RDP_SCANCODE_DIVIDE { "AE09", RDP_SCANCODE_KEY_9 }, /* 018: AE09 [9] */
{ "AB11", RDP_SCANCODE_ABNT_C1 }, // evdev 97. Brazil backslash/underscore. { "AE10", RDP_SCANCODE_KEY_0 }, /* 019: AE10 [0] */
{ "AC01", RDP_SCANCODE_KEY_A }, // evdev 38 { "AE11", RDP_SCANCODE_OEM_MINUS }, /* 020: AE11 [minus] */
{ "AC02", RDP_SCANCODE_KEY_S }, // evdev 39 { "AE12", RDP_SCANCODE_OEM_PLUS }, /* 021: AE12 [equal] */
{ "AC03", RDP_SCANCODE_KEY_D }, // evdev 40 { "BKSP", RDP_SCANCODE_BACKSPACE }, /* 022: BKSP [BackSpace] */
{ "AC04", RDP_SCANCODE_KEY_F }, // evdev 41 { "TAB", RDP_SCANCODE_TAB }, /* 023: TAB [Tab] */
{ "AC05", RDP_SCANCODE_KEY_G }, // evdev 42 { "AD01", RDP_SCANCODE_KEY_Q }, /* 024: AD01 [q] */
{ "AC06", RDP_SCANCODE_KEY_H }, // evdev 43 { "AD02", RDP_SCANCODE_KEY_W }, /* 025: AD02 [w] */
{ "AC07", RDP_SCANCODE_KEY_J }, // evdev 44 { "AD03", RDP_SCANCODE_KEY_E }, /* 026: AD03 [e] */
{ "AC08", RDP_SCANCODE_KEY_K }, // evdev 45 { "AD04", RDP_SCANCODE_KEY_R }, /* 027: AD04 [r] */
{ "AC09", RDP_SCANCODE_KEY_L }, // evdev 46 { "AD05", RDP_SCANCODE_KEY_T }, /* 028: AD05 [t] */
{ "AC10", RDP_SCANCODE_OEM_1 }, // evdev 47 { "AD06", RDP_SCANCODE_KEY_Y }, /* 029: AD06 [y] */
{ "AC11", RDP_SCANCODE_OEM_7 }, // evdev 48 { "AD07", RDP_SCANCODE_KEY_U }, /* 030: AD07 [u] */
{ "AC12", RDP_SCANCODE_OEM_5 }, // alias of evdev 51 backslash { "AD08", RDP_SCANCODE_KEY_I }, /* 031: AD08 [i] */
{ "AD01", RDP_SCANCODE_KEY_Q }, // evdev 24 { "AD09", RDP_SCANCODE_KEY_O }, /* 032: AD09 [o] */
{ "AD02", RDP_SCANCODE_KEY_W }, // evdev 25 { "AD10", RDP_SCANCODE_KEY_P }, /* 033: AD10 [p] */
{ "AD03", RDP_SCANCODE_KEY_E }, // evdev 26 { "AD11", RDP_SCANCODE_OEM_4 }, /* 034: AD11 [bracketleft] */
{ "AD04", RDP_SCANCODE_KEY_R }, // evdev 27 { "AD12", RDP_SCANCODE_OEM_6 }, /* 035: AD12 [bracketright] */
{ "AD05", RDP_SCANCODE_KEY_T }, // evdev 28 { "RTRN", RDP_SCANCODE_RETURN }, /* 036: RTRN [Return] */
{ "AD06", RDP_SCANCODE_KEY_Y }, // evdev 29 { "LCTL", RDP_SCANCODE_LCONTROL }, /* 037: LCTL [Control_L] */
{ "AD07", RDP_SCANCODE_KEY_U }, // evdev 30 { "AC01", RDP_SCANCODE_KEY_A }, /* 038: AC01 [a] */
{ "AD08", RDP_SCANCODE_KEY_I }, // evdev 31 { "AC02", RDP_SCANCODE_KEY_S }, /* 039: AC02 [s] */
{ "AD09", RDP_SCANCODE_KEY_O }, // evdev 32 { "AC03", RDP_SCANCODE_KEY_D }, /* 040: AC03 [d] */
{ "AD10", RDP_SCANCODE_KEY_P }, // evdev 33 { "AC04", RDP_SCANCODE_KEY_F }, /* 041: AC04 [f] */
{ "AD11", RDP_SCANCODE_OEM_4 }, // evdev 34 { "AC05", RDP_SCANCODE_KEY_G }, /* 042: AC05 [g] */
{ "AD12", RDP_SCANCODE_OEM_6 }, // evdev 35 { "AC06", RDP_SCANCODE_KEY_H }, /* 043: AC06 [h] */
{ "AE00", RDP_SCANCODE_OEM_3 }, { "AC07", RDP_SCANCODE_KEY_J }, /* 044: AC07 [j] */
{ "AE01", RDP_SCANCODE_KEY_1 }, // evdev 10 { "AC08", RDP_SCANCODE_KEY_K }, /* 045: AC08 [k] */
{ "AE02", RDP_SCANCODE_KEY_2 }, // evdev 11 { "AC09", RDP_SCANCODE_KEY_L }, /* 046: AC09 [l] */
{ "AE03", RDP_SCANCODE_KEY_3 }, // evdev 12 { "AC10", RDP_SCANCODE_OEM_1 }, /* 047: AC10 [semicolon] */
{ "AE04", RDP_SCANCODE_KEY_4 }, // evdev 13 { "AC11", RDP_SCANCODE_OEM_7 }, /* 048: AC11 [dead_acute] */
{ "AE05", RDP_SCANCODE_KEY_5 }, // evdev 14 { "TLDE", RDP_SCANCODE_OEM_3 }, /* 049: TLDE [dead_grave] */
{ "AE06", RDP_SCANCODE_KEY_6 }, // evdev 15 { "LFSH", RDP_SCANCODE_LSHIFT }, /* 050: LFSH [Shift_L] */
{ "AE07", RDP_SCANCODE_KEY_7 }, // evdev 16 { "BKSL", RDP_SCANCODE_OEM_5 }, /* 051: BKSL [backslash] */
{ "AE08", RDP_SCANCODE_KEY_8 }, // evdev 17 { "AB01", RDP_SCANCODE_KEY_Z }, /* 052: AB01 [z] */
{ "AE09", RDP_SCANCODE_KEY_9 }, // evdev 18 { "AB02", RDP_SCANCODE_KEY_X }, /* 053: AB02 [x] */
{ "AE10", RDP_SCANCODE_KEY_0 }, // evdev 19 { "AB03", RDP_SCANCODE_KEY_C }, /* 054: AB03 [c] */
{ "AE11", RDP_SCANCODE_OEM_MINUS }, // evdev 20 { "AB04", RDP_SCANCODE_KEY_V }, /* 055: AB04 [v] */
{ "AE12", RDP_SCANCODE_OEM_PLUS }, // evdev 21 { "AB05", RDP_SCANCODE_KEY_B }, /* 056: AB05 [b] */
{ "AE13", RDP_SCANCODE_BACKSLASH_JP }, // JP 132 Yen next to backspace { "AB06", RDP_SCANCODE_KEY_N }, /* 057: AB06 [n] */
// { "AGAI", RDP_SCANCODE_ }, // evdev 137 { "AB07", RDP_SCANCODE_KEY_M }, /* 058: AB07 [m] */
{ "ALGR", RDP_SCANCODE_RMENU }, // alias of evdev 108 RALT { "AB08", RDP_SCANCODE_OEM_COMMA }, /* 059: AB08 [comma] */
{ "ALT", RDP_SCANCODE_LMENU }, // evdev 204, fake keycode for virtual key { "AB09", RDP_SCANCODE_OEM_PERIOD }, /* 060: AB09 [period] */
{ "BKSL", RDP_SCANCODE_OEM_5 }, // evdev 51 { "AB10", RDP_SCANCODE_OEM_2 }, /* 061: AB10 [slash] */
{ "BKSP", RDP_SCANCODE_BACKSPACE }, // evdev 22 { "RTSH", RDP_SCANCODE_RSHIFT }, /* 062: RTSH [Shift_R] */
// { "BRK", RDP_SCANCODE_ }, // evdev 419 { "KPMU", RDP_SCANCODE_MULTIPLY }, /* 063: KPMU [KP_Multiply] */
{ "CAPS", RDP_SCANCODE_CAPSLOCK }, // evdev 66 { "LALT", RDP_SCANCODE_LMENU }, /* 064: LALT [Alt_L] */
{ "COMP", RDP_SCANCODE_APPS }, // evdev 135 { "SPCE", RDP_SCANCODE_SPACE }, /* 065: SPCE [space] */
// { "COPY", RDP_SCANCODE_ }, // evdev 141 { "CAPS", RDP_SCANCODE_CAPSLOCK }, /* 066: CAPS [Caps_Lock] */
// { "CUT", RDP_SCANCODE_ }, // evdev 145 { "FK01", RDP_SCANCODE_F1 }, /* 067: FK01 [F1] */
{ "DELE", RDP_SCANCODE_DELETE }, // evdev 119 { "FK02", RDP_SCANCODE_F2 }, /* 068: FK02 [F2] */
{ "DOWN", RDP_SCANCODE_DOWN }, // evdev 116 { "FK03", RDP_SCANCODE_F3 }, /* 069: FK03 [F3] */
{ "END", RDP_SCANCODE_END }, // evdev 115 { "FK04", RDP_SCANCODE_F4 }, /* 070: FK04 [F4] */
{ "ESC", RDP_SCANCODE_ESCAPE }, // evdev 9 { "FK05", RDP_SCANCODE_F5 }, /* 071: FK05 [F5] */
// { "FIND", RDP_SCANCODE_ }, // evdev 144 { "FK06", RDP_SCANCODE_F6 }, /* 072: FK06 [F6] */
{ "FK01", RDP_SCANCODE_F1 }, // evdev 67 { "FK07", RDP_SCANCODE_F7 }, /* 073: FK07 [F7] */
{ "FK02", RDP_SCANCODE_F2 }, // evdev 68 { "FK08", RDP_SCANCODE_F8 }, /* 074: FK08 [F8] */
{ "FK03", RDP_SCANCODE_F3 }, // evdev 69 { "FK09", RDP_SCANCODE_F9 }, /* 075: FK09 [F9] */
{ "FK04", RDP_SCANCODE_F4 }, // evdev 70 { "FK10", RDP_SCANCODE_F10 }, /* 076: FK10 [F10] */
{ "FK05", RDP_SCANCODE_F5 }, // evdev 71 { "NMLK", RDP_SCANCODE_NUMLOCK }, /* 077: NMLK [Num_Lock] */
{ "FK06", RDP_SCANCODE_F6 }, // evdev 72 { "SCLK", RDP_SCANCODE_SCROLLLOCK }, /* 078: SCLK [Multi_key] */
{ "FK07", RDP_SCANCODE_F7 }, // evdev 73 { "KP7", RDP_SCANCODE_NUMPAD7 }, /* 079: KP7 [KP_Home] */
{ "FK08", RDP_SCANCODE_F8 }, // evdev 74 { "KP8", RDP_SCANCODE_NUMPAD8 }, /* 080: KP8 [KP_Up] */
{ "FK09", RDP_SCANCODE_F9 }, // evdev 75 { "KP9", RDP_SCANCODE_NUMPAD9 }, /* 081: KP9 [KP_Prior] */
{ "FK10", RDP_SCANCODE_F10 }, // evdev 76 { "KPSU", RDP_SCANCODE_SUBTRACT }, /* 082: KPSU [KP_Subtract] */
{ "FK11", RDP_SCANCODE_F11 }, // evdev 95 { "KP4", RDP_SCANCODE_NUMPAD4 }, /* 083: KP4 [KP_Left] */
{ "FK12", RDP_SCANCODE_F12 }, // evdev 96 { "KP5", RDP_SCANCODE_NUMPAD5 }, /* 084: KP5 [KP_Begin] */
{ "FK13", RDP_SCANCODE_F13 }, // evdev 191 { "KP6", RDP_SCANCODE_NUMPAD6 }, /* 085: KP6 [KP_Right] */
{ "FK14", RDP_SCANCODE_F14 }, // evdev 192 { "KPAD", RDP_SCANCODE_ADD }, /* 086: KPAD [KP_Add] */
{ "FK15", RDP_SCANCODE_F15 }, // evdev 193 { "KP1", RDP_SCANCODE_NUMPAD1 }, /* 087: KP1 [KP_End] */
{ "FK16", RDP_SCANCODE_F16 }, // evdev 194 { "KP2", RDP_SCANCODE_NUMPAD2 }, /* 088: KP2 [KP_Down] */
{ "FK17", RDP_SCANCODE_F17 }, // evdev 195 { "KP3", RDP_SCANCODE_NUMPAD3 }, /* 089: KP3 [KP_Next] */
{ "FK18", RDP_SCANCODE_F18 }, // evdev 196 { "KP0", RDP_SCANCODE_NUMPAD0 }, /* 090: KP0 [KP_Insert] */
{ "FK19", RDP_SCANCODE_F19 }, // evdev 197 { "KPDL", RDP_SCANCODE_DECIMAL }, /* 091: KPDL [KP_Delete] */
{ "FK20", RDP_SCANCODE_F20 }, // evdev 198 { "LVL3", RDP_SCANCODE_RMENU }, /* 092: LVL3 [ISO_Level3_Shift] */
{ "FK21", RDP_SCANCODE_F21 }, // evdev 199 { "", RDP_SCANCODE_UNKNOWN }, /* 093: [(null)] */
{ "FK22", RDP_SCANCODE_F22 }, // evdev 200 { "LSGT", RDP_SCANCODE_OEM_102 }, /* 094: LSGT [backslash] */
{ "FK23", RDP_SCANCODE_F23 }, // evdev 201 { "FK11", RDP_SCANCODE_F11 }, /* 095: FK11 [F11] */
{ "FK24", RDP_SCANCODE_F24 }, // evdev 202 { "FK12", RDP_SCANCODE_F12 }, /* 096: FK12 [F12] */
// { "FRNT", RDP_SCANCODE_ }, // evdev 140 { "AB11", RDP_SCANCODE_ABNT_C1 }, /* 097: AB11 [(null)] */
{ "HANJ", RDP_SCANCODE_HANJA }, { "KATA", RDP_SCANCODE_KANA_HANGUL }, /* 098: KATA [Katakana] */
{ "HELP", RDP_SCANCODE_HELP }, // evdev 146 { "HIRA", RDP_SCANCODE_HIRAGANA }, /* 099: HIRA [Hiragana] */
{ "HENK", RDP_SCANCODE_CONVERT_JP }, // JP evdev 100 Henkan { "HENK", RDP_SCANCODE_CONVERT_JP }, /* 100: HENK [Henkan_Mode] */
{ "HIRA", RDP_SCANCODE_HIRAGANA }, // JP evdev 99 Hiragana { "HKTG", RDP_SCANCODE_HIRAGANA }, /* 101: HKTG [Hiragana_Katakana] */
{ "HJCV", RDP_SCANCODE_HANJA }, // KR evdev 131 Hangul->Hanja { "MUHE", RDP_SCANCODE_NONCONVERT_JP }, /* 102: MUHE [Muhenkan] */
{ "HKTG", RDP_SCANCODE_HIRAGANA }, // JP evdev 101 Hiragana/Katakana toggle { "JPCM", RDP_SCANCODE_UNKNOWN }, /* 103: JPCM [(null)] */
{ "HNGL", RDP_SCANCODE_HANGUL }, // KR evdev 130 Hangul/Latin toggle { "KPEN", RDP_SCANCODE_RETURN_KP }, /* 104: KPEN [KP_Enter] */
{ "HOME", RDP_SCANCODE_HOME }, // evdev 110 { "RCTL", RDP_SCANCODE_RCONTROL }, /* 105: RCTL [Control_R] */
{ "HYPR", RDP_SCANCODE_LWIN }, // evdev 207, fake keycode for virtual key { "KPDV", RDP_SCANCODE_DIVIDE }, /* 106: KPDV [KP_Divide] */
{ "HZTG", RDP_SCANCODE_OEM_3 }, // JP alias of evdev 49 { "PRSC", RDP_SCANCODE_PRINTSCREEN }, /* 107: PRSC [Print] */
// { "I120", RDP_SCANCODE_ }, // evdev 120 KEY_MACRO { "RALT", RDP_SCANCODE_RMENU }, /* 108: RALT [ISO_Level3_Shift] */
// { "I126", RDP_SCANCODE_ }, // evdev 126 KEY_KPPLUSMINUS { "LNFD", RDP_SCANCODE_UNKNOWN }, /* 109: LNFD [Linefeed] */
// { "I128", RDP_SCANCODE_ }, // evdev 128 KEY_SCALE { "HOME", RDP_SCANCODE_HOME }, /* 110: HOME [Home] */
{ "I129", RDP_SCANCODE_ABNT_C2 }, // evdev 129 KEY_KPCOMMA Brazil { "UP", RDP_SCANCODE_UP }, /* 111: UP [Up] */
// { "I147", RDP_SCANCODE_ }, // evdev 147 KEY_MENU { "PGUP", RDP_SCANCODE_PRIOR }, /* 112: PGUP [Prior] */
// { "I148", RDP_SCANCODE_ }, // evdev 148 KEY_CALC { "LEFT", RDP_SCANCODE_LEFT }, /* 113: LEFT [Left] */
// { "I149", RDP_SCANCODE_ }, // evdev 149 KEY_SETUP { "RGHT", RDP_SCANCODE_RIGHT }, /* 114: RGHT [Right] */
{ "I150", RDP_SCANCODE_SLEEP }, // evdev 150 KEY_SLEEP { "END", RDP_SCANCODE_END }, /* 115: END [End] */
// { "I151", RDP_SCANCODE_ }, // evdev 151 KEY_WAKEUP { "DOWN", RDP_SCANCODE_DOWN }, /* 116: DOWN [Down] */
// { "I152", RDP_SCANCODE_ }, // evdev 152 KEY_FILE { "PGDN", RDP_SCANCODE_NEXT }, /* 117: PGDN [Next] */
// { "I153", RDP_SCANCODE_ }, // evdev 153 KEY_SENDFILE { "INS", RDP_SCANCODE_INSERT }, /* 118: INS [Insert] */
// { "I154", RDP_SCANCODE_ }, // evdev 154 KEY_DELETEFILE { "DELE", RDP_SCANCODE_DELETE }, /* 119: DELE [Delete] */
// { "I155", RDP_SCANCODE_ }, // evdev 155 KEY_XFER { "I120", RDP_SCANCODE_UNKNOWN }, /* 120: I120 [(null)] */
// { "I156", RDP_SCANCODE_ }, // evdev 156 KEY_PROG1 VK_LAUNCH_APP1 { "MUTE", RDP_SCANCODE_VOLUME_MUTE }, /* 121: MUTE [XF86AudioMute] */
// { "I157", RDP_SCANCODE_ }, // evdev 157 KEY_PROG2 VK_LAUNCH_APP2 { "VOL-", RDP_SCANCODE_VOLUME_DOWN }, /* 122: VOL- [XF86AudioLowerVolume] */
// { "I158", RDP_SCANCODE_ }, // evdev 158 KEY_WWW { "VOL+", RDP_SCANCODE_VOLUME_UP }, /* 123: VOL+ [XF86AudioRaiseVolume] */
// { "I159", RDP_SCANCODE_ }, // evdev 159 KEY_MSDOS { "POWR", RDP_SCANCODE_UNKNOWN }, /* 124: POWR [XF86PowerOff] */
// { "I160", RDP_SCANCODE_ }, // evdev 160 KEY_COFFEE { "KPEQ", RDP_SCANCODE_UNKNOWN }, /* 125: KPEQ [KP_Equal] */
// { "I161", RDP_SCANCODE_ }, // evdev 161 KEY_DIRECTION { "I126", RDP_SCANCODE_UNKNOWN }, /* 126: I126 [plusminus] */
// { "I162", RDP_SCANCODE_ }, // evdev 162 KEY_CYCLEWINDOWS { "PAUS", RDP_SCANCODE_PAUSE }, /* 127: PAUS [Pause] */
{ "I163", RDP_SCANCODE_LAUNCH_MAIL }, // evdev 163 KEY_MAIL { "I128", RDP_SCANCODE_LAUNCH_MEDIA_SELECT }, /* 128: I128 [XF86LaunchA] */
{ "I164", RDP_SCANCODE_BROWSER_FAVORITES }, // evdev 164 KEY_BOOKMARKS { "I129", RDP_SCANCODE_ABNT_C2 }, /* 129: I129 [KP_Decimal] */
// { "I165", RDP_SCANCODE_ }, // evdev 165 KEY_COMPUTER { "HNGL", RDP_SCANCODE_HANGUL }, /* 130: HNGL [Hangul] */
{ "I166", RDP_SCANCODE_BROWSER_BACK }, // evdev 166 KEY_BACK { "HJCV", RDP_SCANCODE_HANJA }, /* 131: HJCV [Hangul_Hanja] */
{ "I167", RDP_SCANCODE_BROWSER_FORWARD }, // evdev 167 KEY_FORWARD { "AE13", RDP_SCANCODE_BACKSLASH_JP }, /* 132: AE13 [(null)] */
// { "I168", RDP_SCANCODE_ }, // evdev 168 KEY_CLOSECD { "LWIN", RDP_SCANCODE_LWIN }, /* 133: LWIN [Super_L] */
// { "I169", RDP_SCANCODE_ }, // evdev 169 KEY_EJECTCD { "RWIN", RDP_SCANCODE_RWIN }, /* 134: RWIN [Super_R] */
// { "I170", RDP_SCANCODE_ }, // evdev 170 KEY_EJECTCLOSECD { "COMP", RDP_SCANCODE_APPS }, /* 135: COMP [Menu] */
{ "I171", RDP_SCANCODE_MEDIA_NEXT_TRACK }, // evdev 171 KEY_NEXTSONG { "STOP", RDP_SCANCODE_BROWSER_STOP }, /* 136: STOP [Cancel] */
{ "I172", RDP_SCANCODE_MEDIA_PLAY_PAUSE }, // evdev 172 KEY_PLAYPAUSE { "AGAI", RDP_SCANCODE_UNKNOWN }, /* 137: AGAI [Redo] */
{ "I173", RDP_SCANCODE_MEDIA_PREV_TRACK }, // evdev 173 KEY_PREVIOUSSONG { "PROP", RDP_SCANCODE_UNKNOWN }, /* 138: PROP [SunProps] */
{ "I174", RDP_SCANCODE_MEDIA_STOP }, // evdev 174 KEY_STOPCD { "UNDO", RDP_SCANCODE_UNKNOWN }, /* 139: UNDO [Undo] */
// { "I175", RDP_SCANCODE_ }, // evdev 175 KEY_RECORD 167 { "FRNT", RDP_SCANCODE_UNKNOWN }, /* 140: FRNT [SunFront] */
// { "I176", RDP_SCANCODE_ }, // evdev 176 KEY_REWIND { "COPY", RDP_SCANCODE_UNKNOWN }, /* 141: COPY [XF86Copy] */
// { "I177", RDP_SCANCODE_ }, // evdev 177 KEY_PHONE { "OPEN", RDP_SCANCODE_UNKNOWN }, /* 142: OPEN [XF86Open] */
// { "I178", RDP_SCANCODE_ }, // evdev 178 KEY_ISO { "PAST", RDP_SCANCODE_UNKNOWN }, /* 143: PAST [XF86Paste] */
// { "I179", RDP_SCANCODE_ }, // evdev 179 KEY_CONFIG { "FIND", RDP_SCANCODE_UNKNOWN }, /* 144: FIND [Find] */
{ "I180", RDP_SCANCODE_BROWSER_HOME }, // evdev 180 KEY_HOMEPAGE { "CUT", RDP_SCANCODE_UNKNOWN }, /* 145: CUT [XF86Cut] */
{ "I181", RDP_SCANCODE_BROWSER_REFRESH }, // evdev 181 KEY_REFRESH { "HELP", RDP_SCANCODE_HELP }, /* 146: HELP [Help] */
// { "I182", RDP_SCANCODE_ }, // evdev 182 KEY_EXIT { "I147", RDP_SCANCODE_UNKNOWN }, /* 147: I147 [XF86MenuKB] */
// { "I183", RDP_SCANCODE_ }, // evdev 183 KEY_MOVE { "I148", RDP_SCANCODE_UNKNOWN }, /* 148: I148 [XF86Calculator] */
// { "I184", RDP_SCANCODE_ }, // evdev 184 KEY_EDIT { "I149", RDP_SCANCODE_UNKNOWN }, /* 149: I149 [(null)] */
// { "I185", RDP_SCANCODE_ }, // evdev 185 KEY_SCROLLUP { "I150", RDP_SCANCODE_SLEEP }, /* 150: I150 [XF86Sleep] */
// { "I186", RDP_SCANCODE_ }, // evdev 186 KEY_SCROLLDOWN { "I151", RDP_SCANCODE_UNKNOWN }, /* 151: I151 [XF86WakeUp] */
// { "I187", RDP_SCANCODE_ }, // evdev 187 KEY_KPLEFTPAREN { "I152", RDP_SCANCODE_UNKNOWN }, /* 152: I152 [XF86Explorer] */
// { "I188", RDP_SCANCODE_ }, // evdev 188 KEY_KPRIGHTPAREN { "I153", RDP_SCANCODE_UNKNOWN }, /* 153: I153 [XF86Send] */
// { "I189", RDP_SCANCODE_ }, // evdev 189 KEY_NEW { "I154", RDP_SCANCODE_UNKNOWN }, /* 154: I154 [(null)] */
// { "I190", RDP_SCANCODE_ }, // evdev 190 KEY_REDO { "I155", RDP_SCANCODE_UNKNOWN }, /* 155: I155 [XF86Xfer] */
// { "I208", RDP_SCANCODE_ }, // evdev 208 KEY_PLAYCD { "I156", RDP_SCANCODE_LAUNCH_APP1 }, /* 156: I156 [XF86Launch1] */
// { "I209", RDP_SCANCODE_ }, // evdev 209 KEY_PAUSECD { "I157", RDP_SCANCODE_LAUNCH_APP2 }, /* 157: I157 [XF86Launch2] */
// { "I210", RDP_SCANCODE_ }, // evdev 210 KEY_PROG3 { "I158", RDP_SCANCODE_BROWSER_HOME }, /* 158: I158 [XF86WWW] */
// { "I211", RDP_SCANCODE_ }, // evdev 211 KEY_PROG4 { "I159", RDP_SCANCODE_UNKNOWN }, /* 159: I159 [XF86DOS] */
// { "I212", RDP_SCANCODE_ }, // evdev 212 KEY_DASHBOARD { "I160", RDP_SCANCODE_UNKNOWN }, /* 160: I160 [XF86ScreenSaver] */
// { "I213", RDP_SCANCODE_ }, // evdev 213 KEY_SUSPEND { "I161", RDP_SCANCODE_UNKNOWN }, /* 161: I161 [XF86RotateWindows] */
// { "I214", RDP_SCANCODE_ }, // evdev 214 KEY_CLOSE { "I162", RDP_SCANCODE_UNKNOWN }, /* 162: I162 [XF86TaskPane] */
// { "I215", RDP_SCANCODE_ }, // evdev 215 KEY_PLAY { "I163", RDP_SCANCODE_LAUNCH_MAIL }, /* 163: I163 [XF86Mail] */
// { "I216", RDP_SCANCODE_ }, // evdev 216 KEY_FASTFORWARD { "I164", RDP_SCANCODE_BROWSER_FAVORITES }, /* 164: I164 [XF86Favorites] */
// { "I217", RDP_SCANCODE_ }, // evdev 217 KEY_BASSBOOST { "I165", RDP_SCANCODE_UNKNOWN }, /* 165: I165 [XF86MyComputer] */
// { "I218", RDP_SCANCODE_ }, // evdev 218 KEY_PRINT { "I166", RDP_SCANCODE_BROWSER_BACK }, /* 166: I166 [XF86Back] */
// { "I219", RDP_SCANCODE_ }, // evdev 219 KEY_HP { "I167", RDP_SCANCODE_BROWSER_FORWARD }, /* 167: I167 [XF86Forward] */
// { "I220", RDP_SCANCODE_ }, // evdev 220 KEY_CAMERA { "I168", RDP_SCANCODE_UNKNOWN }, /* 168: I168 [(null)] */
// { "I221", RDP_SCANCODE_ }, // evdev 221 KEY_SOUND { "I169", RDP_SCANCODE_UNKNOWN }, /* 169: I169 [XF86Eject] */
// { "I222", RDP_SCANCODE_ }, // evdev 222 KEY_QUESTION { "I170", RDP_SCANCODE_UNKNOWN }, /* 170: I170 [XF86Eject] */
// { "I223", RDP_SCANCODE_ }, // evdev 223 KEY_EMAIL { "I171", RDP_SCANCODE_MEDIA_NEXT_TRACK }, /* 171: I171 [XF86AudioNext] */
// { "I224", RDP_SCANCODE_ }, // evdev 224 KEY_CHAT { "I172", RDP_SCANCODE_MEDIA_PLAY_PAUSE }, /* 172: I172 [XF86AudioPlay] */
{ "I225", RDP_SCANCODE_BROWSER_SEARCH }, // evdev 225 KEY_SEARCH { "I173", RDP_SCANCODE_MEDIA_PREV_TRACK }, /* 173: I173 [XF86AudioPrev] */
// { "I226", RDP_SCANCODE_ }, // evdev 226 KEY_CONNECT { "I174", RDP_SCANCODE_MEDIA_STOP }, /* 174: I174 [XF86AudioStop] */
// { "I227", RDP_SCANCODE_ }, // evdev 227 KEY_FINANCE { "I175", RDP_SCANCODE_UNKNOWN }, /* 175: I175 [XF86AudioRecord] */
// { "I228", RDP_SCANCODE_ }, // evdev 228 KEY_SPORT { "I176", RDP_SCANCODE_UNKNOWN }, /* 176: I176 [XF86AudioRewind] */
// { "I229", RDP_SCANCODE_ }, // evdev 229 KEY_SHOP { "I177", RDP_SCANCODE_UNKNOWN }, /* 177: I177 [XF86Phone] */
// { "I230", RDP_SCANCODE_ }, // evdev 230 KEY_ALTERASE { "I178", RDP_SCANCODE_UNKNOWN }, /* 178: I178 [(null)] */
// { "I231", RDP_SCANCODE_ }, // evdev 231 KEY_CANCEL { "I179", RDP_SCANCODE_UNKNOWN }, /* 179: I179 [XF86Tools] */
// { "I232", RDP_SCANCODE_ }, // evdev 232 KEY_BRIGHTNESSDOWN { "I180", RDP_SCANCODE_BROWSER_HOME }, /* 180: I180 [XF86HomePage] */
// { "I233", RDP_SCANCODE_ }, // evdev 233 KEY_BRIGHTNESSUP { "I181", RDP_SCANCODE_BROWSER_REFRESH }, /* 181: I181 [XF86Reload] */
// { "I234", RDP_SCANCODE_ }, // evdev 234 KEY_MEDIA { "I182", RDP_SCANCODE_UNKNOWN }, /* 182: I182 [XF86Close] */
// { "I235", RDP_SCANCODE_ }, // evdev 235 KEY_SWITCHVIDEOMODE { "I183", RDP_SCANCODE_UNKNOWN }, /* 183: I183 [(null)] */
// { "I236", RDP_SCANCODE_ }, // evdev 236 KEY_KBDILLUMTOGGLE { "I184", RDP_SCANCODE_UNKNOWN }, /* 184: I184 [(null)] */
// { "I237", RDP_SCANCODE_ }, // evdev 237 KEY_KBDILLUMDOWN { "I185", RDP_SCANCODE_UNKNOWN }, /* 185: I185 [XF86ScrollUp] */
// { "I238", RDP_SCANCODE_ }, // evdev 238 KEY_KBDILLUMUP { "I186", RDP_SCANCODE_UNKNOWN }, /* 186: I186 [XF86ScrollDown] */
// { "I239", RDP_SCANCODE_ }, // evdev 239 KEY_SEND { "I187", RDP_SCANCODE_UNKNOWN }, /* 187: I187 [parenleft] */
// { "I240", RDP_SCANCODE_ }, // evdev 240 KEY_REPLY { "I188", RDP_SCANCODE_UNKNOWN }, /* 188: I188 [parenright] */
// { "I241", RDP_SCANCODE_ }, // evdev 241 KEY_FORWARDMAIL { "I189", RDP_SCANCODE_UNKNOWN }, /* 189: I189 [XF86New] */
// { "I242", RDP_SCANCODE_ }, // evdev 242 KEY_SAVE { "I190", RDP_SCANCODE_UNKNOWN }, /* 190: I190 [Redo] */
// { "I243", RDP_SCANCODE_ }, // evdev 243 KEY_DOCUMENTS { "FK13", RDP_SCANCODE_F13 }, /* 191: FK13 [XF86Tools] */
// { "I244", RDP_SCANCODE_ }, // evdev 244 KEY_BATTERY { "FK14", RDP_SCANCODE_F14 }, /* 192: FK14 [XF86Launch5] */
// { "I245", RDP_SCANCODE_ }, // evdev 245 KEY_BLUETOOTH { "FK15", RDP_SCANCODE_F15 }, /* 193: FK15 [XF86Launch6] */
// { "I246", RDP_SCANCODE_ }, // evdev 246 KEY_WLAN { "FK16", RDP_SCANCODE_F16 }, /* 194: FK16 [XF86Launch7] */
// { "I247", RDP_SCANCODE_ }, // evdev 247 KEY_UWB { "FK17", RDP_SCANCODE_F17 }, /* 195: FK17 [XF86Launch8] */
// { "I248", RDP_SCANCODE_ }, // evdev 248 KEY_UNKNOWN { "FK18", RDP_SCANCODE_F18 }, /* 196: FK18 [XF86Launch9] */
// { "I249", RDP_SCANCODE_ }, // evdev 249 KEY_VIDEO_NEXT { "FK19", RDP_SCANCODE_F19 }, /* 197: FK19 [(null)] */
// { "I250", RDP_SCANCODE_ }, // evdev 250 KEY_VIDEO_PREV { "FK20", RDP_SCANCODE_F20 }, /* 198: FK20 [XF86AudioMicMute] */
// { "I251", RDP_SCANCODE_ }, // evdev 251 KEY_BRIGHTNESS_CYCLE { "FK21", RDP_SCANCODE_F21 }, /* 199: FK21 [XF86TouchpadToggle] */
// { "I252", RDP_SCANCODE_ }, // evdev 252 KEY_BRIGHTNESS_ZERO { "FK22", RDP_SCANCODE_F22 }, /* 200: FK22 [XF86TouchpadOn] */
// { "I253", RDP_SCANCODE_ }, // evdev 253 KEY_DISPLAY_OFF { "FK23", RDP_SCANCODE_F23 }, /* 201: FK23 [XF86TouchpadOff] */
{ "INS", RDP_SCANCODE_INSERT }, // evdev 118 { "FK24", RDP_SCANCODE_F24 }, /* 202: FK24 [(null)] */
// { "JPCM", RDP_SCANCODE_ }, // evdev 103 KPJPComma { "LVL5", RDP_SCANCODE_UNKNOWN }, /* 203: LVL5 [ISO_Level5_Shift] */
// { "KATA", RDP_SCANCODE_ }, // evdev 98 Katakana VK_DBE_KATAKANA { "ALT", RDP_SCANCODE_LMENU }, /* 204: ALT [(null)] */
{ "KP0", RDP_SCANCODE_NUMPAD0 }, // evdev 90 { "META", RDP_SCANCODE_LMENU }, /* 205: META [(null)] */
{ "KP1", RDP_SCANCODE_NUMPAD1 }, // evdev 87 { "SUPR", RDP_SCANCODE_LWIN }, /* 206: SUPR [(null)] */
{ "KP2", RDP_SCANCODE_NUMPAD2 }, // evdev 88 { "HYPR", RDP_SCANCODE_LWIN }, /* 207: HYPR [(null)] */
{ "KP3", RDP_SCANCODE_NUMPAD3 }, // evdev 89 { "I208", RDP_SCANCODE_MEDIA_PLAY_PAUSE }, /* 208: I208 [XF86AudioPlay] */
{ "KP4", RDP_SCANCODE_NUMPAD4 }, // evdev 83 { "I209", RDP_SCANCODE_MEDIA_PLAY_PAUSE }, /* 209: I209 [XF86AudioPause] */
{ "KP5", RDP_SCANCODE_NUMPAD5 }, // evdev 84 { "I210", RDP_SCANCODE_UNKNOWN }, /* 210: I210 [XF86Launch3] */
{ "KP6", RDP_SCANCODE_NUMPAD6 }, // evdev 85 { "I211", RDP_SCANCODE_UNKNOWN }, /* 211: I211 [XF86Launch4] */
{ "KP7", RDP_SCANCODE_NUMPAD7 }, // evdev 79 { "I212", RDP_SCANCODE_UNKNOWN }, /* 212: I212 [XF86LaunchB] */
{ "KP8", RDP_SCANCODE_NUMPAD8 }, // evdev 80 { "I213", RDP_SCANCODE_UNKNOWN }, /* 213: I213 [XF86Suspend] */
{ "KP9", RDP_SCANCODE_NUMPAD9 }, // evdev 81 { "I214", RDP_SCANCODE_UNKNOWN }, /* 214: I214 [XF86Close] */
{ "KPAD", RDP_SCANCODE_ADD }, // evdev 86 { "I215", RDP_SCANCODE_MEDIA_PLAY_PAUSE }, /* 215: I215 [XF86AudioPlay] */
{ "KPDL", RDP_SCANCODE_DECIMAL }, // evdev 91 { "I216", RDP_SCANCODE_MEDIA_NEXT_TRACK }, /* 216: I216 [XF86AudioForward] */
{ "KPDV", RDP_SCANCODE_DIVIDE }, // evdev 106 { "I217", RDP_SCANCODE_UNKNOWN }, /* 217: I217 [(null)] */
{ "KPEN", RDP_SCANCODE_RETURN_KP }, // evdev 104 KP! { "I218", RDP_SCANCODE_UNKNOWN }, /* 218: I218 [Print] */
// { "KPEQ", RDP_SCANCODE_ }, // evdev 125 { "I219", RDP_SCANCODE_UNKNOWN }, /* 219: I219 [(null)] */
{ "KPMU", RDP_SCANCODE_MULTIPLY }, // evdev 63 { "I220", RDP_SCANCODE_UNKNOWN }, /* 220: I220 [XF86WebCam] */
{ "KPPT", RDP_SCANCODE_ABNT_C2 }, // BR alias of evdev 129 { "I221", RDP_SCANCODE_UNKNOWN }, /* 221: I221 [XF86AudioPreset] */
{ "KPSU", RDP_SCANCODE_SUBTRACT }, // evdev 82 { "I222", RDP_SCANCODE_UNKNOWN }, /* 222: I222 [(null)] */
{ "LALT", RDP_SCANCODE_LMENU }, // evdev 64 { "I223", RDP_SCANCODE_LAUNCH_MAIL }, /* 223: I223 [XF86Mail] */
{ "LCTL", RDP_SCANCODE_LCONTROL }, // evdev 37 { "I224", RDP_SCANCODE_UNKNOWN }, /* 224: I224 [XF86Messenger] */
{ "LEFT", RDP_SCANCODE_LEFT }, // evdev 113 { "I225", RDP_SCANCODE_BROWSER_SEARCH }, /* 225: I225 [XF86Search] */
{ "LFSH", RDP_SCANCODE_LSHIFT }, // evdev 50 { "I226", RDP_SCANCODE_UNKNOWN }, /* 226: I226 [XF86Go] */
{ "LMTA", RDP_SCANCODE_LWIN }, // alias of evdev 133 LWIN { "I227", RDP_SCANCODE_UNKNOWN }, /* 227: I227 [XF86Finance] */
// { "LNFD", RDP_SCANCODE_ }, // evdev 109 KEY_LINEFEED { "I228", RDP_SCANCODE_UNKNOWN }, /* 228: I228 [XF86Game] */
{ "LSGT", RDP_SCANCODE_OEM_102 }, // evdev 94 { "I229", RDP_SCANCODE_UNKNOWN }, /* 229: I229 [XF86Shop] */
{ "LVL3", RDP_SCANCODE_RMENU }, // evdev 92, fake keycode for virtual key { "I230", RDP_SCANCODE_UNKNOWN }, /* 230: I230 [(null)] */
{ "LWIN", RDP_SCANCODE_LWIN }, // evdev 133 { "I231", RDP_SCANCODE_UNKNOWN }, /* 231: I231 [Cancel] */
{ "MDSW", RDP_SCANCODE_RMENU }, // evdev 203, fake keycode for virtual key { "I232", RDP_SCANCODE_UNKNOWN }, /* 232: I232 [XF86MonBrightnessDown] */
{ "MENU", RDP_SCANCODE_APPS }, // alias of evdev 135 COMP { "I233", RDP_SCANCODE_UNKNOWN }, /* 233: I233 [XF86MonBrightnessUp] */
{ "META", RDP_SCANCODE_LMENU }, // evdev 205, fake keycode for virtual key { "I234", RDP_SCANCODE_LAUNCH_MEDIA_SELECT }, /* 234: I234 [XF86AudioMedia] */
{ "MUHE", RDP_SCANCODE_NONCONVERT_JP }, // JP evdev 102 Muhenkan { "I235", RDP_SCANCODE_UNKNOWN }, /* 235: I235 [XF86Display] */
{ "MUTE", RDP_SCANCODE_VOLUME_MUTE }, // evdev 121 { "I236", RDP_SCANCODE_UNKNOWN }, /* 236: I236 [XF86KbdLightOnOff] */
{ "NFER", RDP_SCANCODE_NONCONVERT_JP }, // JP alias of evdev 102 Muhenkan { "I237", RDP_SCANCODE_UNKNOWN }, /* 237: I237 [XF86KbdBrightnessDown] */
{ "NMLK", RDP_SCANCODE_NUMLOCK }, // evdev 77 { "I238", RDP_SCANCODE_UNKNOWN }, /* 238: I238 [XF86KbdBrightnessUp] */
// { "OPEN", RDP_SCANCODE_ }, // evdev 142 { "I239", RDP_SCANCODE_UNKNOWN }, /* 239: I239 [XF86Send] */
// { "PAST", RDP_SCANCODE_ }, // evdev 143 { "I240", RDP_SCANCODE_UNKNOWN }, /* 240: I240 [XF86Reply] */
{ "PAUS", RDP_SCANCODE_PAUSE }, // evdev 127 { "I241", RDP_SCANCODE_UNKNOWN }, /* 241: I241 [XF86MailForward] */
{ "PGDN", RDP_SCANCODE_NEXT }, // evdev 117 { "I242", RDP_SCANCODE_UNKNOWN }, /* 242: I242 [XF86Save] */
{ "PGUP", RDP_SCANCODE_PRIOR }, // evdev 112 { "I243", RDP_SCANCODE_UNKNOWN }, /* 243: I243 [XF86Documents] */
// { "POWR", RDP_SCANCODE_ }, // evdev 124 { "I244", RDP_SCANCODE_UNKNOWN }, /* 244: I244 [XF86Battery] */
// { "PROP", RDP_SCANCODE_ }, // evdev 138 { "I245", RDP_SCANCODE_UNKNOWN }, /* 245: I245 [XF86Bluetooth] */
{ "PRSC", RDP_SCANCODE_PRINTSCREEN }, // evdev 107 { "I246", RDP_SCANCODE_UNKNOWN }, /* 246: I246 [XF86WLAN] */
{ "RALT", RDP_SCANCODE_RMENU }, // evdev 108 RALT { "I247", RDP_SCANCODE_UNKNOWN }, /* 247: I247 [XF86UWB] */
{ "RCTL", RDP_SCANCODE_RCONTROL }, // evdev 105 { "I248", RDP_SCANCODE_UNKNOWN }, /* 248: I248 [(null)] */
{ "RGHT", RDP_SCANCODE_RIGHT }, // evdev 114 { "I249", RDP_SCANCODE_UNKNOWN }, /* 249: I249 [XF86Next_VMode] */
{ "RMTA", RDP_SCANCODE_RWIN }, // alias of evdev 134 RWIN { "I250", RDP_SCANCODE_UNKNOWN }, /* 250: I250 [XF86Prev_VMode] */
// { "RO", RDP_SCANCODE_ }, // JP evdev 97 Romaji { "I251", RDP_SCANCODE_UNKNOWN }, /* 251: I251 [XF86MonBrightnessCycle] */
{ "RTRN", RDP_SCANCODE_RETURN }, // not KP, evdev 36 { "I252", RDP_SCANCODE_UNKNOWN }, /* 252: I252 [XF86BrightnessAuto] */
{ "RTSH", RDP_SCANCODE_RSHIFT }, // evdev 62 { "I253", RDP_SCANCODE_UNKNOWN }, /* 253: I253 [XF86DisplayOff] */
{ "RWIN", RDP_SCANCODE_RWIN }, // evdev 134 { "I254", RDP_SCANCODE_UNKNOWN }, /* 254: I254 [XF86WWAN] */
{ "SCLK", RDP_SCANCODE_SCROLLLOCK }, // evdev 78 { "I255", RDP_SCANCODE_UNKNOWN } /* 255: I255 [XF86RFKill] */
{ "SPCE", RDP_SCANCODE_SPACE }, // evdev 65
{ "STOP", RDP_SCANCODE_BROWSER_STOP }, // evdev 136
{ "SUPR", RDP_SCANCODE_LWIN }, // evdev 206, fake keycode for virtual key
{ "SYRQ", RDP_SCANCODE_SYSREQ }, // evdev 107
{ "TAB", RDP_SCANCODE_TAB }, // evdev 23
{ "TLDE", RDP_SCANCODE_OEM_3 }, // evdev 49
// { "UNDO", RDP_SCANCODE_ }, // evdev 139
{ "UP", RDP_SCANCODE_UP }, // evdev 111
{ "VOL-", RDP_SCANCODE_VOLUME_DOWN }, // evdev 122
{ "VOL+", RDP_SCANCODE_VOLUME_UP }, // evdev 123
{ "XFER", RDP_SCANCODE_CONVERT_JP }, // JP alias of evdev 100 Henkan
}; };
static int detect_keyboard_layout_from_xkbfile(void* display, DWORD* keyboardLayoutId); static int detect_keyboard_layout_from_xkbfile(void* display, DWORD* keyboardLayoutId);
@ -428,6 +417,46 @@ int detect_keyboard_layout_from_xkbfile(void* display, DWORD* keyboardLayoutId)
return 0; return 0;
} }
static int xkb_cmp(const void* pva, const void* pvb)
{
const XKB_KEY_NAME_SCANCODE* a = pva;
const XKB_KEY_NAME_SCANCODE* b = pvb;
if (!a)
return 1;
if (!b)
return -1;
if (!a && !b)
return 0;
return strcmp(a->xkb_keyname, b->xkb_keyname);
}
static BOOL try_add(size_t offset, const char* xkb_keyname, DWORD* x11_keycode_to_rdp_scancode,
size_t count)
{
static BOOL initialized = FALSE;
static XKB_KEY_NAME_SCANCODE copy[ARRAYSIZE(XKB_KEY_NAME_SCANCODE_TABLE)] = { 0 };
if (!initialized)
{
memcpy(copy, XKB_KEY_NAME_SCANCODE_TABLE, sizeof(copy));
qsort(copy, ARRAYSIZE(copy), sizeof(XKB_KEY_NAME_SCANCODE), xkb_cmp);
initialized = TRUE;
}
XKB_KEY_NAME_SCANCODE key = { 0 };
key.xkb_keyname = xkb_keyname;
XKB_KEY_NAME_SCANCODE* found =
bsearch(&key, copy, ARRAYSIZE(copy), sizeof(XKB_KEY_NAME_SCANCODE), xkb_cmp);
if (found)
{
DEBUG_KBD("%4s: keycode: 0x%02" PRIuz " -> rdp scancode: 0x%08" PRIx32 "", xkb_keyname,
offset, found->rdp_scancode);
x11_keycode_to_rdp_scancode[offset] = found->rdp_scancode;
return TRUE;
}
return FALSE;
}
int freerdp_keyboard_load_map_from_xkbfile(void* display, DWORD* x11_keycode_to_rdp_scancode, int freerdp_keyboard_load_map_from_xkbfile(void* display, DWORD* x11_keycode_to_rdp_scancode,
size_t count) size_t count)
{ {
@ -463,22 +492,7 @@ int freerdp_keyboard_load_map_from_xkbfile(void* display, DWORD* x11_keycode_to_
if (strnlen(xkb_keyname, ARRAYSIZE(xkb_keyname)) < 1) if (strnlen(xkb_keyname, ARRAYSIZE(xkb_keyname)) < 1)
continue; continue;
for (size_t j = 0; j < ARRAYSIZE(XKB_KEY_NAME_SCANCODE_TABLE); j++) found = try_add(i, xkb_keyname, x11_keycode_to_rdp_scancode, count);
{
if (!strcmp(xkb_keyname, XKB_KEY_NAME_SCANCODE_TABLE[j].xkb_keyname))
{
DEBUG_KBD("%4s: keycode: 0x%02X -> rdp scancode: 0x%08" PRIX32 "", xkb_keyname,
i, XKB_KEY_NAME_SCANCODE_TABLE[j].rdp_scancode);
if (found)
{
DEBUG_KBD("Internal error! duplicate key %s!", xkb_keyname);
}
x11_keycode_to_rdp_scancode[i] = XKB_KEY_NAME_SCANCODE_TABLE[j].rdp_scancode;
found = TRUE;
}
}
if (!found) if (!found)
{ {