Modify key info generation for new iOS key code. (#83439)
The (new, not yet used) code gen for iOS was setting up a std::map from key codes to logical and physical key codes, but it was using uint32_t, which isn't big enough to hold the Flutter key codes. Also, iOS needs to be able to filter out function keys, so I added a function key set.
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
| File name | Explanation |
|
||||
| ---- | ---- |
|
||||
| [`ios_logical_to_physical.json`](ios_logical_to_physical.json) | Maps a logical key name to the names of its corresponding physical keys. This is used to derive logical keys (from `keyCode`) that can't or shouldn't be derived from `characterIgnoringModifiers`. |
|
||||
| [`ios_keyboard_map_cc.tmpl`](ios_keyboard_map_cc.tmpl) | The template for `keyboard_map.cc`. (Unused for now.) |
|
||||
| [`ios_key_code_map_mm.tmpl`](ios_key_code_map_mm.tmpl) | The template for `KeyCodeMap.mm`.|
|
||||
|
||||
### Web
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
| File name | Explanation |
|
||||
| ---- | ---- |
|
||||
| [`macos_key_code_map_cc.tmpl`](macos_key_code_map_cc.tmpl) | The template for `KeyCodeMap.cc`. |
|
||||
| [`macos_key_code_map_cc.tmpl`](macos_key_code_map_cc.tmpl) | The template for `KeyCodeMap.mm`. |
|
||||
| [`macos_logical_to_physical.json`](macos_logical_to_physical.json) | Maps a logical key name to the names of its corresponding physical keys. This is used to derive logical keys (from `keyCode`) that can't or shouldn't be derived from `characterIgnoringModifiers`. |
|
||||
|
||||
### Fuchsia
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <map>
|
||||
#include "./KeyCodeMap_internal.h"
|
||||
|
||||
// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
|
||||
// This file is generated by
|
||||
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
|
||||
// be edited directly.
|
||||
//
|
||||
// Edit the template
|
||||
// flutter/flutter:dev/tools/gen_keycodes/data/ios_key_code_map_cc.tmpl instead.
|
||||
//
|
||||
// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.
|
||||
|
||||
@@@MASK_CONSTANTS@@@
|
||||
|
||||
// Maps iOS-specific key code values representing [PhysicalKeyboardKey].
|
||||
//
|
||||
// iOS doesn't provide a scan code, but a virtual keycode to represent a physical key.
|
||||
const std::map<uint32_t, uint32_t> keyCodeToPhysicalKey = {
|
||||
@@@IOS_SCAN_CODE_MAP@@@
|
||||
};
|
||||
|
||||
const std::map<uint32_t, uint32_t> keyCodeToLogicalKey = {
|
||||
@@@IOS_KEYCODE_LOGICAL_MAP@@@
|
||||
};
|
||||
|
||||
const std::map<uint32_t, uint32_t> keyCodeToModifierFlag = {
|
||||
@@@KEYCODE_TO_MODIFIER_FLAG_MAP@@@
|
||||
};
|
||||
|
||||
const std::map<uint32_t, uint32_t> modifierFlagToKeyCode = {
|
||||
@@@MODIFIER_FLAG_TO_KEYCODE_MAP@@@
|
||||
};
|
||||
|
||||
@@@SPECIAL_KEY_CONSTANTS@@@
|
||||
51
dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl
Normal file
51
dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include "flutter/shell/platform/darwin/ios/framework/Source/KeyCodeMap_Internal.h"
|
||||
|
||||
// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
|
||||
// This file is generated by
|
||||
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
|
||||
// be edited directly.
|
||||
//
|
||||
// Edit the template
|
||||
// flutter/flutter:dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl instead.
|
||||
//
|
||||
// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.
|
||||
|
||||
@@@MASK_CONSTANTS@@@
|
||||
|
||||
// Maps iOS-specific key code values representing PhysicalKeyboardKey.
|
||||
//
|
||||
// iOS doesn't provide a scan code, but a virtual keycode to represent a physical key.
|
||||
const std::map<uint32_t, uint64_t> keyCodeToPhysicalKey = {
|
||||
@@@IOS_SCAN_CODE_MAP@@@
|
||||
};
|
||||
|
||||
// Maps iOS-specific virtual key code values to logical keys representing
|
||||
// LogicalKeyboardKey
|
||||
const std::map<uint32_t, uint64_t> keyCodeToLogicalKey = {
|
||||
@@@IOS_KEYCODE_LOGICAL_MAP@@@
|
||||
};
|
||||
|
||||
// Maps iOS-specific virtual key codes to an equivalent modifier flag enum
|
||||
// value.
|
||||
const std::map<uint32_t, ModifierFlag> keyCodeToModifierFlag = {
|
||||
@@@KEYCODE_TO_MODIFIER_FLAG_MAP@@@
|
||||
};
|
||||
|
||||
// Maps modifier flag enum values to an iOS-specific virtual key code.
|
||||
const std::map<ModifierFlag, uint32_t> modifierFlagToKeyCode = {
|
||||
@@@MODIFIER_FLAG_TO_KEYCODE_MAP@@@
|
||||
};
|
||||
|
||||
// A set of virtual key codes mapping to function keys, so that may be
|
||||
// identified as such.
|
||||
const std::set<uint32_t> functionKeyCodes = {
|
||||
@@@IOS_FUNCTION_KEY_SET@@@
|
||||
};
|
||||
|
||||
@@@SPECIAL_KEY_CONSTANTS@@@
|
||||
@@ -1,29 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <map>
|
||||
|
||||
// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
|
||||
// This file is generated by
|
||||
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
|
||||
// be edited directly.
|
||||
//
|
||||
// Edit the template
|
||||
// flutter/flutter:dev/tools/gen_keycodes/data/ios_keyboard_map_cc.tmpl instead.
|
||||
//
|
||||
// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.
|
||||
|
||||
// Maps iOS-specific key code values representing [PhysicalKeyboardKey].
|
||||
//
|
||||
// iOS doesn't provide a scan code, but a virtual keycode to represent a physical key.
|
||||
const std::map<int, int> g_ios_to_physical_key = {
|
||||
@@@IOS_SCAN_CODE_MAP@@@
|
||||
};
|
||||
|
||||
// A map of iOS key codes which have printable representations, but appear
|
||||
// on the number pad. Used to provide different key objects for keys like
|
||||
// KEY_EQUALS and NUMPAD_EQUALS.
|
||||
const std::map<int, int> g_ios_numpad_map = {
|
||||
@@@IOS_NUMPAD_MAP@@@
|
||||
};
|
||||
Reference in New Issue
Block a user