PageRenderTime 58ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/platform/windows/key_mapping_windows.cpp

https://gitlab.com/godotengine/godot
C++ | 515 lines | 338 code | 66 blank | 111 comment | 26 complexity | 3f04dcade8c5a1ac23fb9c37f2cf1a87 MD5 | raw file
  1. /*************************************************************************/
  2. /* key_mapping_windows.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  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_windows.h"
  31. #include <stdio.h>
  32. // This provides translation from Windows virtual key codes to Godot and back.
  33. // See WinUser.h and the below for documentation:
  34. // https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
  35. struct _WinTranslatePair {
  36. Key keysym;
  37. unsigned int keycode;
  38. };
  39. static _WinTranslatePair _vk_to_keycode[] = {
  40. // VK_LBUTTON (0x01)
  41. // VK_RBUTTON (0x02)
  42. // VK_CANCEL (0x03)
  43. // VK_MBUTTON (0x04)
  44. // VK_XBUTTON1 (0x05)
  45. // VK_XBUTTON2 (0x06)
  46. // We have no mappings for the above, as we only map keyboard buttons here.
  47. // 0x07 is undefined.
  48. { Key::BACKSPACE, VK_BACK }, // (0x08)
  49. { Key::TAB, VK_TAB }, // (0x09)
  50. // 0x0A-0B are reserved.
  51. { Key::CLEAR, VK_CLEAR }, // (0x0C)
  52. { Key::ENTER, VK_RETURN }, // (0x0D)
  53. // 0x0E-0F are undefined.
  54. { Key::SHIFT, VK_SHIFT }, // (0x10)
  55. { Key::CTRL, VK_CONTROL }, // (0x11)
  56. { Key::ALT, VK_MENU }, // (0x12)
  57. { Key::PAUSE, VK_PAUSE }, // (0x13)
  58. { Key::CAPSLOCK, VK_CAPITAL }, // (0x14)
  59. // 0x15-1A are IME keys. We have no mapping.
  60. { Key::ESCAPE, VK_ESCAPE }, // (0x1B)
  61. // 0x1C-1F are IME keys. We have no mapping.
  62. { Key::SPACE, VK_SPACE }, // (0x20)
  63. { Key::PAGEUP, VK_PRIOR }, // (0x21)
  64. { Key::PAGEDOWN, VK_NEXT }, // (0x22)
  65. { Key::END, VK_END }, // (0x23)
  66. { Key::HOME, VK_HOME }, // (0x24)
  67. { Key::LEFT, VK_LEFT }, // (0x25)
  68. { Key::UP, VK_UP }, // (0x26)
  69. { Key::RIGHT, VK_RIGHT }, // (0x27)
  70. { Key::DOWN, VK_DOWN }, // (0x28)
  71. // VK_SELECT (0x29)
  72. // Old select key, e.g. on Digital Equipment Corporation keyboards.
  73. // Old and uncommon, we have no mapping.
  74. { Key::PRINT, VK_PRINT }, // (0x2A)
  75. // Old IBM key, modern keyboards use VK_SNAPSHOT. Map to VK_SNAPSHOT.
  76. // VK_EXECUTE (0x2B)
  77. // Old and uncommon, we have no mapping.
  78. { Key::PRINT, VK_SNAPSHOT }, // (0x2C)
  79. { Key::INSERT, VK_INSERT }, // (0x2D)
  80. { Key::KEY_DELETE, VK_DELETE }, // (0x2E)
  81. { Key::HELP, VK_HELP }, // (0x2F)
  82. // Old and uncommon, but we have a mapping.
  83. { Key::KEY_0, (0x30) }, // 0 key.
  84. { Key::KEY_1, (0x31) }, // 1 key.
  85. { Key::KEY_2, (0x32) }, // 2 key.
  86. { Key::KEY_3, (0x33) }, // 3 key.
  87. { Key::KEY_4, (0x34) }, // 4 key.
  88. { Key::KEY_5, (0x35) }, // 5 key.
  89. { Key::KEY_6, (0x36) }, // 6 key.
  90. { Key::KEY_7, (0x37) }, // 7 key.
  91. { Key::KEY_8, (0x38) }, // 8 key.
  92. { Key::KEY_9, (0x39) }, // 9 key.
  93. // 0x3A-40 are undefined.
  94. { Key::A, (0x41) }, // A key.
  95. { Key::B, (0x42) }, // B key.
  96. { Key::C, (0x43) }, // C key.
  97. { Key::D, (0x44) }, // D key.
  98. { Key::E, (0x45) }, // E key.
  99. { Key::F, (0x46) }, // F key.
  100. { Key::G, (0x47) }, // G key.
  101. { Key::H, (0x48) }, // H key.
  102. { Key::I, (0x49) }, // I key
  103. { Key::J, (0x4A) }, // J key.
  104. { Key::K, (0x4B) }, // K key.
  105. { Key::L, (0x4C) }, // L key.
  106. { Key::M, (0x4D) }, // M key.
  107. { Key::N, (0x4E) }, // N key.
  108. { Key::O, (0x4F) }, // O key.
  109. { Key::P, (0x50) }, // P key.
  110. { Key::Q, (0x51) }, // Q key.
  111. { Key::R, (0x52) }, // R key.
  112. { Key::S, (0x53) }, // S key.
  113. { Key::T, (0x54) }, // T key.
  114. { Key::U, (0x55) }, // U key.
  115. { Key::V, (0x56) }, // V key.
  116. { Key::W, (0x57) }, // W key.
  117. { Key::X, (0x58) }, // X key.
  118. { Key::Y, (0x59) }, // Y key.
  119. { Key::Z, (0x5A) }, // Z key.
  120. { (Key)KeyModifierMask::META, VK_LWIN }, // (0x5B)
  121. { (Key)KeyModifierMask::META, VK_RWIN }, // (0x5C)
  122. { Key::MENU, VK_APPS }, // (0x5D)
  123. // 0x5E is reserved.
  124. { Key::STANDBY, VK_SLEEP }, // (0x5F)
  125. { Key::KP_0, VK_NUMPAD0 }, // (0x60)
  126. { Key::KP_1, VK_NUMPAD1 }, // (0x61)
  127. { Key::KP_2, VK_NUMPAD2 }, // (0x62)
  128. { Key::KP_3, VK_NUMPAD3 }, // (0x63)
  129. { Key::KP_4, VK_NUMPAD4 }, // (0x64)
  130. { Key::KP_5, VK_NUMPAD5 }, // (0x65)
  131. { Key::KP_6, VK_NUMPAD6 }, // (0x66)
  132. { Key::KP_7, VK_NUMPAD7 }, // (0x67)
  133. { Key::KP_8, VK_NUMPAD8 }, // (0x68)
  134. { Key::KP_9, VK_NUMPAD9 }, // (0x69)
  135. { Key::KP_MULTIPLY, VK_MULTIPLY }, // (0x6A)
  136. { Key::KP_ADD, VK_ADD }, // (0x6B)
  137. { Key::KP_PERIOD, VK_SEPARATOR }, // (0x6C)
  138. // VK_SEPERATOR (key 0x6C) is not found on US keyboards.
  139. // It is used on some Brazilian and Far East keyboards.
  140. // We don't have a direct mapping, map to period.
  141. { Key::KP_SUBTRACT, VK_SUBTRACT }, // (0x6D)
  142. { Key::KP_PERIOD, VK_DECIMAL }, // (0x6E)
  143. { Key::KP_DIVIDE, VK_DIVIDE }, // (0x6F)
  144. { Key::F1, VK_F1 }, // (0x70)
  145. { Key::F2, VK_F2 }, // (0x71)
  146. { Key::F3, VK_F3 }, // (0x72)
  147. { Key::F4, VK_F4 }, // (0x73)
  148. { Key::F5, VK_F5 }, // (0x74)
  149. { Key::F6, VK_F6 }, // (0x75)
  150. { Key::F7, VK_F7 }, // (0x76)
  151. { Key::F8, VK_F8 }, // (0x77)
  152. { Key::F9, VK_F9 }, // (0x78)
  153. { Key::F10, VK_F10 }, // (0x79)
  154. { Key::F11, VK_F11 }, // (0x7A)
  155. { Key::F12, VK_F12 }, // (0x7B)
  156. { Key::F13, VK_F13 }, // (0x7C)
  157. { Key::F14, VK_F14 }, // (0x7D)
  158. { Key::F15, VK_F15 }, // (0x7E)
  159. { Key::F16, VK_F16 }, // (0x7F)
  160. // We have no mappings for F17-F24. (0x80-87)
  161. // 0x88-8F are reserved for UI navigation.
  162. { Key::NUMLOCK, VK_NUMLOCK }, // (0x90)
  163. { Key::SCROLLLOCK, VK_SCROLL }, // (0x91)
  164. { Key::EQUAL, VK_OEM_NEC_EQUAL }, // (0x92)
  165. // OEM NEC PC-9800 numpad '=' key.
  166. // 0x93-96 are OEM specific (e.g. used by Fujitsu/OASYS), we have no mappings.
  167. // 0x97-9F are unassigned.
  168. { Key::SHIFT, VK_LSHIFT }, // (0xA0)
  169. { Key::SHIFT, VK_RSHIFT }, // (0xA1)
  170. { Key::CTRL, VK_LCONTROL }, // (0xA2)
  171. { Key::CTRL, VK_RCONTROL }, // (0xA3)
  172. { Key::MENU, VK_LMENU }, // (0xA4)
  173. { Key::MENU, VK_RMENU }, // (0xA5)
  174. { Key::BACK, VK_BROWSER_BACK }, // (0xA6)
  175. { Key::FORWARD, VK_BROWSER_FORWARD }, // (0xA7)
  176. { Key::REFRESH, VK_BROWSER_REFRESH }, // (0xA8)
  177. { Key::STOP, VK_BROWSER_STOP }, // (0xA9)
  178. { Key::SEARCH, VK_BROWSER_SEARCH }, // (0xAA)
  179. { Key::FAVORITES, VK_BROWSER_FAVORITES }, // (0xAB)
  180. { Key::HOMEPAGE, VK_BROWSER_HOME }, // (0xAC)
  181. { Key::VOLUMEMUTE, VK_VOLUME_MUTE }, // (0xAD)
  182. { Key::VOLUMEDOWN, VK_VOLUME_DOWN }, // (0xAE)
  183. { Key::VOLUMEUP, VK_VOLUME_UP }, // (0xAF)
  184. { Key::MEDIANEXT, VK_MEDIA_NEXT_TRACK }, // (0xB0)
  185. { Key::MEDIAPREVIOUS, VK_MEDIA_PREV_TRACK }, // (0xB1)
  186. { Key::MEDIASTOP, VK_MEDIA_STOP }, // (0xB2)
  187. { Key::MEDIAPLAY, VK_MEDIA_PLAY_PAUSE }, // (0xB3)
  188. // Media button play/pause toggle.
  189. // Map to media play (there is no other 'play' mapping on Windows).
  190. { Key::LAUNCHMAIL, VK_LAUNCH_MAIL }, // (0xB4)
  191. { Key::LAUNCHMEDIA, VK_LAUNCH_MEDIA_SELECT }, // (0xB5)
  192. { Key::LAUNCH0, VK_LAUNCH_APP1 }, // (0xB6)
  193. { Key::LAUNCH1, VK_LAUNCH_APP2 }, // (0xB7)
  194. // 0xB8-B9 are reserved.
  195. { Key::SEMICOLON, VK_OEM_1 }, // (0xBA)
  196. // Misc. character, can vary by keyboard/region.
  197. // Windows 2000/XP: For US standard keyboards, the ';:' key.
  198. { Key::EQUAL, VK_OEM_PLUS }, // (0xBB)
  199. // Windows 2000/XP: For any country/region, the '+' key.
  200. { Key::COMMA, VK_OEM_COMMA }, // (0xBC)
  201. // Windows 2000/XP: For any country/region, the ',' key.
  202. { Key::MINUS, VK_OEM_MINUS }, // (0xBD)
  203. // Windows 2000/XP: For any country/region, the '-' key.
  204. { Key::PERIOD, VK_OEM_PERIOD }, // (0xBE)
  205. // Windows 2000/XP: For any country/region, the '.' key.
  206. { Key::SLASH, VK_OEM_2 }, // (0xBF)
  207. // Windows 2000/XP: For US standard keyboards, the '/?' key.
  208. { Key::QUOTELEFT, VK_OEM_3 }, // (0xC0)
  209. // Windows 2000/XP: For US standard keyboards, the '`~' key.
  210. // 0xC1-D7 are reserved. 0xD8-DA are unassigned.
  211. // TODO: 0xC3-DA may be used for old gamepads? Maybe we want to support this? See WinUser.h.
  212. { Key::BRACKETLEFT, VK_OEM_4 }, // (0xDB)
  213. // Misc. character, can vary by keyboard/region.
  214. // Windows 2000/XP: For US standard keyboards, the '[{' key.
  215. { Key::BACKSLASH, VK_OEM_5 }, // (0xDC)
  216. // Misc. character, can vary by keyboard/region.
  217. // Windows 2000/XP: For US standard keyboards, the '\|' key.
  218. { Key::BRACKETRIGHT, VK_OEM_6 }, // (0xDD)
  219. // Misc. character, can vary by keyboard/region.
  220. // Windows 2000/XP: For US standard keyboards, the ']}' key.
  221. { Key::APOSTROPHE, VK_OEM_7 }, // (0xDE)
  222. // Misc. character, can vary by keyboard/region.
  223. // Windows 2000/XP: For US standard keyboards, single quote/double quote.
  224. // VK_OEM_8 (0xDF)
  225. // Misc. character, can vary by keyboard/region. We have no mapping.
  226. // 0xE0 is reserved. 0xE1 is OEM specific, we have no mapping.
  227. // VK_OEM_102 (0xE2)
  228. // Either angle bracket or backslash key on the RT 102-key keyboard.
  229. // Old and uncommon, we have no mapping.
  230. { Key::HELP, VK_ICO_HELP }, // (0xE3)
  231. // OEM (ICO) help key. Map to help.
  232. // 0xE4 is OEM (e.g. ICO) specific, we have no mapping.
  233. // VK_PROCESSKEY (0xE5)
  234. // For IME, we have no mapping.
  235. { Key::CLEAR, VK_ICO_CLEAR }, // (0xE6)
  236. // OEM (ICO) clear key. Map to clear.
  237. // VK_PACKET (0xE7)
  238. // Used to pass Unicode characters as if they were keystrokes.
  239. // See Win32 API docs. We have no mapping.
  240. // 0xE8 is unassigned, 0xE9-F5 are OEM (Nokia/Ericsson) specific, we have no mappings.
  241. { Key::ESCAPE, VK_ATTN }, // (0xF6)
  242. // Old IBM 'ATTN' key used on midrange computers, e.g. AS/400, map to Escape.
  243. { Key::TAB, VK_CRSEL }, // (0xF7)
  244. // Old IBM 3270 'CrSel' (cursor select) key, used to select data fields, map to Tab.
  245. // VK_EXSEL (0xF7)
  246. // Old IBM 3270 extended selection key. No mapping.
  247. // VK_EREOF (0xF8)
  248. // Old IBM 3270 erase to end of field key. No mapping.
  249. { Key::MEDIAPLAY, VK_PLAY }, // (0xFA)
  250. // Old IBM 3270 'Play' key. Map to media play.
  251. // VK_ZOOM (0xFB)
  252. // Old IBM 3290 'Zoom' key. No mapping.
  253. // VK_NONAME (0xFC)
  254. // Reserved. No mapping.
  255. // VK_PA1 (0xFD)
  256. // Old IBM 3270 PA1 key. No mapping.
  257. { Key::CLEAR, VK_OEM_CLEAR }, // (0xFE)
  258. // OEM specific clear key. Unclear how it differs from normal clear. Map to clear.
  259. { Key::UNKNOWN, 0 }
  260. };
  261. static _WinTranslatePair _scancode_to_keycode[] = {
  262. { Key::ESCAPE, 0x01 },
  263. { Key::KEY_1, 0x02 },
  264. { Key::KEY_2, 0x03 },
  265. { Key::KEY_3, 0x04 },
  266. { Key::KEY_4, 0x05 },
  267. { Key::KEY_5, 0x06 },
  268. { Key::KEY_6, 0x07 },
  269. { Key::KEY_7, 0x08 },
  270. { Key::KEY_8, 0x09 },
  271. { Key::KEY_9, 0x0A },
  272. { Key::KEY_0, 0x0B },
  273. { Key::MINUS, 0x0C },
  274. { Key::EQUAL, 0x0D },
  275. { Key::BACKSPACE, 0x0E },
  276. { Key::TAB, 0x0F },
  277. { Key::Q, 0x10 },
  278. { Key::W, 0x11 },
  279. { Key::E, 0x12 },
  280. { Key::R, 0x13 },
  281. { Key::T, 0x14 },
  282. { Key::Y, 0x15 },
  283. { Key::U, 0x16 },
  284. { Key::I, 0x17 },
  285. { Key::O, 0x18 },
  286. { Key::P, 0x19 },
  287. { Key::BRACELEFT, 0x1A },
  288. { Key::BRACERIGHT, 0x1B },
  289. { Key::ENTER, 0x1C },
  290. { Key::CTRL, 0x1D },
  291. { Key::A, 0x1E },
  292. { Key::S, 0x1F },
  293. { Key::D, 0x20 },
  294. { Key::F, 0x21 },
  295. { Key::G, 0x22 },
  296. { Key::H, 0x23 },
  297. { Key::J, 0x24 },
  298. { Key::K, 0x25 },
  299. { Key::L, 0x26 },
  300. { Key::SEMICOLON, 0x27 },
  301. { Key::APOSTROPHE, 0x28 },
  302. { Key::QUOTELEFT, 0x29 },
  303. { Key::SHIFT, 0x2A },
  304. { Key::BACKSLASH, 0x2B },
  305. { Key::Z, 0x2C },
  306. { Key::X, 0x2D },
  307. { Key::C, 0x2E },
  308. { Key::V, 0x2F },
  309. { Key::B, 0x30 },
  310. { Key::N, 0x31 },
  311. { Key::M, 0x32 },
  312. { Key::COMMA, 0x33 },
  313. { Key::PERIOD, 0x34 },
  314. { Key::SLASH, 0x35 },
  315. { Key::SHIFT, 0x36 },
  316. { Key::PRINT, 0x37 },
  317. { Key::ALT, 0x38 },
  318. { Key::SPACE, 0x39 },
  319. { Key::CAPSLOCK, 0x3A },
  320. { Key::F1, 0x3B },
  321. { Key::F2, 0x3C },
  322. { Key::F3, 0x3D },
  323. { Key::F4, 0x3E },
  324. { Key::F5, 0x3F },
  325. { Key::F6, 0x40 },
  326. { Key::F7, 0x41 },
  327. { Key::F8, 0x42 },
  328. { Key::F9, 0x43 },
  329. { Key::F10, 0x44 },
  330. { Key::NUMLOCK, 0x45 },
  331. { Key::SCROLLLOCK, 0x46 },
  332. { Key::HOME, 0x47 },
  333. { Key::UP, 0x48 },
  334. { Key::PAGEUP, 0x49 },
  335. { Key::KP_SUBTRACT, 0x4A },
  336. { Key::LEFT, 0x4B },
  337. { Key::KP_5, 0x4C },
  338. { Key::RIGHT, 0x4D },
  339. { Key::KP_ADD, 0x4E },
  340. { Key::END, 0x4F },
  341. { Key::DOWN, 0x50 },
  342. { Key::PAGEDOWN, 0x51 },
  343. { Key::INSERT, 0x52 },
  344. { Key::KEY_DELETE, 0x53 },
  345. { Key::F11, 0x57 },
  346. { Key::F12, 0x58 },
  347. { Key::META, 0x5B },
  348. { Key::META, 0x5C },
  349. { Key::MENU, 0x5D },
  350. { Key::F13, 0x64 },
  351. { Key::F14, 0x65 },
  352. { Key::F15, 0x66 },
  353. { Key::F16, 0x67 },
  354. { Key::UNKNOWN, 0 }
  355. };
  356. Key KeyMappingWindows::get_keysym(unsigned int p_code) {
  357. for (int i = 0; _vk_to_keycode[i].keysym != Key::UNKNOWN; i++) {
  358. if (_vk_to_keycode[i].keycode == p_code) {
  359. return _vk_to_keycode[i].keysym;
  360. }
  361. }
  362. return Key::UNKNOWN;
  363. }
  364. unsigned int KeyMappingWindows::get_scancode(Key p_keycode) {
  365. for (int i = 0; _scancode_to_keycode[i].keysym != Key::UNKNOWN; i++) {
  366. if (_scancode_to_keycode[i].keysym == p_keycode) {
  367. return _scancode_to_keycode[i].keycode;
  368. }
  369. }
  370. return 0;
  371. }
  372. Key KeyMappingWindows::get_scansym(unsigned int p_code, bool p_extended) {
  373. Key keycode = Key::UNKNOWN;
  374. for (int i = 0; _scancode_to_keycode[i].keysym != Key::UNKNOWN; i++) {
  375. if (_scancode_to_keycode[i].keycode == p_code) {
  376. keycode = _scancode_to_keycode[i].keysym;
  377. break;
  378. }
  379. }
  380. if (p_extended) {
  381. switch (keycode) {
  382. case Key::ENTER: {
  383. keycode = Key::KP_ENTER;
  384. } break;
  385. case Key::SLASH: {
  386. keycode = Key::KP_DIVIDE;
  387. } break;
  388. case Key::CAPSLOCK: {
  389. keycode = Key::KP_ADD;
  390. } break;
  391. default:
  392. break;
  393. }
  394. } else {
  395. switch (keycode) {
  396. case Key::NUMLOCK: {
  397. keycode = Key::PAUSE;
  398. } break;
  399. case Key::HOME: {
  400. keycode = Key::KP_7;
  401. } break;
  402. case Key::UP: {
  403. keycode = Key::KP_8;
  404. } break;
  405. case Key::PAGEUP: {
  406. keycode = Key::KP_9;
  407. } break;
  408. case Key::LEFT: {
  409. keycode = Key::KP_4;
  410. } break;
  411. case Key::RIGHT: {
  412. keycode = Key::KP_6;
  413. } break;
  414. case Key::END: {
  415. keycode = Key::KP_1;
  416. } break;
  417. case Key::DOWN: {
  418. keycode = Key::KP_2;
  419. } break;
  420. case Key::PAGEDOWN: {
  421. keycode = Key::KP_3;
  422. } break;
  423. case Key::INSERT: {
  424. keycode = Key::KP_0;
  425. } break;
  426. case Key::KEY_DELETE: {
  427. keycode = Key::KP_PERIOD;
  428. } break;
  429. case Key::PRINT: {
  430. keycode = Key::KP_MULTIPLY;
  431. } break;
  432. default:
  433. break;
  434. }
  435. }
  436. return keycode;
  437. }
  438. bool KeyMappingWindows::is_extended_key(unsigned int p_code) {
  439. return p_code == VK_INSERT ||
  440. p_code == VK_DELETE ||
  441. p_code == VK_HOME ||
  442. p_code == VK_END ||
  443. p_code == VK_PRIOR ||
  444. p_code == VK_NEXT ||
  445. p_code == VK_LEFT ||
  446. p_code == VK_UP ||
  447. p_code == VK_RIGHT ||
  448. p_code == VK_DOWN;
  449. }