key_mapping_x11.cpp 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198
  1. /**************************************************************************/
  2. /* key_mapping_x11.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "key_mapping_x11.h"
  31. void KeyMappingX11::initialize() {
  32. // X11 Keysym to Godot Key map.
  33. xkeysym_map[XK_Escape] = Key::ESCAPE;
  34. xkeysym_map[XK_Tab] = Key::TAB;
  35. xkeysym_map[XK_ISO_Left_Tab] = Key::BACKTAB;
  36. xkeysym_map[XK_BackSpace] = Key::BACKSPACE;
  37. xkeysym_map[XK_Return] = Key::ENTER;
  38. xkeysym_map[XK_Insert] = Key::INSERT;
  39. xkeysym_map[XK_Delete] = Key::KEY_DELETE;
  40. xkeysym_map[XK_Clear] = Key::KEY_DELETE;
  41. xkeysym_map[XK_Pause] = Key::PAUSE;
  42. xkeysym_map[XK_Print] = Key::PRINT;
  43. xkeysym_map[XK_Home] = Key::HOME;
  44. xkeysym_map[XK_End] = Key::END;
  45. xkeysym_map[XK_Left] = Key::LEFT;
  46. xkeysym_map[XK_Up] = Key::UP;
  47. xkeysym_map[XK_Right] = Key::RIGHT;
  48. xkeysym_map[XK_Down] = Key::DOWN;
  49. xkeysym_map[XK_Prior] = Key::PAGEUP;
  50. xkeysym_map[XK_Next] = Key::PAGEDOWN;
  51. xkeysym_map[XK_Shift_L] = Key::SHIFT;
  52. xkeysym_map[XK_Shift_R] = Key::SHIFT;
  53. xkeysym_map[XK_Shift_Lock] = Key::SHIFT;
  54. xkeysym_map[XK_Control_L] = Key::CTRL;
  55. xkeysym_map[XK_Control_R] = Key::CTRL;
  56. xkeysym_map[XK_Meta_L] = Key::META;
  57. xkeysym_map[XK_Meta_R] = Key::META;
  58. xkeysym_map[XK_Alt_L] = Key::ALT;
  59. xkeysym_map[XK_Alt_R] = Key::ALT;
  60. xkeysym_map[XK_Caps_Lock] = Key::CAPSLOCK;
  61. xkeysym_map[XK_Num_Lock] = Key::NUMLOCK;
  62. xkeysym_map[XK_Scroll_Lock] = Key::SCROLLLOCK;
  63. xkeysym_map[XK_less] = Key::QUOTELEFT;
  64. xkeysym_map[XK_grave] = Key::SECTION;
  65. xkeysym_map[XK_Super_L] = Key::META;
  66. xkeysym_map[XK_Super_R] = Key::META;
  67. xkeysym_map[XK_Menu] = Key::MENU;
  68. xkeysym_map[XK_Hyper_L] = Key::HYPER;
  69. xkeysym_map[XK_Hyper_R] = Key::HYPER;
  70. xkeysym_map[XK_Help] = Key::HELP;
  71. xkeysym_map[XK_KP_Space] = Key::SPACE;
  72. xkeysym_map[XK_KP_Tab] = Key::TAB;
  73. xkeysym_map[XK_KP_Enter] = Key::KP_ENTER;
  74. xkeysym_map[XK_Home] = Key::HOME;
  75. xkeysym_map[XK_Left] = Key::LEFT;
  76. xkeysym_map[XK_Up] = Key::UP;
  77. xkeysym_map[XK_Right] = Key::RIGHT;
  78. xkeysym_map[XK_Down] = Key::DOWN;
  79. xkeysym_map[XK_Prior] = Key::PAGEUP;
  80. xkeysym_map[XK_Next] = Key::PAGEDOWN;
  81. xkeysym_map[XK_End] = Key::END;
  82. xkeysym_map[XK_Begin] = Key::CLEAR;
  83. xkeysym_map[XK_Insert] = Key::INSERT;
  84. xkeysym_map[XK_Delete] = Key::KEY_DELETE;
  85. xkeysym_map[XK_KP_Equal] = Key::EQUAL;
  86. xkeysym_map[XK_KP_Separator] = Key::COMMA;
  87. xkeysym_map[XK_KP_Decimal] = Key::KP_PERIOD;
  88. xkeysym_map[XK_KP_Multiply] = Key::KP_MULTIPLY;
  89. xkeysym_map[XK_KP_Divide] = Key::KP_DIVIDE;
  90. xkeysym_map[XK_KP_Subtract] = Key::KP_SUBTRACT;
  91. xkeysym_map[XK_KP_Add] = Key::KP_ADD;
  92. xkeysym_map[XK_KP_0] = Key::KP_0;
  93. xkeysym_map[XK_KP_1] = Key::KP_1;
  94. xkeysym_map[XK_KP_2] = Key::KP_2;
  95. xkeysym_map[XK_KP_3] = Key::KP_3;
  96. xkeysym_map[XK_KP_4] = Key::KP_4;
  97. xkeysym_map[XK_KP_5] = Key::KP_5;
  98. xkeysym_map[XK_KP_6] = Key::KP_6;
  99. xkeysym_map[XK_KP_7] = Key::KP_7;
  100. xkeysym_map[XK_KP_8] = Key::KP_8;
  101. xkeysym_map[XK_KP_9] = Key::KP_9;
  102. // Same keys but with numlock off.
  103. xkeysym_map[XK_KP_Insert] = Key::INSERT;
  104. xkeysym_map[XK_KP_Delete] = Key::KEY_DELETE;
  105. xkeysym_map[XK_KP_End] = Key::END;
  106. xkeysym_map[XK_KP_Down] = Key::DOWN;
  107. xkeysym_map[XK_KP_Page_Down] = Key::PAGEDOWN;
  108. xkeysym_map[XK_KP_Left] = Key::LEFT;
  109. // X11 documents this (numpad 5) as "begin of line" but no toolkit seems to interpret it this way.
  110. // On Windows this is emitting Key::Clear so for consistency it will be mapped to Key::Clear
  111. xkeysym_map[XK_KP_Begin] = Key::CLEAR;
  112. xkeysym_map[XK_KP_Right] = Key::RIGHT;
  113. xkeysym_map[XK_KP_Home] = Key::HOME;
  114. xkeysym_map[XK_KP_Up] = Key::UP;
  115. xkeysym_map[XK_KP_Page_Up] = Key::PAGEUP;
  116. xkeysym_map[XK_F1] = Key::F1;
  117. xkeysym_map[XK_F2] = Key::F2;
  118. xkeysym_map[XK_F3] = Key::F3;
  119. xkeysym_map[XK_F4] = Key::F4;
  120. xkeysym_map[XK_F5] = Key::F5;
  121. xkeysym_map[XK_F6] = Key::F6;
  122. xkeysym_map[XK_F7] = Key::F7;
  123. xkeysym_map[XK_F8] = Key::F8;
  124. xkeysym_map[XK_F9] = Key::F9;
  125. xkeysym_map[XK_F10] = Key::F10;
  126. xkeysym_map[XK_F11] = Key::F11;
  127. xkeysym_map[XK_F12] = Key::F12;
  128. xkeysym_map[XK_F13] = Key::F13;
  129. xkeysym_map[XK_F14] = Key::F14;
  130. xkeysym_map[XK_F15] = Key::F15;
  131. xkeysym_map[XK_F16] = Key::F16;
  132. xkeysym_map[XK_F17] = Key::F17;
  133. xkeysym_map[XK_F18] = Key::F18;
  134. xkeysym_map[XK_F19] = Key::F19;
  135. xkeysym_map[XK_F20] = Key::F20;
  136. xkeysym_map[XK_F21] = Key::F21;
  137. xkeysym_map[XK_F22] = Key::F22;
  138. xkeysym_map[XK_F23] = Key::F23;
  139. xkeysym_map[XK_F24] = Key::F24;
  140. xkeysym_map[XK_F25] = Key::F25;
  141. xkeysym_map[XK_F26] = Key::F26;
  142. xkeysym_map[XK_F27] = Key::F27;
  143. xkeysym_map[XK_F28] = Key::F28;
  144. xkeysym_map[XK_F29] = Key::F29;
  145. xkeysym_map[XK_F30] = Key::F30;
  146. xkeysym_map[XK_F31] = Key::F31;
  147. xkeysym_map[XK_F32] = Key::F32;
  148. xkeysym_map[XK_F33] = Key::F33;
  149. xkeysym_map[XK_F34] = Key::F34;
  150. xkeysym_map[XK_F35] = Key::F35;
  151. xkeysym_map[XK_yen] = Key::YEN;
  152. xkeysym_map[XK_section] = Key::SECTION;
  153. // Media keys.
  154. xkeysym_map[XF86XK_Back] = Key::BACK;
  155. xkeysym_map[XF86XK_Forward] = Key::FORWARD;
  156. xkeysym_map[XF86XK_Stop] = Key::STOP;
  157. xkeysym_map[XF86XK_Refresh] = Key::REFRESH;
  158. xkeysym_map[XF86XK_Favorites] = Key::FAVORITES;
  159. xkeysym_map[XF86XK_OpenURL] = Key::OPENURL;
  160. xkeysym_map[XF86XK_HomePage] = Key::HOMEPAGE;
  161. xkeysym_map[XF86XK_Search] = Key::SEARCH;
  162. xkeysym_map[XF86XK_AudioLowerVolume] = Key::VOLUMEDOWN;
  163. xkeysym_map[XF86XK_AudioMute] = Key::VOLUMEMUTE;
  164. xkeysym_map[XF86XK_AudioRaiseVolume] = Key::VOLUMEUP;
  165. xkeysym_map[XF86XK_AudioPlay] = Key::MEDIAPLAY;
  166. xkeysym_map[XF86XK_AudioStop] = Key::MEDIASTOP;
  167. xkeysym_map[XF86XK_AudioPrev] = Key::MEDIAPREVIOUS;
  168. xkeysym_map[XF86XK_AudioNext] = Key::MEDIANEXT;
  169. xkeysym_map[XF86XK_AudioRecord] = Key::MEDIARECORD;
  170. xkeysym_map[XF86XK_Standby] = Key::STANDBY;
  171. // Launch keys.
  172. xkeysym_map[XF86XK_Mail] = Key::LAUNCHMAIL;
  173. xkeysym_map[XF86XK_AudioMedia] = Key::LAUNCHMEDIA;
  174. xkeysym_map[XF86XK_MyComputer] = Key::LAUNCH0;
  175. xkeysym_map[XF86XK_Calculator] = Key::LAUNCH1;
  176. xkeysym_map[XF86XK_Launch0] = Key::LAUNCH2;
  177. xkeysym_map[XF86XK_Launch1] = Key::LAUNCH3;
  178. xkeysym_map[XF86XK_Launch2] = Key::LAUNCH4;
  179. xkeysym_map[XF86XK_Launch3] = Key::LAUNCH5;
  180. xkeysym_map[XF86XK_Launch4] = Key::LAUNCH6;
  181. xkeysym_map[XF86XK_Launch5] = Key::LAUNCH7;
  182. xkeysym_map[XF86XK_Launch6] = Key::LAUNCH8;
  183. xkeysym_map[XF86XK_Launch7] = Key::LAUNCH9;
  184. xkeysym_map[XF86XK_Launch8] = Key::LAUNCHA;
  185. xkeysym_map[XF86XK_Launch9] = Key::LAUNCHB;
  186. xkeysym_map[XF86XK_LaunchA] = Key::LAUNCHC;
  187. xkeysym_map[XF86XK_LaunchB] = Key::LAUNCHD;
  188. xkeysym_map[XF86XK_LaunchC] = Key::LAUNCHE;
  189. xkeysym_map[XF86XK_LaunchD] = Key::LAUNCHF;
  190. // Scancode to Godot Key map.
  191. scancode_map[0x09] = Key::ESCAPE;
  192. scancode_map[0x0A] = Key::KEY_1;
  193. scancode_map[0x0B] = Key::KEY_2;
  194. scancode_map[0x0C] = Key::KEY_3;
  195. scancode_map[0x0D] = Key::KEY_4;
  196. scancode_map[0x0E] = Key::KEY_5;
  197. scancode_map[0x0F] = Key::KEY_6;
  198. scancode_map[0x10] = Key::KEY_7;
  199. scancode_map[0x11] = Key::KEY_8;
  200. scancode_map[0x12] = Key::KEY_9;
  201. scancode_map[0x13] = Key::KEY_0;
  202. scancode_map[0x14] = Key::MINUS;
  203. scancode_map[0x15] = Key::EQUAL;
  204. scancode_map[0x16] = Key::BACKSPACE;
  205. scancode_map[0x17] = Key::TAB;
  206. scancode_map[0x18] = Key::Q;
  207. scancode_map[0x19] = Key::W;
  208. scancode_map[0x1A] = Key::E;
  209. scancode_map[0x1B] = Key::R;
  210. scancode_map[0x1C] = Key::T;
  211. scancode_map[0x1D] = Key::Y;
  212. scancode_map[0x1E] = Key::U;
  213. scancode_map[0x1F] = Key::I;
  214. scancode_map[0x20] = Key::O;
  215. scancode_map[0x21] = Key::P;
  216. scancode_map[0x22] = Key::BRACKETLEFT;
  217. scancode_map[0x23] = Key::BRACKETRIGHT;
  218. scancode_map[0x24] = Key::ENTER;
  219. scancode_map[0x25] = Key::CTRL; // Left
  220. scancode_map[0x26] = Key::A;
  221. scancode_map[0x27] = Key::S;
  222. scancode_map[0x28] = Key::D;
  223. scancode_map[0x29] = Key::F;
  224. scancode_map[0x2A] = Key::G;
  225. scancode_map[0x2B] = Key::H;
  226. scancode_map[0x2C] = Key::J;
  227. scancode_map[0x2D] = Key::K;
  228. scancode_map[0x2E] = Key::L;
  229. scancode_map[0x2F] = Key::SEMICOLON;
  230. scancode_map[0x30] = Key::APOSTROPHE;
  231. scancode_map[0x31] = Key::QUOTELEFT;
  232. scancode_map[0x32] = Key::SHIFT; // Left
  233. scancode_map[0x33] = Key::BACKSLASH;
  234. scancode_map[0x34] = Key::Z;
  235. scancode_map[0x35] = Key::X;
  236. scancode_map[0x36] = Key::C;
  237. scancode_map[0x37] = Key::V;
  238. scancode_map[0x38] = Key::B;
  239. scancode_map[0x39] = Key::N;
  240. scancode_map[0x3A] = Key::M;
  241. scancode_map[0x3B] = Key::COMMA;
  242. scancode_map[0x3C] = Key::PERIOD;
  243. scancode_map[0x3D] = Key::SLASH;
  244. scancode_map[0x3E] = Key::SHIFT; // Right
  245. scancode_map[0x3F] = Key::KP_MULTIPLY;
  246. scancode_map[0x40] = Key::ALT; // Left
  247. scancode_map[0x41] = Key::SPACE;
  248. scancode_map[0x42] = Key::CAPSLOCK;
  249. scancode_map[0x43] = Key::F1;
  250. scancode_map[0x44] = Key::F2;
  251. scancode_map[0x45] = Key::F3;
  252. scancode_map[0x46] = Key::F4;
  253. scancode_map[0x47] = Key::F5;
  254. scancode_map[0x48] = Key::F6;
  255. scancode_map[0x49] = Key::F7;
  256. scancode_map[0x4A] = Key::F8;
  257. scancode_map[0x4B] = Key::F9;
  258. scancode_map[0x4C] = Key::F10;
  259. scancode_map[0x4D] = Key::NUMLOCK;
  260. scancode_map[0x4E] = Key::SCROLLLOCK;
  261. scancode_map[0x4F] = Key::KP_7;
  262. scancode_map[0x50] = Key::KP_8;
  263. scancode_map[0x51] = Key::KP_9;
  264. scancode_map[0x52] = Key::KP_SUBTRACT;
  265. scancode_map[0x53] = Key::KP_4;
  266. scancode_map[0x54] = Key::KP_5;
  267. scancode_map[0x55] = Key::KP_6;
  268. scancode_map[0x56] = Key::KP_ADD;
  269. scancode_map[0x57] = Key::KP_1;
  270. scancode_map[0x58] = Key::KP_2;
  271. scancode_map[0x59] = Key::KP_3;
  272. scancode_map[0x5A] = Key::KP_0;
  273. scancode_map[0x5B] = Key::KP_PERIOD;
  274. //scancode_map[0x5C]
  275. //scancode_map[0x5D] // Zenkaku Hankaku
  276. scancode_map[0x5E] = Key::SECTION;
  277. scancode_map[0x5F] = Key::F11;
  278. scancode_map[0x60] = Key::F12;
  279. //scancode_map[0x61] // Romaji
  280. //scancode_map[0x62] // Katakana
  281. //scancode_map[0x63] // Hiragana
  282. //scancode_map[0x64] // Henkan
  283. //scancode_map[0x65] // Hiragana Katakana
  284. //scancode_map[0x66] // Muhenkan
  285. scancode_map[0x67] = Key::COMMA; // KP_Separator
  286. scancode_map[0x68] = Key::KP_ENTER;
  287. scancode_map[0x69] = Key::CTRL; // Right
  288. scancode_map[0x6A] = Key::KP_DIVIDE;
  289. scancode_map[0x6B] = Key::PRINT;
  290. scancode_map[0x6C] = Key::ALT; // Right
  291. scancode_map[0x6D] = Key::ENTER;
  292. scancode_map[0x6E] = Key::HOME;
  293. scancode_map[0x6F] = Key::UP;
  294. scancode_map[0x70] = Key::PAGEUP;
  295. scancode_map[0x71] = Key::LEFT;
  296. scancode_map[0x72] = Key::RIGHT;
  297. scancode_map[0x73] = Key::END;
  298. scancode_map[0x74] = Key::DOWN;
  299. scancode_map[0x75] = Key::PAGEDOWN;
  300. scancode_map[0x76] = Key::INSERT;
  301. scancode_map[0x77] = Key::KEY_DELETE;
  302. //scancode_map[0x78] // Macro
  303. scancode_map[0x79] = Key::VOLUMEMUTE;
  304. scancode_map[0x7A] = Key::VOLUMEDOWN;
  305. scancode_map[0x7B] = Key::VOLUMEUP;
  306. //scancode_map[0x7C] // Power
  307. scancode_map[0x7D] = Key::EQUAL; // KP_Equal
  308. //scancode_map[0x7E] // KP_PlusMinus
  309. scancode_map[0x7F] = Key::PAUSE;
  310. scancode_map[0x80] = Key::LAUNCH0;
  311. scancode_map[0x81] = Key::COMMA; // KP_Comma
  312. //scancode_map[0x82] // Hangul
  313. //scancode_map[0x83] // Hangul_Hanja
  314. scancode_map[0x84] = Key::YEN;
  315. scancode_map[0x85] = Key::META; // Left
  316. scancode_map[0x86] = Key::META; // Right
  317. scancode_map[0x87] = Key::MENU;
  318. scancode_map[0xA6] = Key::BACK; // On Chromebooks
  319. scancode_map[0xA7] = Key::FORWARD; // On Chromebooks
  320. scancode_map[0xB5] = Key::REFRESH; // On Chromebooks
  321. scancode_map[0xBF] = Key::F13;
  322. scancode_map[0xC0] = Key::F14;
  323. scancode_map[0xC1] = Key::F15;
  324. scancode_map[0xC2] = Key::F16;
  325. scancode_map[0xC3] = Key::F17;
  326. scancode_map[0xC4] = Key::F18;
  327. scancode_map[0xC5] = Key::F19;
  328. scancode_map[0xC6] = Key::F20;
  329. scancode_map[0xC7] = Key::F21;
  330. scancode_map[0xC8] = Key::F22;
  331. scancode_map[0xC9] = Key::F23;
  332. scancode_map[0xCA] = Key::F24;
  333. scancode_map[0xCB] = Key::F25;
  334. scancode_map[0xCC] = Key::F26;
  335. scancode_map[0xCD] = Key::F27;
  336. scancode_map[0xCE] = Key::F28;
  337. scancode_map[0xCF] = Key::F29;
  338. scancode_map[0xD0] = Key::F30;
  339. scancode_map[0xD1] = Key::F31;
  340. scancode_map[0xD2] = Key::F32;
  341. scancode_map[0xD3] = Key::F33;
  342. scancode_map[0xD4] = Key::F34;
  343. scancode_map[0xD5] = Key::F35;
  344. // Godot to scancode map.
  345. for (const KeyValue<unsigned int, Key> &E : scancode_map) {
  346. scancode_map_inv[E.value] = E.key;
  347. }
  348. // Keysym to Unicode map, tables taken from FOX toolkit.
  349. xkeysym_unicode_map[0x01A1] = 0x0104;
  350. xkeysym_unicode_map[0x01A2] = 0x02D8;
  351. xkeysym_unicode_map[0x01A3] = 0x0141;
  352. xkeysym_unicode_map[0x01A5] = 0x013D;
  353. xkeysym_unicode_map[0x01A6] = 0x015A;
  354. xkeysym_unicode_map[0x01A9] = 0x0160;
  355. xkeysym_unicode_map[0x01AA] = 0x015E;
  356. xkeysym_unicode_map[0x01AB] = 0x0164;
  357. xkeysym_unicode_map[0x01AC] = 0x0179;
  358. xkeysym_unicode_map[0x01AE] = 0x017D;
  359. xkeysym_unicode_map[0x01AF] = 0x017B;
  360. xkeysym_unicode_map[0x01B1] = 0x0105;
  361. xkeysym_unicode_map[0x01B2] = 0x02DB;
  362. xkeysym_unicode_map[0x01B3] = 0x0142;
  363. xkeysym_unicode_map[0x01B5] = 0x013E;
  364. xkeysym_unicode_map[0x01B6] = 0x015B;
  365. xkeysym_unicode_map[0x01B7] = 0x02C7;
  366. xkeysym_unicode_map[0x01B9] = 0x0161;
  367. xkeysym_unicode_map[0x01BA] = 0x015F;
  368. xkeysym_unicode_map[0x01BB] = 0x0165;
  369. xkeysym_unicode_map[0x01BC] = 0x017A;
  370. xkeysym_unicode_map[0x01BD] = 0x02DD;
  371. xkeysym_unicode_map[0x01BE] = 0x017E;
  372. xkeysym_unicode_map[0x01BF] = 0x017C;
  373. xkeysym_unicode_map[0x01C0] = 0x0154;
  374. xkeysym_unicode_map[0x01C3] = 0x0102;
  375. xkeysym_unicode_map[0x01C5] = 0x0139;
  376. xkeysym_unicode_map[0x01C6] = 0x0106;
  377. xkeysym_unicode_map[0x01C8] = 0x010C;
  378. xkeysym_unicode_map[0x01CA] = 0x0118;
  379. xkeysym_unicode_map[0x01CC] = 0x011A;
  380. xkeysym_unicode_map[0x01CF] = 0x010E;
  381. xkeysym_unicode_map[0x01D0] = 0x0110;
  382. xkeysym_unicode_map[0x01D1] = 0x0143;
  383. xkeysym_unicode_map[0x01D2] = 0x0147;
  384. xkeysym_unicode_map[0x01D5] = 0x0150;
  385. xkeysym_unicode_map[0x01D8] = 0x0158;
  386. xkeysym_unicode_map[0x01D9] = 0x016E;
  387. xkeysym_unicode_map[0x01DB] = 0x0170;
  388. xkeysym_unicode_map[0x01DE] = 0x0162;
  389. xkeysym_unicode_map[0x01E0] = 0x0155;
  390. xkeysym_unicode_map[0x01E3] = 0x0103;
  391. xkeysym_unicode_map[0x01E5] = 0x013A;
  392. xkeysym_unicode_map[0x01E6] = 0x0107;
  393. xkeysym_unicode_map[0x01E8] = 0x010D;
  394. xkeysym_unicode_map[0x01EA] = 0x0119;
  395. xkeysym_unicode_map[0x01EC] = 0x011B;
  396. xkeysym_unicode_map[0x01EF] = 0x010F;
  397. xkeysym_unicode_map[0x01F0] = 0x0111;
  398. xkeysym_unicode_map[0x01F1] = 0x0144;
  399. xkeysym_unicode_map[0x01F2] = 0x0148;
  400. xkeysym_unicode_map[0x01F5] = 0x0151;
  401. xkeysym_unicode_map[0x01F8] = 0x0159;
  402. xkeysym_unicode_map[0x01F9] = 0x016F;
  403. xkeysym_unicode_map[0x01FB] = 0x0171;
  404. xkeysym_unicode_map[0x01FE] = 0x0163;
  405. xkeysym_unicode_map[0x01FF] = 0x02D9;
  406. xkeysym_unicode_map[0x02A1] = 0x0126;
  407. xkeysym_unicode_map[0x02A6] = 0x0124;
  408. xkeysym_unicode_map[0x02A9] = 0x0130;
  409. xkeysym_unicode_map[0x02AB] = 0x011E;
  410. xkeysym_unicode_map[0x02AC] = 0x0134;
  411. xkeysym_unicode_map[0x02B1] = 0x0127;
  412. xkeysym_unicode_map[0x02B6] = 0x0125;
  413. xkeysym_unicode_map[0x02B9] = 0x0131;
  414. xkeysym_unicode_map[0x02BB] = 0x011F;
  415. xkeysym_unicode_map[0x02BC] = 0x0135;
  416. xkeysym_unicode_map[0x02C5] = 0x010A;
  417. xkeysym_unicode_map[0x02C6] = 0x0108;
  418. xkeysym_unicode_map[0x02D5] = 0x0120;
  419. xkeysym_unicode_map[0x02D8] = 0x011C;
  420. xkeysym_unicode_map[0x02DD] = 0x016C;
  421. xkeysym_unicode_map[0x02DE] = 0x015C;
  422. xkeysym_unicode_map[0x02E5] = 0x010B;
  423. xkeysym_unicode_map[0x02E6] = 0x0109;
  424. xkeysym_unicode_map[0x02F5] = 0x0121;
  425. xkeysym_unicode_map[0x02F8] = 0x011D;
  426. xkeysym_unicode_map[0x02FD] = 0x016D;
  427. xkeysym_unicode_map[0x02FE] = 0x015D;
  428. xkeysym_unicode_map[0x03A2] = 0x0138;
  429. xkeysym_unicode_map[0x03A3] = 0x0156;
  430. xkeysym_unicode_map[0x03A5] = 0x0128;
  431. xkeysym_unicode_map[0x03A6] = 0x013B;
  432. xkeysym_unicode_map[0x03AA] = 0x0112;
  433. xkeysym_unicode_map[0x03AB] = 0x0122;
  434. xkeysym_unicode_map[0x03AC] = 0x0166;
  435. xkeysym_unicode_map[0x03B3] = 0x0157;
  436. xkeysym_unicode_map[0x03B5] = 0x0129;
  437. xkeysym_unicode_map[0x03B6] = 0x013C;
  438. xkeysym_unicode_map[0x03BA] = 0x0113;
  439. xkeysym_unicode_map[0x03BB] = 0x0123;
  440. xkeysym_unicode_map[0x03BC] = 0x0167;
  441. xkeysym_unicode_map[0x03BD] = 0x014A;
  442. xkeysym_unicode_map[0x03BF] = 0x014B;
  443. xkeysym_unicode_map[0x03C0] = 0x0100;
  444. xkeysym_unicode_map[0x03C7] = 0x012E;
  445. xkeysym_unicode_map[0x03CC] = 0x0116;
  446. xkeysym_unicode_map[0x03CF] = 0x012A;
  447. xkeysym_unicode_map[0x03D1] = 0x0145;
  448. xkeysym_unicode_map[0x03D2] = 0x014C;
  449. xkeysym_unicode_map[0x03D3] = 0x0136;
  450. xkeysym_unicode_map[0x03D9] = 0x0172;
  451. xkeysym_unicode_map[0x03DD] = 0x0168;
  452. xkeysym_unicode_map[0x03DE] = 0x016A;
  453. xkeysym_unicode_map[0x03E0] = 0x0101;
  454. xkeysym_unicode_map[0x03E7] = 0x012F;
  455. xkeysym_unicode_map[0x03EC] = 0x0117;
  456. xkeysym_unicode_map[0x03EF] = 0x012B;
  457. xkeysym_unicode_map[0x03F1] = 0x0146;
  458. xkeysym_unicode_map[0x03F2] = 0x014D;
  459. xkeysym_unicode_map[0x03F3] = 0x0137;
  460. xkeysym_unicode_map[0x03F9] = 0x0173;
  461. xkeysym_unicode_map[0x03FD] = 0x0169;
  462. xkeysym_unicode_map[0x03FE] = 0x016B;
  463. xkeysym_unicode_map[0x047E] = 0x203E;
  464. xkeysym_unicode_map[0x04A1] = 0x3002;
  465. xkeysym_unicode_map[0x04A2] = 0x300C;
  466. xkeysym_unicode_map[0x04A3] = 0x300D;
  467. xkeysym_unicode_map[0x04A4] = 0x3001;
  468. xkeysym_unicode_map[0x04A5] = 0x30FB;
  469. xkeysym_unicode_map[0x04A6] = 0x30F2;
  470. xkeysym_unicode_map[0x04A7] = 0x30A1;
  471. xkeysym_unicode_map[0x04A8] = 0x30A3;
  472. xkeysym_unicode_map[0x04A9] = 0x30A5;
  473. xkeysym_unicode_map[0x04AA] = 0x30A7;
  474. xkeysym_unicode_map[0x04AB] = 0x30A9;
  475. xkeysym_unicode_map[0x04AC] = 0x30E3;
  476. xkeysym_unicode_map[0x04AD] = 0x30E5;
  477. xkeysym_unicode_map[0x04AE] = 0x30E7;
  478. xkeysym_unicode_map[0x04AF] = 0x30C3;
  479. xkeysym_unicode_map[0x04B0] = 0x30FC;
  480. xkeysym_unicode_map[0x04B1] = 0x30A2;
  481. xkeysym_unicode_map[0x04B2] = 0x30A4;
  482. xkeysym_unicode_map[0x04B3] = 0x30A6;
  483. xkeysym_unicode_map[0x04B4] = 0x30A8;
  484. xkeysym_unicode_map[0x04B5] = 0x30AA;
  485. xkeysym_unicode_map[0x04B6] = 0x30AB;
  486. xkeysym_unicode_map[0x04B7] = 0x30AD;
  487. xkeysym_unicode_map[0x04B8] = 0x30AF;
  488. xkeysym_unicode_map[0x04B9] = 0x30B1;
  489. xkeysym_unicode_map[0x04BA] = 0x30B3;
  490. xkeysym_unicode_map[0x04BB] = 0x30B5;
  491. xkeysym_unicode_map[0x04BC] = 0x30B7;
  492. xkeysym_unicode_map[0x04BD] = 0x30B9;
  493. xkeysym_unicode_map[0x04BE] = 0x30BB;
  494. xkeysym_unicode_map[0x04BF] = 0x30BD;
  495. xkeysym_unicode_map[0x04C0] = 0x30BF;
  496. xkeysym_unicode_map[0x04C1] = 0x30C1;
  497. xkeysym_unicode_map[0x04C2] = 0x30C4;
  498. xkeysym_unicode_map[0x04C3] = 0x30C6;
  499. xkeysym_unicode_map[0x04C4] = 0x30C8;
  500. xkeysym_unicode_map[0x04C5] = 0x30CA;
  501. xkeysym_unicode_map[0x04C6] = 0x30CB;
  502. xkeysym_unicode_map[0x04C7] = 0x30CC;
  503. xkeysym_unicode_map[0x04C8] = 0x30CD;
  504. xkeysym_unicode_map[0x04C9] = 0x30CE;
  505. xkeysym_unicode_map[0x04CA] = 0x30CF;
  506. xkeysym_unicode_map[0x04CB] = 0x30D2;
  507. xkeysym_unicode_map[0x04CC] = 0x30D5;
  508. xkeysym_unicode_map[0x04CD] = 0x30D8;
  509. xkeysym_unicode_map[0x04CE] = 0x30DB;
  510. xkeysym_unicode_map[0x04CF] = 0x30DE;
  511. xkeysym_unicode_map[0x04D0] = 0x30DF;
  512. xkeysym_unicode_map[0x04D1] = 0x30E0;
  513. xkeysym_unicode_map[0x04D2] = 0x30E1;
  514. xkeysym_unicode_map[0x04D3] = 0x30E2;
  515. xkeysym_unicode_map[0x04D4] = 0x30E4;
  516. xkeysym_unicode_map[0x04D5] = 0x30E6;
  517. xkeysym_unicode_map[0x04D6] = 0x30E8;
  518. xkeysym_unicode_map[0x04D7] = 0x30E9;
  519. xkeysym_unicode_map[0x04D8] = 0x30EA;
  520. xkeysym_unicode_map[0x04D9] = 0x30EB;
  521. xkeysym_unicode_map[0x04DA] = 0x30EC;
  522. xkeysym_unicode_map[0x04DB] = 0x30ED;
  523. xkeysym_unicode_map[0x04DC] = 0x30EF;
  524. xkeysym_unicode_map[0x04DD] = 0x30F3;
  525. xkeysym_unicode_map[0x04DE] = 0x309B;
  526. xkeysym_unicode_map[0x04DF] = 0x309C;
  527. xkeysym_unicode_map[0x05AC] = 0x060C;
  528. xkeysym_unicode_map[0x05BB] = 0x061B;
  529. xkeysym_unicode_map[0x05BF] = 0x061F;
  530. xkeysym_unicode_map[0x05C1] = 0x0621;
  531. xkeysym_unicode_map[0x05C2] = 0x0622;
  532. xkeysym_unicode_map[0x05C3] = 0x0623;
  533. xkeysym_unicode_map[0x05C4] = 0x0624;
  534. xkeysym_unicode_map[0x05C5] = 0x0625;
  535. xkeysym_unicode_map[0x05C6] = 0x0626;
  536. xkeysym_unicode_map[0x05C7] = 0x0627;
  537. xkeysym_unicode_map[0x05C8] = 0x0628;
  538. xkeysym_unicode_map[0x05C9] = 0x0629;
  539. xkeysym_unicode_map[0x05CA] = 0x062A;
  540. xkeysym_unicode_map[0x05CB] = 0x062B;
  541. xkeysym_unicode_map[0x05CC] = 0x062C;
  542. xkeysym_unicode_map[0x05CD] = 0x062D;
  543. xkeysym_unicode_map[0x05CE] = 0x062E;
  544. xkeysym_unicode_map[0x05CF] = 0x062F;
  545. xkeysym_unicode_map[0x05D0] = 0x0630;
  546. xkeysym_unicode_map[0x05D1] = 0x0631;
  547. xkeysym_unicode_map[0x05D2] = 0x0632;
  548. xkeysym_unicode_map[0x05D3] = 0x0633;
  549. xkeysym_unicode_map[0x05D4] = 0x0634;
  550. xkeysym_unicode_map[0x05D5] = 0x0635;
  551. xkeysym_unicode_map[0x05D6] = 0x0636;
  552. xkeysym_unicode_map[0x05D7] = 0x0637;
  553. xkeysym_unicode_map[0x05D8] = 0x0638;
  554. xkeysym_unicode_map[0x05D9] = 0x0639;
  555. xkeysym_unicode_map[0x05DA] = 0x063A;
  556. xkeysym_unicode_map[0x05E0] = 0x0640;
  557. xkeysym_unicode_map[0x05E1] = 0x0641;
  558. xkeysym_unicode_map[0x05E2] = 0x0642;
  559. xkeysym_unicode_map[0x05E3] = 0x0643;
  560. xkeysym_unicode_map[0x05E4] = 0x0644;
  561. xkeysym_unicode_map[0x05E5] = 0x0645;
  562. xkeysym_unicode_map[0x05E6] = 0x0646;
  563. xkeysym_unicode_map[0x05E7] = 0x0647;
  564. xkeysym_unicode_map[0x05E8] = 0x0648;
  565. xkeysym_unicode_map[0x05E9] = 0x0649;
  566. xkeysym_unicode_map[0x05EA] = 0x064A;
  567. xkeysym_unicode_map[0x05EB] = 0x064B;
  568. xkeysym_unicode_map[0x05EC] = 0x064C;
  569. xkeysym_unicode_map[0x05ED] = 0x064D;
  570. xkeysym_unicode_map[0x05EE] = 0x064E;
  571. xkeysym_unicode_map[0x05EF] = 0x064F;
  572. xkeysym_unicode_map[0x05F0] = 0x0650;
  573. xkeysym_unicode_map[0x05F1] = 0x0651;
  574. xkeysym_unicode_map[0x05F2] = 0x0652;
  575. xkeysym_unicode_map[0x06A1] = 0x0452;
  576. xkeysym_unicode_map[0x06A2] = 0x0453;
  577. xkeysym_unicode_map[0x06A3] = 0x0451;
  578. xkeysym_unicode_map[0x06A4] = 0x0454;
  579. xkeysym_unicode_map[0x06A5] = 0x0455;
  580. xkeysym_unicode_map[0x06A6] = 0x0456;
  581. xkeysym_unicode_map[0x06A7] = 0x0457;
  582. xkeysym_unicode_map[0x06A8] = 0x0458;
  583. xkeysym_unicode_map[0x06A9] = 0x0459;
  584. xkeysym_unicode_map[0x06AA] = 0x045A;
  585. xkeysym_unicode_map[0x06AB] = 0x045B;
  586. xkeysym_unicode_map[0x06AC] = 0x045C;
  587. xkeysym_unicode_map[0x06AE] = 0x045E;
  588. xkeysym_unicode_map[0x06AF] = 0x045F;
  589. xkeysym_unicode_map[0x06B0] = 0x2116;
  590. xkeysym_unicode_map[0x06B1] = 0x0402;
  591. xkeysym_unicode_map[0x06B2] = 0x0403;
  592. xkeysym_unicode_map[0x06B3] = 0x0401;
  593. xkeysym_unicode_map[0x06B4] = 0x0404;
  594. xkeysym_unicode_map[0x06B5] = 0x0405;
  595. xkeysym_unicode_map[0x06B6] = 0x0406;
  596. xkeysym_unicode_map[0x06B7] = 0x0407;
  597. xkeysym_unicode_map[0x06B8] = 0x0408;
  598. xkeysym_unicode_map[0x06B9] = 0x0409;
  599. xkeysym_unicode_map[0x06BA] = 0x040A;
  600. xkeysym_unicode_map[0x06BB] = 0x040B;
  601. xkeysym_unicode_map[0x06BC] = 0x040C;
  602. xkeysym_unicode_map[0x06BE] = 0x040E;
  603. xkeysym_unicode_map[0x06BF] = 0x040F;
  604. xkeysym_unicode_map[0x06C0] = 0x044E;
  605. xkeysym_unicode_map[0x06C1] = 0x0430;
  606. xkeysym_unicode_map[0x06C2] = 0x0431;
  607. xkeysym_unicode_map[0x06C3] = 0x0446;
  608. xkeysym_unicode_map[0x06C4] = 0x0434;
  609. xkeysym_unicode_map[0x06C5] = 0x0435;
  610. xkeysym_unicode_map[0x06C6] = 0x0444;
  611. xkeysym_unicode_map[0x06C7] = 0x0433;
  612. xkeysym_unicode_map[0x06C8] = 0x0445;
  613. xkeysym_unicode_map[0x06C9] = 0x0438;
  614. xkeysym_unicode_map[0x06CA] = 0x0439;
  615. xkeysym_unicode_map[0x06CB] = 0x043A;
  616. xkeysym_unicode_map[0x06CC] = 0x043B;
  617. xkeysym_unicode_map[0x06CD] = 0x043C;
  618. xkeysym_unicode_map[0x06CE] = 0x043D;
  619. xkeysym_unicode_map[0x06CF] = 0x043E;
  620. xkeysym_unicode_map[0x06D0] = 0x043F;
  621. xkeysym_unicode_map[0x06D1] = 0x044F;
  622. xkeysym_unicode_map[0x06D2] = 0x0440;
  623. xkeysym_unicode_map[0x06D3] = 0x0441;
  624. xkeysym_unicode_map[0x06D4] = 0x0442;
  625. xkeysym_unicode_map[0x06D5] = 0x0443;
  626. xkeysym_unicode_map[0x06D6] = 0x0436;
  627. xkeysym_unicode_map[0x06D7] = 0x0432;
  628. xkeysym_unicode_map[0x06D8] = 0x044C;
  629. xkeysym_unicode_map[0x06D9] = 0x044B;
  630. xkeysym_unicode_map[0x06DA] = 0x0437;
  631. xkeysym_unicode_map[0x06DB] = 0x0448;
  632. xkeysym_unicode_map[0x06DC] = 0x044D;
  633. xkeysym_unicode_map[0x06DD] = 0x0449;
  634. xkeysym_unicode_map[0x06DE] = 0x0447;
  635. xkeysym_unicode_map[0x06DF] = 0x044A;
  636. xkeysym_unicode_map[0x06E0] = 0x042E;
  637. xkeysym_unicode_map[0x06E1] = 0x0410;
  638. xkeysym_unicode_map[0x06E2] = 0x0411;
  639. xkeysym_unicode_map[0x06E3] = 0x0426;
  640. xkeysym_unicode_map[0x06E4] = 0x0414;
  641. xkeysym_unicode_map[0x06E5] = 0x0415;
  642. xkeysym_unicode_map[0x06E6] = 0x0424;
  643. xkeysym_unicode_map[0x06E7] = 0x0413;
  644. xkeysym_unicode_map[0x06E8] = 0x0425;
  645. xkeysym_unicode_map[0x06E9] = 0x0418;
  646. xkeysym_unicode_map[0x06EA] = 0x0419;
  647. xkeysym_unicode_map[0x06EB] = 0x041A;
  648. xkeysym_unicode_map[0x06EC] = 0x041B;
  649. xkeysym_unicode_map[0x06ED] = 0x041C;
  650. xkeysym_unicode_map[0x06EE] = 0x041D;
  651. xkeysym_unicode_map[0x06EF] = 0x041E;
  652. xkeysym_unicode_map[0x06F0] = 0x041F;
  653. xkeysym_unicode_map[0x06F1] = 0x042F;
  654. xkeysym_unicode_map[0x06F2] = 0x0420;
  655. xkeysym_unicode_map[0x06F3] = 0x0421;
  656. xkeysym_unicode_map[0x06F4] = 0x0422;
  657. xkeysym_unicode_map[0x06F5] = 0x0423;
  658. xkeysym_unicode_map[0x06F6] = 0x0416;
  659. xkeysym_unicode_map[0x06F7] = 0x0412;
  660. xkeysym_unicode_map[0x06F8] = 0x042C;
  661. xkeysym_unicode_map[0x06F9] = 0x042B;
  662. xkeysym_unicode_map[0x06FA] = 0x0417;
  663. xkeysym_unicode_map[0x06FB] = 0x0428;
  664. xkeysym_unicode_map[0x06FC] = 0x042D;
  665. xkeysym_unicode_map[0x06FD] = 0x0429;
  666. xkeysym_unicode_map[0x06FE] = 0x0427;
  667. xkeysym_unicode_map[0x06FF] = 0x042A;
  668. xkeysym_unicode_map[0x07A1] = 0x0386;
  669. xkeysym_unicode_map[0x07A2] = 0x0388;
  670. xkeysym_unicode_map[0x07A3] = 0x0389;
  671. xkeysym_unicode_map[0x07A4] = 0x038A;
  672. xkeysym_unicode_map[0x07A5] = 0x03AA;
  673. xkeysym_unicode_map[0x07A7] = 0x038C;
  674. xkeysym_unicode_map[0x07A8] = 0x038E;
  675. xkeysym_unicode_map[0x07A9] = 0x03AB;
  676. xkeysym_unicode_map[0x07AB] = 0x038F;
  677. xkeysym_unicode_map[0x07AE] = 0x0385;
  678. xkeysym_unicode_map[0x07AF] = 0x2015;
  679. xkeysym_unicode_map[0x07B1] = 0x03AC;
  680. xkeysym_unicode_map[0x07B2] = 0x03AD;
  681. xkeysym_unicode_map[0x07B3] = 0x03AE;
  682. xkeysym_unicode_map[0x07B4] = 0x03AF;
  683. xkeysym_unicode_map[0x07B5] = 0x03CA;
  684. xkeysym_unicode_map[0x07B6] = 0x0390;
  685. xkeysym_unicode_map[0x07B7] = 0x03CC;
  686. xkeysym_unicode_map[0x07B8] = 0x03CD;
  687. xkeysym_unicode_map[0x07B9] = 0x03CB;
  688. xkeysym_unicode_map[0x07BA] = 0x03B0;
  689. xkeysym_unicode_map[0x07BB] = 0x03CE;
  690. xkeysym_unicode_map[0x07C1] = 0x0391;
  691. xkeysym_unicode_map[0x07C2] = 0x0392;
  692. xkeysym_unicode_map[0x07C3] = 0x0393;
  693. xkeysym_unicode_map[0x07C4] = 0x0394;
  694. xkeysym_unicode_map[0x07C5] = 0x0395;
  695. xkeysym_unicode_map[0x07C6] = 0x0396;
  696. xkeysym_unicode_map[0x07C7] = 0x0397;
  697. xkeysym_unicode_map[0x07C8] = 0x0398;
  698. xkeysym_unicode_map[0x07C9] = 0x0399;
  699. xkeysym_unicode_map[0x07CA] = 0x039A;
  700. xkeysym_unicode_map[0x07CB] = 0x039B;
  701. xkeysym_unicode_map[0x07CC] = 0x039C;
  702. xkeysym_unicode_map[0x07CD] = 0x039D;
  703. xkeysym_unicode_map[0x07CE] = 0x039E;
  704. xkeysym_unicode_map[0x07CF] = 0x039F;
  705. xkeysym_unicode_map[0x07D0] = 0x03A0;
  706. xkeysym_unicode_map[0x07D1] = 0x03A1;
  707. xkeysym_unicode_map[0x07D2] = 0x03A3;
  708. xkeysym_unicode_map[0x07D4] = 0x03A4;
  709. xkeysym_unicode_map[0x07D5] = 0x03A5;
  710. xkeysym_unicode_map[0x07D6] = 0x03A6;
  711. xkeysym_unicode_map[0x07D7] = 0x03A7;
  712. xkeysym_unicode_map[0x07D8] = 0x03A8;
  713. xkeysym_unicode_map[0x07D9] = 0x03A9;
  714. xkeysym_unicode_map[0x07E1] = 0x03B1;
  715. xkeysym_unicode_map[0x07E2] = 0x03B2;
  716. xkeysym_unicode_map[0x07E3] = 0x03B3;
  717. xkeysym_unicode_map[0x07E4] = 0x03B4;
  718. xkeysym_unicode_map[0x07E5] = 0x03B5;
  719. xkeysym_unicode_map[0x07E6] = 0x03B6;
  720. xkeysym_unicode_map[0x07E7] = 0x03B7;
  721. xkeysym_unicode_map[0x07E8] = 0x03B8;
  722. xkeysym_unicode_map[0x07E9] = 0x03B9;
  723. xkeysym_unicode_map[0x07EA] = 0x03BA;
  724. xkeysym_unicode_map[0x07EB] = 0x03BB;
  725. xkeysym_unicode_map[0x07EC] = 0x03BC;
  726. xkeysym_unicode_map[0x07ED] = 0x03BD;
  727. xkeysym_unicode_map[0x07EE] = 0x03BE;
  728. xkeysym_unicode_map[0x07EF] = 0x03BF;
  729. xkeysym_unicode_map[0x07F0] = 0x03C0;
  730. xkeysym_unicode_map[0x07F1] = 0x03C1;
  731. xkeysym_unicode_map[0x07F2] = 0x03C3;
  732. xkeysym_unicode_map[0x07F3] = 0x03C2;
  733. xkeysym_unicode_map[0x07F4] = 0x03C4;
  734. xkeysym_unicode_map[0x07F5] = 0x03C5;
  735. xkeysym_unicode_map[0x07F6] = 0x03C6;
  736. xkeysym_unicode_map[0x07F7] = 0x03C7;
  737. xkeysym_unicode_map[0x07F8] = 0x03C8;
  738. xkeysym_unicode_map[0x07F9] = 0x03C9;
  739. xkeysym_unicode_map[0x08A1] = 0x23B7;
  740. xkeysym_unicode_map[0x08A2] = 0x250C;
  741. xkeysym_unicode_map[0x08A3] = 0x2500;
  742. xkeysym_unicode_map[0x08A4] = 0x2320;
  743. xkeysym_unicode_map[0x08A5] = 0x2321;
  744. xkeysym_unicode_map[0x08A6] = 0x2502;
  745. xkeysym_unicode_map[0x08A7] = 0x23A1;
  746. xkeysym_unicode_map[0x08A8] = 0x23A3;
  747. xkeysym_unicode_map[0x08A9] = 0x23A4;
  748. xkeysym_unicode_map[0x08AA] = 0x23A6;
  749. xkeysym_unicode_map[0x08AB] = 0x239B;
  750. xkeysym_unicode_map[0x08AC] = 0x239D;
  751. xkeysym_unicode_map[0x08AD] = 0x239E;
  752. xkeysym_unicode_map[0x08AE] = 0x23A0;
  753. xkeysym_unicode_map[0x08AF] = 0x23A8;
  754. xkeysym_unicode_map[0x08B0] = 0x23AC;
  755. xkeysym_unicode_map[0x08BC] = 0x2264;
  756. xkeysym_unicode_map[0x08BD] = 0x2260;
  757. xkeysym_unicode_map[0x08BE] = 0x2265;
  758. xkeysym_unicode_map[0x08BF] = 0x222B;
  759. xkeysym_unicode_map[0x08C0] = 0x2234;
  760. xkeysym_unicode_map[0x08C1] = 0x221D;
  761. xkeysym_unicode_map[0x08C2] = 0x221E;
  762. xkeysym_unicode_map[0x08C5] = 0x2207;
  763. xkeysym_unicode_map[0x08C8] = 0x223C;
  764. xkeysym_unicode_map[0x08C9] = 0x2243;
  765. xkeysym_unicode_map[0x08CD] = 0x21D4;
  766. xkeysym_unicode_map[0x08CE] = 0x21D2;
  767. xkeysym_unicode_map[0x08CF] = 0x2261;
  768. xkeysym_unicode_map[0x08D6] = 0x221A;
  769. xkeysym_unicode_map[0x08DA] = 0x2282;
  770. xkeysym_unicode_map[0x08DB] = 0x2283;
  771. xkeysym_unicode_map[0x08DC] = 0x2229;
  772. xkeysym_unicode_map[0x08DD] = 0x222A;
  773. xkeysym_unicode_map[0x08DE] = 0x2227;
  774. xkeysym_unicode_map[0x08DF] = 0x2228;
  775. xkeysym_unicode_map[0x08EF] = 0x2202;
  776. xkeysym_unicode_map[0x08F6] = 0x0192;
  777. xkeysym_unicode_map[0x08FB] = 0x2190;
  778. xkeysym_unicode_map[0x08FC] = 0x2191;
  779. xkeysym_unicode_map[0x08FD] = 0x2192;
  780. xkeysym_unicode_map[0x08FE] = 0x2193;
  781. xkeysym_unicode_map[0x09E0] = 0x25C6;
  782. xkeysym_unicode_map[0x09E1] = 0x2592;
  783. xkeysym_unicode_map[0x09E2] = 0x2409;
  784. xkeysym_unicode_map[0x09E3] = 0x240C;
  785. xkeysym_unicode_map[0x09E4] = 0x240D;
  786. xkeysym_unicode_map[0x09E5] = 0x240A;
  787. xkeysym_unicode_map[0x09E8] = 0x2424;
  788. xkeysym_unicode_map[0x09E9] = 0x240B;
  789. xkeysym_unicode_map[0x09EA] = 0x2518;
  790. xkeysym_unicode_map[0x09EB] = 0x2510;
  791. xkeysym_unicode_map[0x09EC] = 0x250C;
  792. xkeysym_unicode_map[0x09ED] = 0x2514;
  793. xkeysym_unicode_map[0x09EE] = 0x253C;
  794. xkeysym_unicode_map[0x09EF] = 0x23BA;
  795. xkeysym_unicode_map[0x09F0] = 0x23BB;
  796. xkeysym_unicode_map[0x09F1] = 0x2500;
  797. xkeysym_unicode_map[0x09F2] = 0x23BC;
  798. xkeysym_unicode_map[0x09F3] = 0x23BD;
  799. xkeysym_unicode_map[0x09F4] = 0x251C;
  800. xkeysym_unicode_map[0x09F5] = 0x2524;
  801. xkeysym_unicode_map[0x09F6] = 0x2534;
  802. xkeysym_unicode_map[0x09F7] = 0x252C;
  803. xkeysym_unicode_map[0x09F8] = 0x2502;
  804. xkeysym_unicode_map[0x0AA1] = 0x2003;
  805. xkeysym_unicode_map[0x0AA2] = 0x2002;
  806. xkeysym_unicode_map[0x0AA3] = 0x2004;
  807. xkeysym_unicode_map[0x0AA4] = 0x2005;
  808. xkeysym_unicode_map[0x0AA5] = 0x2007;
  809. xkeysym_unicode_map[0x0AA6] = 0x2008;
  810. xkeysym_unicode_map[0x0AA7] = 0x2009;
  811. xkeysym_unicode_map[0x0AA8] = 0x200A;
  812. xkeysym_unicode_map[0x0AA9] = 0x2014;
  813. xkeysym_unicode_map[0x0AAA] = 0x2013;
  814. xkeysym_unicode_map[0x0AAE] = 0x2026;
  815. xkeysym_unicode_map[0x0AAF] = 0x2025;
  816. xkeysym_unicode_map[0x0AB0] = 0x2153;
  817. xkeysym_unicode_map[0x0AB1] = 0x2154;
  818. xkeysym_unicode_map[0x0AB2] = 0x2155;
  819. xkeysym_unicode_map[0x0AB3] = 0x2156;
  820. xkeysym_unicode_map[0x0AB4] = 0x2157;
  821. xkeysym_unicode_map[0x0AB5] = 0x2158;
  822. xkeysym_unicode_map[0x0AB6] = 0x2159;
  823. xkeysym_unicode_map[0x0AB7] = 0x215A;
  824. xkeysym_unicode_map[0x0AB8] = 0x2105;
  825. xkeysym_unicode_map[0x0ABB] = 0x2012;
  826. xkeysym_unicode_map[0x0ABC] = 0x2329;
  827. xkeysym_unicode_map[0x0ABE] = 0x232A;
  828. xkeysym_unicode_map[0x0AC3] = 0x215B;
  829. xkeysym_unicode_map[0x0AC4] = 0x215C;
  830. xkeysym_unicode_map[0x0AC5] = 0x215D;
  831. xkeysym_unicode_map[0x0AC6] = 0x215E;
  832. xkeysym_unicode_map[0x0AC9] = 0x2122;
  833. xkeysym_unicode_map[0x0ACA] = 0x2613;
  834. xkeysym_unicode_map[0x0ACC] = 0x25C1;
  835. xkeysym_unicode_map[0x0ACD] = 0x25B7;
  836. xkeysym_unicode_map[0x0ACE] = 0x25CB;
  837. xkeysym_unicode_map[0x0ACF] = 0x25AF;
  838. xkeysym_unicode_map[0x0AD0] = 0x2018;
  839. xkeysym_unicode_map[0x0AD1] = 0x2019;
  840. xkeysym_unicode_map[0x0AD2] = 0x201C;
  841. xkeysym_unicode_map[0x0AD3] = 0x201D;
  842. xkeysym_unicode_map[0x0AD4] = 0x211E;
  843. xkeysym_unicode_map[0x0AD6] = 0x2032;
  844. xkeysym_unicode_map[0x0AD7] = 0x2033;
  845. xkeysym_unicode_map[0x0AD9] = 0x271D;
  846. xkeysym_unicode_map[0x0ADB] = 0x25AC;
  847. xkeysym_unicode_map[0x0ADC] = 0x25C0;
  848. xkeysym_unicode_map[0x0ADD] = 0x25B6;
  849. xkeysym_unicode_map[0x0ADE] = 0x25CF;
  850. xkeysym_unicode_map[0x0ADF] = 0x25AE;
  851. xkeysym_unicode_map[0x0AE0] = 0x25E6;
  852. xkeysym_unicode_map[0x0AE1] = 0x25AB;
  853. xkeysym_unicode_map[0x0AE2] = 0x25AD;
  854. xkeysym_unicode_map[0x0AE3] = 0x25B3;
  855. xkeysym_unicode_map[0x0AE4] = 0x25BD;
  856. xkeysym_unicode_map[0x0AE5] = 0x2606;
  857. xkeysym_unicode_map[0x0AE6] = 0x2022;
  858. xkeysym_unicode_map[0x0AE7] = 0x25AA;
  859. xkeysym_unicode_map[0x0AE8] = 0x25B2;
  860. xkeysym_unicode_map[0x0AE9] = 0x25BC;
  861. xkeysym_unicode_map[0x0AEA] = 0x261C;
  862. xkeysym_unicode_map[0x0AEB] = 0x261E;
  863. xkeysym_unicode_map[0x0AEC] = 0x2663;
  864. xkeysym_unicode_map[0x0AED] = 0x2666;
  865. xkeysym_unicode_map[0x0AEE] = 0x2665;
  866. xkeysym_unicode_map[0x0AF0] = 0x2720;
  867. xkeysym_unicode_map[0x0AF1] = 0x2020;
  868. xkeysym_unicode_map[0x0AF2] = 0x2021;
  869. xkeysym_unicode_map[0x0AF3] = 0x2713;
  870. xkeysym_unicode_map[0x0AF4] = 0x2717;
  871. xkeysym_unicode_map[0x0AF5] = 0x266F;
  872. xkeysym_unicode_map[0x0AF6] = 0x266D;
  873. xkeysym_unicode_map[0x0AF7] = 0x2642;
  874. xkeysym_unicode_map[0x0AF8] = 0x2640;
  875. xkeysym_unicode_map[0x0AF9] = 0x260E;
  876. xkeysym_unicode_map[0x0AFA] = 0x2315;
  877. xkeysym_unicode_map[0x0AFB] = 0x2117;
  878. xkeysym_unicode_map[0x0AFC] = 0x2038;
  879. xkeysym_unicode_map[0x0AFD] = 0x201A;
  880. xkeysym_unicode_map[0x0AFE] = 0x201E;
  881. xkeysym_unicode_map[0x0BA3] = 0x003C;
  882. xkeysym_unicode_map[0x0BA6] = 0x003E;
  883. xkeysym_unicode_map[0x0BA8] = 0x2228;
  884. xkeysym_unicode_map[0x0BA9] = 0x2227;
  885. xkeysym_unicode_map[0x0BC0] = 0x00AF;
  886. xkeysym_unicode_map[0x0BC2] = 0x22A5;
  887. xkeysym_unicode_map[0x0BC3] = 0x2229;
  888. xkeysym_unicode_map[0x0BC4] = 0x230A;
  889. xkeysym_unicode_map[0x0BC6] = 0x005F;
  890. xkeysym_unicode_map[0x0BCA] = 0x2218;
  891. xkeysym_unicode_map[0x0BCC] = 0x2395;
  892. xkeysym_unicode_map[0x0BCE] = 0x22A4;
  893. xkeysym_unicode_map[0x0BCF] = 0x25CB;
  894. xkeysym_unicode_map[0x0BD3] = 0x2308;
  895. xkeysym_unicode_map[0x0BD6] = 0x222A;
  896. xkeysym_unicode_map[0x0BD8] = 0x2283;
  897. xkeysym_unicode_map[0x0BDA] = 0x2282;
  898. xkeysym_unicode_map[0x0BDC] = 0x22A2;
  899. xkeysym_unicode_map[0x0BFC] = 0x22A3;
  900. xkeysym_unicode_map[0x0CDF] = 0x2017;
  901. xkeysym_unicode_map[0x0CE0] = 0x05D0;
  902. xkeysym_unicode_map[0x0CE1] = 0x05D1;
  903. xkeysym_unicode_map[0x0CE2] = 0x05D2;
  904. xkeysym_unicode_map[0x0CE3] = 0x05D3;
  905. xkeysym_unicode_map[0x0CE4] = 0x05D4;
  906. xkeysym_unicode_map[0x0CE5] = 0x05D5;
  907. xkeysym_unicode_map[0x0CE6] = 0x05D6;
  908. xkeysym_unicode_map[0x0CE7] = 0x05D7;
  909. xkeysym_unicode_map[0x0CE8] = 0x05D8;
  910. xkeysym_unicode_map[0x0CE9] = 0x05D9;
  911. xkeysym_unicode_map[0x0CEA] = 0x05DA;
  912. xkeysym_unicode_map[0x0CEB] = 0x05DB;
  913. xkeysym_unicode_map[0x0CEC] = 0x05DC;
  914. xkeysym_unicode_map[0x0CED] = 0x05DD;
  915. xkeysym_unicode_map[0x0CEE] = 0x05DE;
  916. xkeysym_unicode_map[0x0CEF] = 0x05DF;
  917. xkeysym_unicode_map[0x0CF0] = 0x05E0;
  918. xkeysym_unicode_map[0x0CF1] = 0x05E1;
  919. xkeysym_unicode_map[0x0CF2] = 0x05E2;
  920. xkeysym_unicode_map[0x0CF3] = 0x05E3;
  921. xkeysym_unicode_map[0x0CF4] = 0x05E4;
  922. xkeysym_unicode_map[0x0CF5] = 0x05E5;
  923. xkeysym_unicode_map[0x0CF6] = 0x05E6;
  924. xkeysym_unicode_map[0x0CF7] = 0x05E7;
  925. xkeysym_unicode_map[0x0CF8] = 0x05E8;
  926. xkeysym_unicode_map[0x0CF9] = 0x05E9;
  927. xkeysym_unicode_map[0x0CFA] = 0x05EA;
  928. xkeysym_unicode_map[0x0DA1] = 0x0E01;
  929. xkeysym_unicode_map[0x0DA2] = 0x0E02;
  930. xkeysym_unicode_map[0x0DA3] = 0x0E03;
  931. xkeysym_unicode_map[0x0DA4] = 0x0E04;
  932. xkeysym_unicode_map[0x0DA5] = 0x0E05;
  933. xkeysym_unicode_map[0x0DA6] = 0x0E06;
  934. xkeysym_unicode_map[0x0DA7] = 0x0E07;
  935. xkeysym_unicode_map[0x0DA8] = 0x0E08;
  936. xkeysym_unicode_map[0x0DA9] = 0x0E09;
  937. xkeysym_unicode_map[0x0DAA] = 0x0E0A;
  938. xkeysym_unicode_map[0x0DAB] = 0x0E0B;
  939. xkeysym_unicode_map[0x0DAC] = 0x0E0C;
  940. xkeysym_unicode_map[0x0DAD] = 0x0E0D;
  941. xkeysym_unicode_map[0x0DAE] = 0x0E0E;
  942. xkeysym_unicode_map[0x0DAF] = 0x0E0F;
  943. xkeysym_unicode_map[0x0DB0] = 0x0E10;
  944. xkeysym_unicode_map[0x0DB1] = 0x0E11;
  945. xkeysym_unicode_map[0x0DB2] = 0x0E12;
  946. xkeysym_unicode_map[0x0DB3] = 0x0E13;
  947. xkeysym_unicode_map[0x0DB4] = 0x0E14;
  948. xkeysym_unicode_map[0x0DB5] = 0x0E15;
  949. xkeysym_unicode_map[0x0DB6] = 0x0E16;
  950. xkeysym_unicode_map[0x0DB7] = 0x0E17;
  951. xkeysym_unicode_map[0x0DB8] = 0x0E18;
  952. xkeysym_unicode_map[0x0DB9] = 0x0E19;
  953. xkeysym_unicode_map[0x0DBA] = 0x0E1A;
  954. xkeysym_unicode_map[0x0DBB] = 0x0E1B;
  955. xkeysym_unicode_map[0x0DBC] = 0x0E1C;
  956. xkeysym_unicode_map[0x0DBD] = 0x0E1D;
  957. xkeysym_unicode_map[0x0DBE] = 0x0E1E;
  958. xkeysym_unicode_map[0x0DBF] = 0x0E1F;
  959. xkeysym_unicode_map[0x0DC0] = 0x0E20;
  960. xkeysym_unicode_map[0x0DC1] = 0x0E21;
  961. xkeysym_unicode_map[0x0DC2] = 0x0E22;
  962. xkeysym_unicode_map[0x0DC3] = 0x0E23;
  963. xkeysym_unicode_map[0x0DC4] = 0x0E24;
  964. xkeysym_unicode_map[0x0DC5] = 0x0E25;
  965. xkeysym_unicode_map[0x0DC6] = 0x0E26;
  966. xkeysym_unicode_map[0x0DC7] = 0x0E27;
  967. xkeysym_unicode_map[0x0DC8] = 0x0E28;
  968. xkeysym_unicode_map[0x0DC9] = 0x0E29;
  969. xkeysym_unicode_map[0x0DCA] = 0x0E2A;
  970. xkeysym_unicode_map[0x0DCB] = 0x0E2B;
  971. xkeysym_unicode_map[0x0DCC] = 0x0E2C;
  972. xkeysym_unicode_map[0x0DCD] = 0x0E2D;
  973. xkeysym_unicode_map[0x0DCE] = 0x0E2E;
  974. xkeysym_unicode_map[0x0DCF] = 0x0E2F;
  975. xkeysym_unicode_map[0x0DD0] = 0x0E30;
  976. xkeysym_unicode_map[0x0DD1] = 0x0E31;
  977. xkeysym_unicode_map[0x0DD2] = 0x0E32;
  978. xkeysym_unicode_map[0x0DD3] = 0x0E33;
  979. xkeysym_unicode_map[0x0DD4] = 0x0E34;
  980. xkeysym_unicode_map[0x0DD5] = 0x0E35;
  981. xkeysym_unicode_map[0x0DD6] = 0x0E36;
  982. xkeysym_unicode_map[0x0DD7] = 0x0E37;
  983. xkeysym_unicode_map[0x0DD8] = 0x0E38;
  984. xkeysym_unicode_map[0x0DD9] = 0x0E39;
  985. xkeysym_unicode_map[0x0DDA] = 0x0E3A;
  986. xkeysym_unicode_map[0x0DDF] = 0x0E3F;
  987. xkeysym_unicode_map[0x0DE0] = 0x0E40;
  988. xkeysym_unicode_map[0x0DE1] = 0x0E41;
  989. xkeysym_unicode_map[0x0DE2] = 0x0E42;
  990. xkeysym_unicode_map[0x0DE3] = 0x0E43;
  991. xkeysym_unicode_map[0x0DE4] = 0x0E44;
  992. xkeysym_unicode_map[0x0DE5] = 0x0E45;
  993. xkeysym_unicode_map[0x0DE6] = 0x0E46;
  994. xkeysym_unicode_map[0x0DE7] = 0x0E47;
  995. xkeysym_unicode_map[0x0DE8] = 0x0E48;
  996. xkeysym_unicode_map[0x0DE9] = 0x0E49;
  997. xkeysym_unicode_map[0x0DEA] = 0x0E4A;
  998. xkeysym_unicode_map[0x0DEB] = 0x0E4B;
  999. xkeysym_unicode_map[0x0DEC] = 0x0E4C;
  1000. xkeysym_unicode_map[0x0DED] = 0x0E4D;
  1001. xkeysym_unicode_map[0x0DF0] = 0x0E50;
  1002. xkeysym_unicode_map[0x0DF1] = 0x0E51;
  1003. xkeysym_unicode_map[0x0DF2] = 0x0E52;
  1004. xkeysym_unicode_map[0x0DF3] = 0x0E53;
  1005. xkeysym_unicode_map[0x0DF4] = 0x0E54;
  1006. xkeysym_unicode_map[0x0DF5] = 0x0E55;
  1007. xkeysym_unicode_map[0x0DF6] = 0x0E56;
  1008. xkeysym_unicode_map[0x0DF7] = 0x0E57;
  1009. xkeysym_unicode_map[0x0DF8] = 0x0E58;
  1010. xkeysym_unicode_map[0x0DF9] = 0x0E59;
  1011. xkeysym_unicode_map[0x0EA1] = 0x3131;
  1012. xkeysym_unicode_map[0x0EA2] = 0x3132;
  1013. xkeysym_unicode_map[0x0EA3] = 0x3133;
  1014. xkeysym_unicode_map[0x0EA4] = 0x3134;
  1015. xkeysym_unicode_map[0x0EA5] = 0x3135;
  1016. xkeysym_unicode_map[0x0EA6] = 0x3136;
  1017. xkeysym_unicode_map[0x0EA7] = 0x3137;
  1018. xkeysym_unicode_map[0x0EA8] = 0x3138;
  1019. xkeysym_unicode_map[0x0EA9] = 0x3139;
  1020. xkeysym_unicode_map[0x0EAA] = 0x313A;
  1021. xkeysym_unicode_map[0x0EAB] = 0x313B;
  1022. xkeysym_unicode_map[0x0EAC] = 0x313C;
  1023. xkeysym_unicode_map[0x0EAD] = 0x313D;
  1024. xkeysym_unicode_map[0x0EAE] = 0x313E;
  1025. xkeysym_unicode_map[0x0EAF] = 0x313F;
  1026. xkeysym_unicode_map[0x0EB0] = 0x3140;
  1027. xkeysym_unicode_map[0x0EB1] = 0x3141;
  1028. xkeysym_unicode_map[0x0EB2] = 0x3142;
  1029. xkeysym_unicode_map[0x0EB3] = 0x3143;
  1030. xkeysym_unicode_map[0x0EB4] = 0x3144;
  1031. xkeysym_unicode_map[0x0EB5] = 0x3145;
  1032. xkeysym_unicode_map[0x0EB6] = 0x3146;
  1033. xkeysym_unicode_map[0x0EB7] = 0x3147;
  1034. xkeysym_unicode_map[0x0EB8] = 0x3148;
  1035. xkeysym_unicode_map[0x0EB9] = 0x3149;
  1036. xkeysym_unicode_map[0x0EBA] = 0x314A;
  1037. xkeysym_unicode_map[0x0EBB] = 0x314B;
  1038. xkeysym_unicode_map[0x0EBC] = 0x314C;
  1039. xkeysym_unicode_map[0x0EBD] = 0x314D;
  1040. xkeysym_unicode_map[0x0EBE] = 0x314E;
  1041. xkeysym_unicode_map[0x0EBF] = 0x314F;
  1042. xkeysym_unicode_map[0x0EC0] = 0x3150;
  1043. xkeysym_unicode_map[0x0EC1] = 0x3151;
  1044. xkeysym_unicode_map[0x0EC2] = 0x3152;
  1045. xkeysym_unicode_map[0x0EC3] = 0x3153;
  1046. xkeysym_unicode_map[0x0EC4] = 0x3154;
  1047. xkeysym_unicode_map[0x0EC5] = 0x3155;
  1048. xkeysym_unicode_map[0x0EC6] = 0x3156;
  1049. xkeysym_unicode_map[0x0EC7] = 0x3157;
  1050. xkeysym_unicode_map[0x0EC8] = 0x3158;
  1051. xkeysym_unicode_map[0x0EC9] = 0x3159;
  1052. xkeysym_unicode_map[0x0ECA] = 0x315A;
  1053. xkeysym_unicode_map[0x0ECB] = 0x315B;
  1054. xkeysym_unicode_map[0x0ECC] = 0x315C;
  1055. xkeysym_unicode_map[0x0ECD] = 0x315D;
  1056. xkeysym_unicode_map[0x0ECE] = 0x315E;
  1057. xkeysym_unicode_map[0x0ECF] = 0x315F;
  1058. xkeysym_unicode_map[0x0ED0] = 0x3160;
  1059. xkeysym_unicode_map[0x0ED1] = 0x3161;
  1060. xkeysym_unicode_map[0x0ED2] = 0x3162;
  1061. xkeysym_unicode_map[0x0ED3] = 0x3163;
  1062. xkeysym_unicode_map[0x0ED4] = 0x11A8;
  1063. xkeysym_unicode_map[0x0ED5] = 0x11A9;
  1064. xkeysym_unicode_map[0x0ED6] = 0x11AA;
  1065. xkeysym_unicode_map[0x0ED7] = 0x11AB;
  1066. xkeysym_unicode_map[0x0ED8] = 0x11AC;
  1067. xkeysym_unicode_map[0x0ED9] = 0x11AD;
  1068. xkeysym_unicode_map[0x0EDA] = 0x11AE;
  1069. xkeysym_unicode_map[0x0EDB] = 0x11AF;
  1070. xkeysym_unicode_map[0x0EDC] = 0x11B0;
  1071. xkeysym_unicode_map[0x0EDD] = 0x11B1;
  1072. xkeysym_unicode_map[0x0EDE] = 0x11B2;
  1073. xkeysym_unicode_map[0x0EDF] = 0x11B3;
  1074. xkeysym_unicode_map[0x0EE0] = 0x11B4;
  1075. xkeysym_unicode_map[0x0EE1] = 0x11B5;
  1076. xkeysym_unicode_map[0x0EE2] = 0x11B6;
  1077. xkeysym_unicode_map[0x0EE3] = 0x11B7;
  1078. xkeysym_unicode_map[0x0EE4] = 0x11B8;
  1079. xkeysym_unicode_map[0x0EE5] = 0x11B9;
  1080. xkeysym_unicode_map[0x0EE6] = 0x11BA;
  1081. xkeysym_unicode_map[0x0EE7] = 0x11BB;
  1082. xkeysym_unicode_map[0x0EE8] = 0x11BC;
  1083. xkeysym_unicode_map[0x0EE9] = 0x11BD;
  1084. xkeysym_unicode_map[0x0EEA] = 0x11BE;
  1085. xkeysym_unicode_map[0x0EEB] = 0x11BF;
  1086. xkeysym_unicode_map[0x0EEC] = 0x11C0;
  1087. xkeysym_unicode_map[0x0EED] = 0x11C1;
  1088. xkeysym_unicode_map[0x0EEE] = 0x11C2;
  1089. xkeysym_unicode_map[0x0EEF] = 0x316D;
  1090. xkeysym_unicode_map[0x0EF0] = 0x3171;
  1091. xkeysym_unicode_map[0x0EF1] = 0x3178;
  1092. xkeysym_unicode_map[0x0EF2] = 0x317F;
  1093. xkeysym_unicode_map[0x0EF3] = 0x3181;
  1094. xkeysym_unicode_map[0x0EF4] = 0x3184;
  1095. xkeysym_unicode_map[0x0EF5] = 0x3186;
  1096. xkeysym_unicode_map[0x0EF6] = 0x318D;
  1097. xkeysym_unicode_map[0x0EF7] = 0x318E;
  1098. xkeysym_unicode_map[0x0EF8] = 0x11EB;
  1099. xkeysym_unicode_map[0x0EF9] = 0x11F0;
  1100. xkeysym_unicode_map[0x0EFA] = 0x11F9;
  1101. xkeysym_unicode_map[0x0EFF] = 0x20A9;
  1102. xkeysym_unicode_map[0x13A4] = 0x20AC;
  1103. xkeysym_unicode_map[0x13BC] = 0x0152;
  1104. xkeysym_unicode_map[0x13BD] = 0x0153;
  1105. xkeysym_unicode_map[0x13BE] = 0x0178;
  1106. xkeysym_unicode_map[0x20AC] = 0x20AC;
  1107. // Scancode to physical location map.
  1108. // Ctrl.
  1109. location_map[0x25] = KeyLocation::LEFT;
  1110. location_map[0x69] = KeyLocation::RIGHT;
  1111. // Shift.
  1112. location_map[0x32] = KeyLocation::LEFT;
  1113. location_map[0x3E] = KeyLocation::RIGHT;
  1114. // Alt.
  1115. location_map[0x40] = KeyLocation::LEFT;
  1116. location_map[0x6C] = KeyLocation::RIGHT;
  1117. // Meta.
  1118. location_map[0x85] = KeyLocation::LEFT;
  1119. location_map[0x86] = KeyLocation::RIGHT;
  1120. }
  1121. Key KeyMappingX11::get_keycode(KeySym p_keysym) {
  1122. if (p_keysym >= 0x20 && p_keysym < 0x7E) { // ASCII, maps 1-1
  1123. if (p_keysym > 0x60 && p_keysym < 0x7B) { // Lowercase ASCII.
  1124. return (Key)(p_keysym - 32);
  1125. } else {
  1126. return (Key)p_keysym;
  1127. }
  1128. }
  1129. const Key *key = xkeysym_map.getptr(p_keysym);
  1130. if (key) {
  1131. return *key;
  1132. }
  1133. return Key::NONE;
  1134. }
  1135. Key KeyMappingX11::get_scancode(unsigned int p_code) {
  1136. const Key *key = scancode_map.getptr(p_code);
  1137. if (key) {
  1138. return *key;
  1139. }
  1140. return Key::NONE;
  1141. }
  1142. unsigned int KeyMappingX11::get_xlibcode(Key p_keysym) {
  1143. const unsigned int *key = scancode_map_inv.getptr(p_keysym);
  1144. if (key) {
  1145. return *key;
  1146. }
  1147. return 0x00;
  1148. }
  1149. char32_t KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) {
  1150. // Latin-1
  1151. if (p_keysym >= 0x20 && p_keysym <= 0x7E) {
  1152. return p_keysym;
  1153. }
  1154. if (p_keysym >= 0xA0 && p_keysym <= 0xFF) {
  1155. return p_keysym;
  1156. }
  1157. // Keypad to Latin-1.
  1158. if (p_keysym >= 0xFFAA && p_keysym <= 0xFFB9) {
  1159. return p_keysym - 0xFF80;
  1160. }
  1161. // Unicode (may be present).
  1162. if ((p_keysym & 0xFF000000) == 0x01000000) {
  1163. return p_keysym & 0x00FFFFFF;
  1164. }
  1165. const char32_t *c = xkeysym_unicode_map.getptr(p_keysym);
  1166. if (c) {
  1167. return *c;
  1168. }
  1169. return 0;
  1170. }
  1171. KeyLocation KeyMappingX11::get_location(unsigned int p_code) {
  1172. const KeyLocation *location = location_map.getptr(p_code);
  1173. if (location) {
  1174. return *location;
  1175. }
  1176. return KeyLocation::UNSPECIFIED;
  1177. }