Flutter Engine
The Flutter Engine
Variables
KeyCodeMap.g.mm File Reference
#include <map>
#include <set>
#include "flutter/shell/platform/darwin/ios/framework/Source/KeyCodeMap_Internal.h"

Go to the source code of this file.

Variables

const uint64_t kValueMask = 0x000ffffffff
 
const uint64_t kUnicodePlane = 0x00000000000
 
const uint64_t kIosPlane = 0x01300000000
 
const std::map< uint32_t, uint64_t > keyCodeToPhysicalKey
 
const std::map< uint32_t, uint64_t > keyCodeToLogicalKey
 
const std::map< uint32_t, ModifierFlagkeyCodeToModifierFlag
 
const std::map< ModifierFlag, uint32_t > modifierFlagToKeyCode
 
const std::set< uint32_t > functionKeyCodes
 
NSDictionary< NSString *, NSNumber * > * specialKeyMapping
 
const uint64_t kCapsLockPhysicalKey = 0x00070039
 
const uint64_t kCapsLockLogicalKey = 0x100000104
 

Variable Documentation

◆ functionKeyCodes

const std::set<uint32_t> functionKeyCodes
Initial value:
= {
0x0000003a,
0x0000003b,
0x0000003c,
0x0000003d,
0x0000003e,
0x0000003f,
0x00000040,
0x00000041,
0x00000042,
0x00000043,
0x00000044,
0x00000045,
0x00000068,
0x00000069,
0x0000006a,
0x0000006b,
0x0000006c,
0x0000006d,
0x0000006e,
0x0000006f,
0x00000070,
0x00000071,
0x00000072,
0x00000073,
}

A set of keycodes corresponding to function keys.

Definition at line 304 of file KeyCodeMap.g.mm.

◆ kCapsLockLogicalKey

const uint64_t kCapsLockLogicalKey = 0x100000104

The logical key for CapsLock, which needs special handling.

Definition at line 357 of file KeyCodeMap.g.mm.

◆ kCapsLockPhysicalKey

const uint64_t kCapsLockPhysicalKey = 0x00070039

The physical key for CapsLock, which needs special handling.

Definition at line 356 of file KeyCodeMap.g.mm.

◆ keyCodeToLogicalKey

const std::map<uint32_t, uint64_t> keyCodeToLogicalKey

A map from iOS key codes to Flutter's logical key values.

This is used to derive logical keys that can't or shouldn't be derived from |charactersIgnoringModifiers|.

Definition at line 201 of file KeyCodeMap.g.mm.

◆ keyCodeToModifierFlag

const std::map<uint32_t, ModifierFlag> keyCodeToModifierFlag
Initial value:
= {
{0x000000e1, kModifierFlagShiftLeft},
{0x000000e5, kModifierFlagShiftRight},
{0x000000e0, kModifierFlagControlLeft},
{0x000000e4, kModifierFlagControlRight},
{0x000000e2, kModifierFlagAltLeft},
{0x000000e6, kModifierFlagAltRight},
{0x000000e3, kModifierFlagMetaLeft},
{0x000000e7, kModifierFlagMetaRight},
}
@ kModifierFlagControlLeft
@ kModifierFlagAltRight
@ kModifierFlagControlRight
@ kModifierFlagMetaRight
@ kModifierFlagShiftLeft
@ kModifierFlagShiftRight
@ kModifierFlagAltLeft
@ kModifierFlagMetaLeft

Map |UIKey.keyCode| to the matching sided modifier in UIEventModifierFlags.

Definition at line 279 of file KeyCodeMap.g.mm.

◆ keyCodeToPhysicalKey

const std::map<uint32_t, uint64_t> keyCodeToPhysicalKey

Maps iOS-specific key code values representing |PhysicalKeyboardKey|.

MacOS doesn't provide a scan code, but a virtual keycode to represent a physical key.

Definition at line 37 of file KeyCodeMap.g.mm.

◆ kIosPlane

const uint64_t kIosPlane = 0x01300000000

The plane value for the private keys defined by the iOS embedding.

Definition at line 32 of file KeyCodeMap.g.mm.

◆ kUnicodePlane

const uint64_t kUnicodePlane = 0x00000000000

The plane value for keys which have a Unicode representation.

Definition at line 27 of file KeyCodeMap.g.mm.

◆ kValueMask

const uint64_t kValueMask = 0x000ffffffff

Mask for the 32-bit value portion of the key code.

Definition at line 22 of file KeyCodeMap.g.mm.

◆ modifierFlagToKeyCode

const std::map<ModifierFlag, uint32_t> modifierFlagToKeyCode
Initial value:
= {
{kModifierFlagShiftLeft, 0x000000e1},
{kModifierFlagShiftRight, 0x000000e5},
{kModifierFlagControlLeft, 0x000000e0},
{kModifierFlagControlRight, 0x000000e4},
{kModifierFlagAltLeft, 0x000000e2},
{kModifierFlagAltRight, 0x000000e6},
{kModifierFlagMetaLeft, 0x000000e3},
{kModifierFlagMetaRight, 0x000000e7},
}

Map a bit of bitmask of sided modifiers in UIEventModifierFlags to their corresponding |UIKey.keyCode|.

Definition at line 291 of file KeyCodeMap.g.mm.

◆ specialKeyMapping

NSDictionary<NSString*, NSNumber*>* specialKeyMapping
Initial value:
= @{
@"UIKeyInputEscape" : @(0x10000001b),
@"UIKeyInputF1" : @(0x100000801),
@"UIKeyInputF2" : @(0x100000802),
@"UIKeyInputF3" : @(0x100000803),
@"UIKeyInputF4" : @(0x100000804),
@"UIKeyInputF5" : @(0x100000805),
@"UIKeyInputF6" : @(0x100000806),
@"UIKeyInputF7" : @(0x100000807),
@"UIKeyInputF8" : @(0x100000808),
@"UIKeyInputF9" : @(0x100000809),
@"UIKeyInputF10" : @(0x10000080a),
@"UIKeyInputF11" : @(0x10000080b),
@"UIKeyInputF12" : @(0x10000080c),
@"UIKeyInputUpArrow" : @(0x100000304),
@"UIKeyInputDownArrow" : @(0x100000301),
@"UIKeyInputLeftArrow" : @(0x100000302),
@"UIKeyInputRightArrow" : @(0x100000303),
@"UIKeyInputHome" : @(0x100000306),
@"UIKeyInputEnd" : @(0x10000000d),
@"UIKeyInputPageUp" : @(0x100000308),
@"UIKeyInputPageDown" : @(0x100000307),
}

Maps iOS specific string values of nonvisible keys to logical keys.

TODO(dkwingsmt): Change this getter function to a global variable. I tried to do this but the unit test on CI threw errors saying "message sent to deallocated instance" on the NSDictionary.

See: https://developer.apple.com/documentation/uikit/uikeycommand/input_strings_for_special_keys?language=objc

Definition at line 332 of file KeyCodeMap.g.mm.