Add iOS key map generation, make macOS var naming consistent with repo (#83146)
This adds iOS key map generation that uses std::maps. It uses std::maps because on iOS if we use NSDictionaries, then when XCode loads the dylib, the initialization of those status NSDictionaries hasn't yet occurred, and it crashes the app. std::maps have a well-defined static behavior, and are correctly initialized. I also made the naming of variables, fields, etc. consistent for macOS. We variously had macosFoo, macOSFoo, and macOsFoo. I eliminated macOsFoo and macosFoo, since the rest of the repo uses macOSFoo for lowerCamelCase names (with only a few exceptions). I used iOSFoo for iOS.
This commit is contained in:
@@ -5,11 +5,15 @@
|
||||
#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.
|
||||
// This file is generated by
|
||||
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
|
||||
// be edited directly.
|
||||
//
|
||||
// Edit the template dev/tools/gen_keycodes/data/fuchsia_keyboard_map_cc.tmpl instead.
|
||||
// See dev/tools/gen_keycodes/README.md for more information.
|
||||
// Edit the template
|
||||
// flutter/flutter:dev/tools/gen_keycodes/data/fuchsia_keyboard_map_cc.tmpl
|
||||
// instead.
|
||||
//
|
||||
// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.
|
||||
|
||||
/// Maps Fuchsia-specific IDs to the matching LogicalKeyboardKey.
|
||||
const std::map<int, int> g_fuchsia_to_logical_key = {
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
#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.
|
||||
// This file is generated by
|
||||
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
|
||||
// be edited directly.
|
||||
//
|
||||
// Edit the template dev/tools/gen_keycodes/data/glfw_keyboard_map_cc.tmpl instead.
|
||||
// See dev/tools/gen_keycodes/README.md for more information.
|
||||
// Edit the template
|
||||
// flutter/flutter:dev/tools/gen_keycodes/data/glfw_keyboard_map_cc.tmpl
|
||||
// instead.
|
||||
//
|
||||
// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.
|
||||
|
||||
/// Maps GLFW-specific key codes to the matching [LogicalKeyboardKey].
|
||||
const std::map<int, int> g_glfw_to_logical_key = {
|
||||
|
||||
39
dev/tools/gen_keycodes/data/ios_key_code_map_cc.tmpl
Normal file
39
dev/tools/gen_keycodes/data/ios_key_code_map_cc.tmpl
Normal file
@@ -0,0 +1,39 @@
|
||||
// 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>
|
||||
#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@@@
|
||||
@@ -5,13 +5,16 @@
|
||||
#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.
|
||||
// This file is generated by
|
||||
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
|
||||
// be edited directly.
|
||||
//
|
||||
// Edit the template dev/tools/gen_keycodes/data/ios_keyboard_map_cc.tmpl instead.
|
||||
// See dev/tools/gen_keycodes/README.md for more information.
|
||||
// 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 macOS-specific key code values representing [PhysicalKeyboardKey].
|
||||
// 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 = {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,11 +7,15 @@
|
||||
#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.
|
||||
// This file is generated by
|
||||
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
|
||||
// be edited directly.
|
||||
//
|
||||
// Edit the template dev/tools/gen_keycodes/data/keyboard_map_macos_cc.tmpl instead.
|
||||
// See dev/tools/gen_keycodes/README.md for more information.
|
||||
// Edit the template
|
||||
// flutter/flutter:dev/tools/gen_keycodes/data/keyboard_map_macos_cc.tmpl
|
||||
// instead.
|
||||
//
|
||||
// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.
|
||||
|
||||
@@@MASK_CONSTANTS@@@
|
||||
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
|
||||
// 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
|
||||
// flutter/flutter:dev/tools/gen_keycodes/bin/gen_keycodes.dart and should not
|
||||
// be edited directly.
|
||||
//
|
||||
// Edit the template dev/tools/gen_keycodes/data/windows_flutter_key_map_cc.tmpl
|
||||
// instead. See dev/tools/gen_keycodes/README.md for more information.
|
||||
// Edit the template
|
||||
// flutter/flutter:dev/tools/gen_keycodes/data/windows_flutter_key_map_cc.tmpl
|
||||
// instead.
|
||||
//
|
||||
// See flutter/flutter:dev/tools/gen_keycodes/README.md for more information.
|
||||
|
||||
namespace flutter {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user