Flutter Engine
The Flutter Engine
KeyCodeMap.g.mm
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <map>
6#include <set>
7#include "flutter/shell/platform/darwin/ios/framework/Source/KeyCodeMap_Internal.h"
8
9// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
10// This file is generated by
11// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
12// be edited directly.
13//
14// Edit the template
15// flutter/flutter:dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl instead.
16//
17// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.
18
19/**
20 * Mask for the 32-bit value portion of the key code.
21 */
22const uint64_t kValueMask = 0x000ffffffff;
23
24/**
25 * The plane value for keys which have a Unicode representation.
26 */
27const uint64_t kUnicodePlane = 0x00000000000;
28
29/**
30 * The plane value for the private keys defined by the iOS embedding.
31 */
32const uint64_t kIosPlane = 0x01300000000;
33
34// Maps iOS-specific key code values representing PhysicalKeyboardKey.
35//
36// iOS doesn't provide a scan code, but a virtual keycode to represent a physical key.
37const std::map<uint32_t, uint64_t> keyCodeToPhysicalKey = {
38 {0x00000000, 0x00070000}, // usbReserved
39 {0x00000001, 0x00070001}, // usbErrorRollOver
40 {0x00000002, 0x00070002}, // usbPostFail
41 {0x00000003, 0x00070003}, // usbErrorUndefined
42 {0x00000004, 0x00070004}, // keyA
43 {0x00000005, 0x00070005}, // keyB
44 {0x00000006, 0x00070006}, // keyC
45 {0x00000007, 0x00070007}, // keyD
46 {0x00000008, 0x00070008}, // keyE
47 {0x00000009, 0x00070009}, // keyF
48 {0x0000000a, 0x0007000a}, // keyG
49 {0x0000000b, 0x0007000b}, // keyH
50 {0x0000000c, 0x0007000c}, // keyI
51 {0x0000000d, 0x0007000d}, // keyJ
52 {0x0000000e, 0x0007000e}, // keyK
53 {0x0000000f, 0x0007000f}, // keyL
54 {0x00000010, 0x00070010}, // keyM
55 {0x00000011, 0x00070011}, // keyN
56 {0x00000012, 0x00070012}, // keyO
57 {0x00000013, 0x00070013}, // keyP
58 {0x00000014, 0x00070014}, // keyQ
59 {0x00000015, 0x00070015}, // keyR
60 {0x00000016, 0x00070016}, // keyS
61 {0x00000017, 0x00070017}, // keyT
62 {0x00000018, 0x00070018}, // keyU
63 {0x00000019, 0x00070019}, // keyV
64 {0x0000001a, 0x0007001a}, // keyW
65 {0x0000001b, 0x0007001b}, // keyX
66 {0x0000001c, 0x0007001c}, // keyY
67 {0x0000001d, 0x0007001d}, // keyZ
68 {0x0000001e, 0x0007001e}, // digit1
69 {0x0000001f, 0x0007001f}, // digit2
70 {0x00000020, 0x00070020}, // digit3
71 {0x00000021, 0x00070021}, // digit4
72 {0x00000022, 0x00070022}, // digit5
73 {0x00000023, 0x00070023}, // digit6
74 {0x00000024, 0x00070024}, // digit7
75 {0x00000025, 0x00070025}, // digit8
76 {0x00000026, 0x00070026}, // digit9
77 {0x00000027, 0x00070027}, // digit0
78 {0x00000028, 0x00070028}, // enter
79 {0x00000029, 0x00070029}, // escape
80 {0x0000002a, 0x0007002a}, // backspace
81 {0x0000002b, 0x0007002b}, // tab
82 {0x0000002c, 0x0007002c}, // space
83 {0x0000002d, 0x0007002d}, // minus
84 {0x0000002e, 0x0007002e}, // equal
85 {0x0000002f, 0x0007002f}, // bracketLeft
86 {0x00000030, 0x00070030}, // bracketRight
87 {0x00000031, 0x00070031}, // backslash
88 {0x00000033, 0x00070033}, // semicolon
89 {0x00000034, 0x00070034}, // quote
90 {0x00000035, 0x00070035}, // backquote
91 {0x00000036, 0x00070036}, // comma
92 {0x00000037, 0x00070037}, // period
93 {0x00000038, 0x00070038}, // slash
94 {0x00000039, 0x00070039}, // capsLock
95 {0x0000003a, 0x0007003a}, // f1
96 {0x0000003b, 0x0007003b}, // f2
97 {0x0000003c, 0x0007003c}, // f3
98 {0x0000003d, 0x0007003d}, // f4
99 {0x0000003e, 0x0007003e}, // f5
100 {0x0000003f, 0x0007003f}, // f6
101 {0x00000040, 0x00070040}, // f7
102 {0x00000041, 0x00070041}, // f8
103 {0x00000042, 0x00070042}, // f9
104 {0x00000043, 0x00070043}, // f10
105 {0x00000044, 0x00070044}, // f11
106 {0x00000045, 0x00070045}, // f12
107 {0x00000046, 0x00070046}, // printScreen
108 {0x00000047, 0x00070047}, // scrollLock
109 {0x00000048, 0x00070048}, // pause
110 {0x00000049, 0x00070049}, // insert
111 {0x0000004a, 0x0007004a}, // home
112 {0x0000004b, 0x0007004b}, // pageUp
113 {0x0000004c, 0x0007004c}, // delete
114 {0x0000004d, 0x0007004d}, // end
115 {0x0000004e, 0x0007004e}, // pageDown
116 {0x0000004f, 0x0007004f}, // arrowRight
117 {0x00000050, 0x00070050}, // arrowLeft
118 {0x00000051, 0x00070051}, // arrowDown
119 {0x00000052, 0x00070052}, // arrowUp
120 {0x00000053, 0x00070053}, // numLock
121 {0x00000054, 0x00070054}, // numpadDivide
122 {0x00000055, 0x00070055}, // numpadMultiply
123 {0x00000056, 0x00070056}, // numpadSubtract
124 {0x00000057, 0x00070057}, // numpadAdd
125 {0x00000058, 0x00070058}, // numpadEnter
126 {0x00000059, 0x00070059}, // numpad1
127 {0x0000005a, 0x0007005a}, // numpad2
128 {0x0000005b, 0x0007005b}, // numpad3
129 {0x0000005c, 0x0007005c}, // numpad4
130 {0x0000005d, 0x0007005d}, // numpad5
131 {0x0000005e, 0x0007005e}, // numpad6
132 {0x0000005f, 0x0007005f}, // numpad7
133 {0x00000060, 0x00070060}, // numpad8
134 {0x00000061, 0x00070061}, // numpad9
135 {0x00000062, 0x00070062}, // numpad0
136 {0x00000063, 0x00070063}, // numpadDecimal
137 {0x00000064, 0x00070064}, // intlBackslash
138 {0x00000065, 0x00070065}, // contextMenu
139 {0x00000066, 0x00070066}, // power
140 {0x00000067, 0x00070067}, // numpadEqual
141 {0x00000068, 0x00070068}, // f13
142 {0x00000069, 0x00070069}, // f14
143 {0x0000006a, 0x0007006a}, // f15
144 {0x0000006b, 0x0007006b}, // f16
145 {0x0000006c, 0x0007006c}, // f17
146 {0x0000006d, 0x0007006d}, // f18
147 {0x0000006e, 0x0007006e}, // f19
148 {0x0000006f, 0x0007006f}, // f20
149 {0x00000070, 0x00070070}, // f21
150 {0x00000071, 0x00070071}, // f22
151 {0x00000072, 0x00070072}, // f23
152 {0x00000073, 0x00070073}, // f24
153 {0x00000074, 0x00070074}, // open
154 {0x00000075, 0x00070075}, // help
155 {0x00000077, 0x00070077}, // select
156 {0x00000079, 0x00070079}, // again
157 {0x0000007a, 0x0007007a}, // undo
158 {0x0000007b, 0x0007007b}, // cut
159 {0x0000007c, 0x0007007c}, // copy
160 {0x0000007d, 0x0007007d}, // paste
161 {0x0000007e, 0x0007007e}, // find
162 {0x0000007f, 0x0007007f}, // audioVolumeMute
163 {0x00000080, 0x00070080}, // audioVolumeUp
164 {0x00000081, 0x00070081}, // audioVolumeDown
165 {0x00000085, 0x00070085}, // numpadComma
166 {0x00000087, 0x00070087}, // intlRo
167 {0x00000088, 0x00070088}, // kanaMode
168 {0x00000089, 0x00070089}, // intlYen
169 {0x0000008a, 0x0007008a}, // convert
170 {0x0000008b, 0x0007008b}, // nonConvert
171 {0x00000090, 0x00070090}, // lang1
172 {0x00000091, 0x00070091}, // lang2
173 {0x00000092, 0x00070092}, // lang3
174 {0x00000093, 0x00070093}, // lang4
175 {0x00000094, 0x00070094}, // lang5
176 {0x0000009b, 0x0007009b}, // abort
177 {0x000000a3, 0x000700a3}, // props
178 {0x000000b6, 0x000700b6}, // numpadParenLeft
179 {0x000000b7, 0x000700b7}, // numpadParenRight
180 {0x000000bb, 0x000700bb}, // numpadBackspace
181 {0x000000d0, 0x000700d0}, // numpadMemoryStore
182 {0x000000d1, 0x000700d1}, // numpadMemoryRecall
183 {0x000000d2, 0x000700d2}, // numpadMemoryClear
184 {0x000000d3, 0x000700d3}, // numpadMemoryAdd
185 {0x000000d4, 0x000700d4}, // numpadMemorySubtract
186 {0x000000d7, 0x000700d7}, // numpadSignChange
187 {0x000000d8, 0x000700d8}, // numpadClear
188 {0x000000d9, 0x000700d9}, // numpadClearEntry
189 {0x000000e0, 0x000700e0}, // controlLeft
190 {0x000000e1, 0x000700e1}, // shiftLeft
191 {0x000000e2, 0x000700e2}, // altLeft
192 {0x000000e3, 0x000700e3}, // metaLeft
193 {0x000000e4, 0x000700e4}, // controlRight
194 {0x000000e5, 0x000700e5}, // shiftRight
195 {0x000000e6, 0x000700e6}, // altRight
196 {0x000000e7, 0x000700e7}, // metaRight
197};
198
199// Maps iOS-specific virtual key code values to logical keys representing
200// LogicalKeyboardKey
201const std::map<uint32_t, uint64_t> keyCodeToLogicalKey = {
202 {0x00000028, 0x0010000000d}, // Enter
203 {0x00000029, 0x0010000001b}, // Escape
204 {0x0000002a, 0x00100000008}, // Backspace
205 {0x0000002b, 0x00100000009}, // Tab
206 {0x00000039, 0x00100000104}, // CapsLock
207 {0x0000003a, 0x00100000801}, // F1
208 {0x0000003b, 0x00100000802}, // F2
209 {0x0000003c, 0x00100000803}, // F3
210 {0x0000003d, 0x00100000804}, // F4
211 {0x0000003e, 0x00100000805}, // F5
212 {0x0000003f, 0x00100000806}, // F6
213 {0x00000040, 0x00100000807}, // F7
214 {0x00000041, 0x00100000808}, // F8
215 {0x00000042, 0x00100000809}, // F9
216 {0x00000043, 0x0010000080a}, // F10
217 {0x00000044, 0x0010000080b}, // F11
218 {0x00000045, 0x0010000080c}, // F12
219 {0x00000049, 0x00100000407}, // Insert
220 {0x0000004a, 0x00100000306}, // Home
221 {0x0000004b, 0x00100000308}, // PageUp
222 {0x0000004c, 0x0010000007f}, // Delete
223 {0x0000004d, 0x00100000305}, // End
224 {0x0000004e, 0x00100000307}, // PageDown
225 {0x0000004f, 0x00100000303}, // ArrowRight
226 {0x00000050, 0x00100000302}, // ArrowLeft
227 {0x00000051, 0x00100000301}, // ArrowDown
228 {0x00000052, 0x00100000304}, // ArrowUp
229 {0x00000053, 0x0010000010a}, // NumLock
230 {0x00000054, 0x0020000022f}, // NumpadDivide
231 {0x00000055, 0x0020000022a}, // NumpadMultiply
232 {0x00000056, 0x0020000022d}, // NumpadSubtract
233 {0x00000057, 0x0020000022b}, // NumpadAdd
234 {0x00000058, 0x0020000020d}, // NumpadEnter
235 {0x00000059, 0x00200000231}, // Numpad1
236 {0x0000005a, 0x00200000232}, // Numpad2
237 {0x0000005b, 0x00200000233}, // Numpad3
238 {0x0000005c, 0x00200000234}, // Numpad4
239 {0x0000005d, 0x00200000235}, // Numpad5
240 {0x0000005e, 0x00200000236}, // Numpad6
241 {0x0000005f, 0x00200000237}, // Numpad7
242 {0x00000060, 0x00200000238}, // Numpad8
243 {0x00000061, 0x00200000239}, // Numpad9
244 {0x00000062, 0x00200000230}, // Numpad0
245 {0x00000063, 0x0020000022e}, // NumpadDecimal
246 {0x00000065, 0x00100000505}, // ContextMenu
247 {0x00000067, 0x0020000023d}, // NumpadEqual
248 {0x00000068, 0x0010000080d}, // F13
249 {0x00000069, 0x0010000080e}, // F14
250 {0x0000006a, 0x0010000080f}, // F15
251 {0x0000006b, 0x00100000810}, // F16
252 {0x0000006c, 0x00100000811}, // F17
253 {0x0000006d, 0x00100000812}, // F18
254 {0x0000006e, 0x00100000813}, // F19
255 {0x0000006f, 0x00100000814}, // F20
256 {0x0000007f, 0x00100000a11}, // AudioVolumeMute
257 {0x00000080, 0x00100000a10}, // AudioVolumeUp
258 {0x00000081, 0x00100000a0f}, // AudioVolumeDown
259 {0x00000085, 0x0020000022c}, // NumpadComma
260 {0x00000087, 0x00200000021}, // IntlRo
261 {0x00000089, 0x00200000022}, // IntlYen
262 {0x00000090, 0x00200000010}, // Lang1
263 {0x00000091, 0x00200000011}, // Lang2
264 {0x00000092, 0x00200000012}, // Lang3
265 {0x00000093, 0x00200000013}, // Lang4
266 {0x00000094, 0x00200000014}, // Lang5
267 {0x000000e0, 0x00200000100}, // ControlLeft
268 {0x000000e1, 0x00200000102}, // ShiftLeft
269 {0x000000e2, 0x00200000104}, // AltLeft
270 {0x000000e3, 0x00200000106}, // MetaLeft
271 {0x000000e4, 0x00200000101}, // ControlRight
272 {0x000000e5, 0x00200000103}, // ShiftRight
273 {0x000000e6, 0x00200000105}, // AltRight
274 {0x000000e7, 0x00200000107}, // MetaRight
275};
276
277// Maps iOS-specific virtual key codes to an equivalent modifier flag enum
278// value.
279const std::map<uint32_t, ModifierFlag> keyCodeToModifierFlag = {
280 {0x000000e1, kModifierFlagShiftLeft}, // ShiftLeft
281 {0x000000e5, kModifierFlagShiftRight}, // ShiftRight
282 {0x000000e0, kModifierFlagControlLeft}, // ControlLeft
283 {0x000000e4, kModifierFlagControlRight}, // ControlRight
284 {0x000000e2, kModifierFlagAltLeft}, // AltLeft
285 {0x000000e6, kModifierFlagAltRight}, // AltRight
286 {0x000000e3, kModifierFlagMetaLeft}, // MetaLeft
287 {0x000000e7, kModifierFlagMetaRight}, // MetaRight
288};
289
290// Maps modifier flag enum values to an iOS-specific virtual key code.
291const std::map<ModifierFlag, uint32_t> modifierFlagToKeyCode = {
292 {kModifierFlagShiftLeft, 0x000000e1}, // ShiftLeft
293 {kModifierFlagShiftRight, 0x000000e5}, // ShiftRight
294 {kModifierFlagControlLeft, 0x000000e0}, // ControlLeft
295 {kModifierFlagControlRight, 0x000000e4}, // ControlRight
296 {kModifierFlagAltLeft, 0x000000e2}, // AltLeft
297 {kModifierFlagAltRight, 0x000000e6}, // AltRight
298 {kModifierFlagMetaLeft, 0x000000e3}, // MetaLeft
299 {kModifierFlagMetaRight, 0x000000e7}, // MetaRight
300};
301
302// A set of virtual key codes mapping to function keys, so that may be
303// identified as such.
304const std::set<uint32_t> functionKeyCodes = {
305 0x0000003a, // f1
306 0x0000003b, // f2
307 0x0000003c, // f3
308 0x0000003d, // f4
309 0x0000003e, // f5
310 0x0000003f, // f6
311 0x00000040, // f7
312 0x00000041, // f8
313 0x00000042, // f9
314 0x00000043, // f10
315 0x00000044, // f11
316 0x00000045, // f12
317 0x00000068, // f13
318 0x00000069, // f14
319 0x0000006a, // f15
320 0x0000006b, // f16
321 0x0000006c, // f17
322 0x0000006d, // f18
323 0x0000006e, // f19
324 0x0000006f, // f20
325 0x00000070, // f21
326 0x00000071, // f22
327 0x00000072, // f23
328 0x00000073, // f24
329};
330
331API_AVAILABLE(ios(13.4))
332NSDictionary<NSString*, NSNumber*>* specialKeyMapping = @{
333 @"UIKeyInputEscape" : @(0x10000001b),
334 @"UIKeyInputF1" : @(0x100000801),
335 @"UIKeyInputF2" : @(0x100000802),
336 @"UIKeyInputF3" : @(0x100000803),
337 @"UIKeyInputF4" : @(0x100000804),
338 @"UIKeyInputF5" : @(0x100000805),
339 @"UIKeyInputF6" : @(0x100000806),
340 @"UIKeyInputF7" : @(0x100000807),
341 @"UIKeyInputF8" : @(0x100000808),
342 @"UIKeyInputF9" : @(0x100000809),
343 @"UIKeyInputF10" : @(0x10000080a),
344 @"UIKeyInputF11" : @(0x10000080b),
345 @"UIKeyInputF12" : @(0x10000080c),
346 @"UIKeyInputUpArrow" : @(0x100000304),
347 @"UIKeyInputDownArrow" : @(0x100000301),
348 @"UIKeyInputLeftArrow" : @(0x100000302),
349 @"UIKeyInputRightArrow" : @(0x100000303),
350 @"UIKeyInputHome" : @(0x100000306),
351 @"UIKeyInputEnd" : @(0x10000000d),
352 @"UIKeyInputPageUp" : @(0x100000308),
353 @"UIKeyInputPageDown" : @(0x100000307),
354};
355
356const uint64_t kCapsLockPhysicalKey = 0x00070039;
357const uint64_t kCapsLockLogicalKey = 0x100000104;
const std::map< uint32_t, ModifierFlag > keyCodeToModifierFlag
const std::set< uint32_t > functionKeyCodes
const uint64_t kValueMask
Definition: KeyCodeMap.g.mm:22
const std::map< uint32_t, uint64_t > keyCodeToPhysicalKey
Definition: KeyCodeMap.g.mm:37
NSDictionary< NSString *, NSNumber * > * specialKeyMapping
const uint64_t kUnicodePlane
Definition: KeyCodeMap.g.mm:27
const std::map< uint32_t, uint64_t > keyCodeToLogicalKey
const uint64_t kCapsLockLogicalKey
const uint64_t kCapsLockPhysicalKey
const std::map< ModifierFlag, uint32_t > modifierFlagToKeyCode
const uint64_t kIosPlane
Definition: KeyCodeMap.g.mm:32
@ kModifierFlagControlLeft
@ kModifierFlagAltRight
@ kModifierFlagControlRight
@ kModifierFlagMetaRight
@ kModifierFlagShiftLeft
@ kModifierFlagShiftRight
@ kModifierFlagAltLeft
@ kModifierFlagMetaLeft
SK_API sk_sp< SkSurface > ios(9.0)
API_AVAILABLE(ios(14.0), macos(11.0)) static NSString *MTLCommandEncoderErrorStateToString(MTLCommandEncoderErrorState state)