[gen_keycodes] Mark generated file names with infix .g.
(#106142)
This commit is contained in:
parent
f0200f0106
commit
9970481b7a
@ -5,8 +5,8 @@ the `LogicalKeyboardKey` and `PhysicalKeyboardKey` classes.
|
|||||||
|
|
||||||
It generates multiple files across Flutter. For framework, it generates
|
It generates multiple files across Flutter. For framework, it generates
|
||||||
|
|
||||||
* [`keyboard_key.dart`](../../../packages/flutter/lib/src/services/keyboard_key.dart), which contains the definition and list of logical keys and physical keys; and
|
* [`keyboard_key.g.dart`](../../../packages/flutter/lib/src/services/keyboard_key.g.dart), which contains the definition and list of logical keys and physical keys; and
|
||||||
* [`keyboard_maps.dart`](../../../packages/flutter/lib/src/services/keyboard_maps.dart), which contains platform-specific immutable maps used for the `RawKeyboard` API.
|
* [`keyboard_maps.g.dart`](../../../packages/flutter/lib/src/services/keyboard_maps.g.dart), which contains platform-specific immutable maps used for the `RawKeyboard` API.
|
||||||
|
|
||||||
For engine, it generates one key mapping file for each platform, as well as some
|
For engine, it generates one key mapping file for each platform, as well as some
|
||||||
files for testing purposes.
|
files for testing purposes.
|
||||||
@ -14,9 +14,9 @@ files for testing purposes.
|
|||||||
It draws information from various source bases, including online
|
It draws information from various source bases, including online
|
||||||
repositories, and manual mapping in the `data` subdirectory. It incorporates
|
repositories, and manual mapping in the `data` subdirectory. It incorporates
|
||||||
this information into a giant list of physical keys
|
this information into a giant list of physical keys
|
||||||
([`physical_key_data.json`](data/physical_key_data.json)),
|
([`physical_key_data.g.json`](data/physical_key_data.g.json)),
|
||||||
and another for logical keys
|
and another for logical keys
|
||||||
([`logical_key_data.json`](data/logical_key_data.json)).
|
([`logical_key_data.g.json`](data/logical_key_data.g.json)).
|
||||||
The two files are checked in, and can be used as the data source next time so that
|
The two files are checked in, and can be used as the data source next time so that
|
||||||
output files can be generated without the Internet.
|
output files can be generated without the Internet.
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ anew before generating the files. To do this, run:
|
|||||||
/PATH/TO/ROOT/bin/gen_keycodes --collect
|
/PATH/TO/ROOT/bin/gen_keycodes --collect
|
||||||
```
|
```
|
||||||
|
|
||||||
This will generate `physical_key_data.json` and `logical_key_data.json`. These
|
This will generate `physical_key_data.g.json` and `logical_key_data.g.json`. These
|
||||||
files should be checked in.
|
files should be checked in.
|
||||||
|
|
||||||
By default this tool assumes that the gclient directory for flutter/engine
|
By default this tool assumes that the gclient directory for flutter/engine
|
||||||
@ -121,7 +121,7 @@ The planes are planned as follows:
|
|||||||
platforms managed by Flutter will start to send the new value, making it a
|
platforms managed by Flutter will start to send the new value, making it a
|
||||||
breaking change. Therefore, when handling an unrecognized key on a platform
|
breaking change. Therefore, when handling an unrecognized key on a platform
|
||||||
managed by Flutter, it is recommended to file a new issue to add this value
|
managed by Flutter, it is recommended to file a new issue to add this value
|
||||||
to `keyboard_key.dart` instead of using the platform-plane value. However,
|
to `keyboard_key.g.dart` instead of using the platform-plane value. However,
|
||||||
for a custom platform (see below), since the platform author has full control
|
for a custom platform (see below), since the platform author has full control
|
||||||
over key mapping, such change will not cause breakage and it is recommended
|
over key mapping, such change will not cause breakage and it is recommended
|
||||||
to use the platform-plane value to avoid adding platform-exclusive values
|
to use the platform-plane value to avoid adding platform-exclusive values
|
||||||
|
@ -108,7 +108,7 @@ Future<void> main(List<String> rawArguments) async {
|
|||||||
);
|
);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'physical-data',
|
'physical-data',
|
||||||
defaultsTo: path.join(dataRoot, 'physical_key_data.json'),
|
defaultsTo: path.join(dataRoot, 'physical_key_data.g.json'),
|
||||||
help: 'The path to where the physical key data file should be written when '
|
help: 'The path to where the physical key data file should be written when '
|
||||||
'collected, and read from when generating output code. If --physical-data is '
|
'collected, and read from when generating output code. If --physical-data is '
|
||||||
'not specified, the output will be written to/read from the current '
|
'not specified, the output will be written to/read from the current '
|
||||||
@ -117,7 +117,7 @@ Future<void> main(List<String> rawArguments) async {
|
|||||||
);
|
);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'logical-data',
|
'logical-data',
|
||||||
defaultsTo: path.join(dataRoot, 'logical_key_data.json'),
|
defaultsTo: path.join(dataRoot, 'logical_key_data.g.json'),
|
||||||
help: 'The path to where the logical key data file should be written when '
|
help: 'The path to where the logical key data file should be written when '
|
||||||
'collected, and read from when generating output code. If --logical-data is '
|
'collected, and read from when generating output code. If --logical-data is '
|
||||||
'not specified, the output will be written to/read from the current '
|
'not specified, the output will be written to/read from the current '
|
||||||
@ -126,16 +126,16 @@ Future<void> main(List<String> rawArguments) async {
|
|||||||
);
|
);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'code',
|
'code',
|
||||||
defaultsTo: path.join(flutterRoot.path, 'packages', 'flutter', 'lib', 'src', 'services', 'keyboard_key.dart'),
|
defaultsTo: path.join(flutterRoot.path, 'packages', 'flutter', 'lib', 'src', 'services', 'keyboard_key.g.dart'),
|
||||||
help: 'The path to where the output "keyboard_key.dart" file should be '
|
help: 'The path to where the output "keyboard_key.g.dart" file should be '
|
||||||
'written. If --code is not specified, the output will be written to the '
|
'written. If --code is not specified, the output will be written to the '
|
||||||
'correct directory in the flutter tree. If the output directory does not '
|
'correct directory in the flutter tree. If the output directory does not '
|
||||||
'exist, it, and the path to it, will be created.',
|
'exist, it, and the path to it, will be created.',
|
||||||
);
|
);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'maps',
|
'maps',
|
||||||
defaultsTo: path.join(flutterRoot.path, 'packages', 'flutter', 'lib', 'src', 'services', 'keyboard_maps.dart'),
|
defaultsTo: path.join(flutterRoot.path, 'packages', 'flutter', 'lib', 'src', 'services', 'keyboard_maps.g.dart'),
|
||||||
help: 'The path to where the output "keyboard_maps.dart" file should be '
|
help: 'The path to where the output "keyboard_maps.g.dart" file should be '
|
||||||
'written. If --maps is not specified, the output will be written to the '
|
'written. If --maps is not specified, the output will be written to the '
|
||||||
'correct directory in the flutter tree. If the output directory does not '
|
'correct directory in the flutter tree. If the output directory does not '
|
||||||
'exist, it, and the path to it, will be created.',
|
'exist, it, and the path to it, will be created.',
|
||||||
@ -145,7 +145,7 @@ Future<void> main(List<String> rawArguments) async {
|
|||||||
negatable: false,
|
negatable: false,
|
||||||
help: 'If this flag is set, then collect and parse header files from '
|
help: 'If this flag is set, then collect and parse header files from '
|
||||||
'Chromium and Android instead of reading pre-parsed data from '
|
'Chromium and Android instead of reading pre-parsed data from '
|
||||||
'"physical_key_data.json" and "logical_key_data.json", and then '
|
'"physical_key_data.g.json" and "logical_key_data.g.json", and then '
|
||||||
'update these files with the fresh data.',
|
'update these files with the fresh data.',
|
||||||
);
|
);
|
||||||
argParser.addFlag(
|
argParser.addFlag(
|
||||||
@ -226,7 +226,7 @@ Future<void> main(List<String> rawArguments) async {
|
|||||||
KeyboardMapsCodeGenerator(physicalData, logicalData));
|
KeyboardMapsCodeGenerator(physicalData, logicalData));
|
||||||
await generate('engine utils',
|
await generate('engine utils',
|
||||||
path.join(PlatformCodeGenerator.engineRoot,
|
path.join(PlatformCodeGenerator.engineRoot,
|
||||||
'shell', 'platform', 'embedder', 'test_utils', 'key_codes.h'),
|
'shell', 'platform', 'embedder', 'test_utils', 'key_codes.g.h'),
|
||||||
KeyCodesCcGenerator(physicalData, logicalData));
|
KeyCodesCcGenerator(physicalData, logicalData));
|
||||||
await generate('android utils',
|
await generate('android utils',
|
||||||
path.join(PlatformCodeGenerator.engineRoot, 'shell', 'platform',
|
path.join(PlatformCodeGenerator.engineRoot, 'shell', 'platform',
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
| File name | Explanation |
|
| File name | Explanation |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| [`physical_key_data.json`](physical_key_data.json) | Contains the merged physical key data from all the other sources. This file is regenerated if "--collect" is specified for the gen_keycodes script, or used as a source otherwise. |
|
| [`physical_key_data.g.json`](physical_key_data.g.json) | Contains the merged physical key data from all the other sources. This file is regenerated if "--collect" is specified for the gen_keycodes script, or used as a source otherwise. |
|
||||||
| [`logical_key_data.json`](logical_key_data.json) | Contains the merged logical key data from all the other sources. This file is regenerated if "--collect" is specified for the gen_keycodes script, or used as a source otherwise. |
|
| [`logical_key_data.g.json`](logical_key_data.g.json) | Contains the merged logical key data from all the other sources. This file is regenerated if "--collect" is specified for the gen_keycodes script, or used as a source otherwise. |
|
||||||
| [`supplemental_hid_codes.inc`](supplemental_hid_codes.inc) | A supplementary HID list on top of Chromium's list of HID codes for extra physical keys. Certain entries may also overwrite Chromium's corresponding entries. |
|
| [`supplemental_hid_codes.inc`](supplemental_hid_codes.inc) | A supplementary HID list on top of Chromium's list of HID codes for extra physical keys. Certain entries may also overwrite Chromium's corresponding entries. |
|
||||||
| [`supplemental_key_data.inc`](supplemental_key_data.inc) | A supplementary key list on top of Chromium's list of keys for extra logical keys.|
|
| [`supplemental_key_data.inc`](supplemental_key_data.inc) | A supplementary key list on top of Chromium's list of keys for extra logical keys.|
|
||||||
| [`chromium_modifiers.json`](chromium_modifiers.json) | Maps the web's `key` for modifier keys to the names of the logical keys for these keys' left and right variations.This is used when generating logical keys to provide independent values for sided logical keys. Web uses the same `key` for modifier keys of different sides, but Flutter's logical key model treats them as different keys.|
|
| [`chromium_modifiers.json`](chromium_modifiers.json) | Maps the web's `key` for modifier keys to the names of the logical keys for these keys' left and right variations.This is used when generating logical keys to provide independent values for sided logical keys. Web uses the same `key` for modifier keys of different sides, but Flutter's logical key model treats them as different keys.|
|
||||||
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
| File name | Explanation |
|
| File name | Explanation |
|
||||||
| ---- | ---- |
|
| ---- | ---- |
|
||||||
| [`keyboard_key.tmpl`](keyboard_key.tmpl) | The template for `keyboard_key.dart`. |
|
| [`keyboard_key.tmpl`](keyboard_key.tmpl) | The template for `keyboard_key.g.dart`. |
|
||||||
| [`keyboard_maps.tmpl`](keyboard_maps.tmpl) | The template for `keyboard_maps.dart`. |
|
| [`keyboard_maps.tmpl`](keyboard_maps.tmpl) | The template for `keyboard_maps.g.dart`. |
|
||||||
|
|
||||||
|
|
||||||
### Android
|
### Android
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
// Edit the template dev/tools/gen_keycodes/data/keyboard_maps.tmpl instead.
|
// Edit the template dev/tools/gen_keycodes/data/keyboard_maps.tmpl instead.
|
||||||
// See dev/tools/gen_keycodes/README.md for more information.
|
// See dev/tools/gen_keycodes/README.md for more information.
|
||||||
|
|
||||||
import 'keyboard_key.dart';
|
import 'keyboard_key.g.dart';
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
|
|
||||||
/// Maps Android-specific key codes to the matching [LogicalKeyboardKey].
|
/// Maps Android-specific key codes to the matching [LogicalKeyboardKey].
|
||||||
const Map<int, LogicalKeyboardKey> kAndroidToLogicalKey = <int, LogicalKeyboardKey>{
|
const Map<int, LogicalKeyboardKey> kAndroidToLogicalKey = <int, LogicalKeyboardKey>{
|
||||||
|
@ -34,7 +34,7 @@ abstract class BaseCodeGenerator {
|
|||||||
Map<String, String> mappings();
|
Map<String, String> mappings();
|
||||||
|
|
||||||
/// Substitutes the various platform specific maps into the template file for
|
/// Substitutes the various platform specific maps into the template file for
|
||||||
/// keyboard_maps.dart.
|
/// keyboard_maps.g.dart.
|
||||||
String generate() {
|
String generate() {
|
||||||
final String template = File(templatePath).readAsStringSync();
|
final String template = File(templatePath).readAsStringSync();
|
||||||
return _injectDictionary(template, mappings());
|
return _injectDictionary(template, mappings());
|
||||||
|
@ -129,7 +129,7 @@ class GtkCodeGenerator extends PlatformCodeGenerator {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
||||||
'shell', 'platform', 'linux', 'key_mapping.cc');
|
'shell', 'platform', 'linux', 'key_mapping.g.cc');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> mappings() {
|
Map<String, String> mappings() {
|
||||||
|
@ -122,7 +122,7 @@ class IOSCodeGenerator extends PlatformCodeGenerator {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
||||||
'shell', 'platform', 'darwin', 'ios', 'framework', 'Source', 'KeyCodeMap.mm');
|
'shell', 'platform', 'darwin', 'ios', 'framework', 'Source', 'KeyCodeMap.g.mm');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> mappings() {
|
Map<String, String> mappings() {
|
||||||
|
@ -46,7 +46,7 @@ class SynonymKeyInfo {
|
|||||||
String get constantName => upperCamelToLowerCamel(name);
|
String get constantName => upperCamelToLowerCamel(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates the keyboard_key.dart based on the information in the key data
|
/// Generates the keyboard_key.g.dart based on the information in the key data
|
||||||
/// structure given to it.
|
/// structure given to it.
|
||||||
class KeyboardKeysCodeGenerator extends BaseCodeGenerator {
|
class KeyboardKeysCodeGenerator extends BaseCodeGenerator {
|
||||||
KeyboardKeysCodeGenerator(super.keyData, super.logicalData);
|
KeyboardKeysCodeGenerator(super.keyData, super.logicalData);
|
||||||
|
@ -34,7 +34,7 @@ bool _isDigit(String? char) {
|
|||||||
return charCode >= charDigit0 && charCode <= charDigit9;
|
return charCode >= charDigit0 && charCode <= charDigit9;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates the keyboard_maps.dart files, based on the information in the key
|
/// Generates the keyboard_maps.g.dart files, based on the information in the key
|
||||||
/// data structure given to it.
|
/// data structure given to it.
|
||||||
class KeyboardMapsCodeGenerator extends BaseCodeGenerator {
|
class KeyboardMapsCodeGenerator extends BaseCodeGenerator {
|
||||||
KeyboardMapsCodeGenerator(super.keyData, super.logicalData);
|
KeyboardMapsCodeGenerator(super.keyData, super.logicalData);
|
||||||
@ -176,7 +176,7 @@ class KeyboardMapsCodeGenerator extends BaseCodeGenerator {
|
|||||||
String get _windowsKeyCodeMap {
|
String get _windowsKeyCodeMap {
|
||||||
final OutputLines<int> lines = OutputLines<int>('Windows key code map');
|
final OutputLines<int> lines = OutputLines<int>('Windows key code map');
|
||||||
for (final LogicalKeyEntry entry in logicalData.entries) {
|
for (final LogicalKeyEntry entry in logicalData.entries) {
|
||||||
// Letter keys on Windows are not recorded in logical_key_data.json,
|
// Letter keys on Windows are not recorded in logical_key_data.g.json,
|
||||||
// because they are not used by the embedding. Add them manually.
|
// because they are not used by the embedding. Add them manually.
|
||||||
final List<int>? keyCodes = entry.windowsValues.isNotEmpty
|
final List<int>? keyCodes = entry.windowsValues.isNotEmpty
|
||||||
? entry.windowsValues
|
? entry.windowsValues
|
||||||
|
@ -569,7 +569,7 @@ class LogicalKeyEntry {
|
|||||||
|
|
||||||
/// A string indicating the letter on the keycap of a letter key.
|
/// A string indicating the letter on the keycap of a letter key.
|
||||||
///
|
///
|
||||||
/// This is only used to generate the key label mapping in keyboard_map.dart.
|
/// This is only used to generate the key label mapping in keyboard_maps.g.dart.
|
||||||
/// [LogicalKeyboardKey.keyLabel] uses a different definition and is generated
|
/// [LogicalKeyboardKey.keyLabel] uses a different definition and is generated
|
||||||
/// differently.
|
/// differently.
|
||||||
final String? keyLabel;
|
final String? keyLabel;
|
||||||
@ -607,7 +607,7 @@ class LogicalKeyEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the named used for the key constant in the definitions in
|
/// Gets the named used for the key constant in the definitions in
|
||||||
/// keyboard_key.dart.
|
/// keyboard_key.g.dart.
|
||||||
///
|
///
|
||||||
/// If set by the constructor, returns the name set, but otherwise constructs
|
/// If set by the constructor, returns the name set, but otherwise constructs
|
||||||
/// the name from the various different names available, making sure that the
|
/// the name from the various different names available, making sure that the
|
||||||
|
@ -119,7 +119,7 @@ class MacOSCodeGenerator extends PlatformCodeGenerator {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
||||||
'shell', 'platform', 'darwin', 'macos', 'framework', 'Source', 'KeyCodeMap.mm');
|
'shell', 'platform', 'darwin', 'macos', 'framework', 'Source', 'KeyCodeMap.g.mm');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> mappings() {
|
Map<String, String> mappings() {
|
||||||
|
@ -313,7 +313,7 @@ class PhysicalKeyEntry {
|
|||||||
String get commentName => getCommentName(constantName);
|
String get commentName => getCommentName(constantName);
|
||||||
|
|
||||||
/// Gets the named used for the key constant in the definitions in
|
/// Gets the named used for the key constant in the definitions in
|
||||||
/// keyboard_key.dart.
|
/// keyboard_key.g.dart.
|
||||||
///
|
///
|
||||||
/// If set by the constructor, returns the name set, but otherwise constructs
|
/// If set by the constructor, returns the name set, but otherwise constructs
|
||||||
/// the name from the various different names available, making sure that the
|
/// the name from the various different names available, making sure that the
|
||||||
|
@ -66,7 +66,7 @@ class WebCodeGenerator extends PlatformCodeGenerator {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
||||||
'lib', 'web_ui', 'lib', 'src', 'engine', 'key_map.dart');
|
'lib', 'web_ui', 'lib', 'src', 'engine', 'key_map.g.dart');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> mappings() {
|
Map<String, String> mappings() {
|
||||||
|
@ -83,7 +83,7 @@ class WindowsCodeGenerator extends PlatformCodeGenerator {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
|
||||||
'shell', 'platform', 'windows', 'flutter_key_map.cc');
|
'shell', 'platform', 'windows', 'flutter_key_map.g.cc');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> mappings() {
|
Map<String, String> mappings() {
|
||||||
|
@ -23,9 +23,9 @@ String readDataFile(String fileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final PhysicalKeyData physicalData = PhysicalKeyData.fromJson(
|
final PhysicalKeyData physicalData = PhysicalKeyData.fromJson(
|
||||||
json.decode(readDataFile('physical_key_data.json')) as Map<String, dynamic>);
|
json.decode(readDataFile('physical_key_data.g.json')) as Map<String, dynamic>);
|
||||||
final LogicalKeyData logicalData = LogicalKeyData.fromJson(
|
final LogicalKeyData logicalData = LogicalKeyData.fromJson(
|
||||||
json.decode(readDataFile('logical_key_data.json')) as Map<String, dynamic>);
|
json.decode(readDataFile('logical_key_data.g.json')) as Map<String, dynamic>);
|
||||||
final Map<String, bool> keyGoals = parseMapOfBool(
|
final Map<String, bool> keyGoals = parseMapOfBool(
|
||||||
readDataFile('layout_goals.json'));
|
readDataFile('layout_goals.json'));
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
final String output = codeGenerator.generate();
|
final String output = codeGenerator.generate();
|
||||||
|
|
||||||
expect(codeGenerator.outputPath(platform), endsWith('KeyCodeMap.mm'));
|
expect(codeGenerator.outputPath(platform), endsWith('KeyCodeMap.g.mm'));
|
||||||
expect(output, contains('kValueMask'));
|
expect(output, contains('kValueMask'));
|
||||||
expect(output, contains('keyCodeToPhysicalKey'));
|
expect(output, contains('keyCodeToPhysicalKey'));
|
||||||
expect(output, contains('keyCodeToLogicalKey'));
|
expect(output, contains('keyCodeToLogicalKey'));
|
||||||
@ -89,7 +89,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
final String output = codeGenerator.generate();
|
final String output = codeGenerator.generate();
|
||||||
|
|
||||||
expect(codeGenerator.outputPath(platform), endsWith('KeyCodeMap.mm'));
|
expect(codeGenerator.outputPath(platform), endsWith('KeyCodeMap.g.mm'));
|
||||||
expect(output, contains('kValueMask'));
|
expect(output, contains('kValueMask'));
|
||||||
expect(output, contains('keyCodeToPhysicalKey'));
|
expect(output, contains('keyCodeToPhysicalKey'));
|
||||||
expect(output, contains('keyCodeToLogicalKey'));
|
expect(output, contains('keyCodeToLogicalKey'));
|
||||||
@ -109,7 +109,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
final String output = codeGenerator.generate();
|
final String output = codeGenerator.generate();
|
||||||
|
|
||||||
expect(codeGenerator.outputPath(platform), endsWith('flutter_key_map.cc'));
|
expect(codeGenerator.outputPath(platform), endsWith('flutter_key_map.g.cc'));
|
||||||
expect(output, contains('KeyboardKeyEmbedderHandler::windowsToPhysicalMap_'));
|
expect(output, contains('KeyboardKeyEmbedderHandler::windowsToPhysicalMap_'));
|
||||||
expect(output, contains('KeyboardKeyEmbedderHandler::windowsToLogicalMap_'));
|
expect(output, contains('KeyboardKeyEmbedderHandler::windowsToLogicalMap_'));
|
||||||
expect(output, contains('KeyboardKeyEmbedderHandler::scanCodeToLogicalMap_'));
|
expect(output, contains('KeyboardKeyEmbedderHandler::scanCodeToLogicalMap_'));
|
||||||
@ -126,7 +126,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
final String output = codeGenerator.generate();
|
final String output = codeGenerator.generate();
|
||||||
|
|
||||||
expect(codeGenerator.outputPath(platform), endsWith('key_mapping.cc'));
|
expect(codeGenerator.outputPath(platform), endsWith('key_mapping.g.cc'));
|
||||||
expect(output, contains('initialize_modifier_bit_to_checked_keys'));
|
expect(output, contains('initialize_modifier_bit_to_checked_keys'));
|
||||||
expect(output, contains('initialize_lock_bit_to_checked_keys'));
|
expect(output, contains('initialize_lock_bit_to_checked_keys'));
|
||||||
checkCommonOutput(output);
|
checkCommonOutput(output);
|
||||||
@ -140,7 +140,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
final String output = codeGenerator.generate();
|
final String output = codeGenerator.generate();
|
||||||
|
|
||||||
expect(codeGenerator.outputPath(platform), endsWith('key_map.dart'));
|
expect(codeGenerator.outputPath(platform), endsWith('key_map.g.dart'));
|
||||||
expect(output, contains('kWebToLogicalKey'));
|
expect(output, contains('kWebToLogicalKey'));
|
||||||
expect(output, contains('kWebToPhysicalKey'));
|
expect(output, contains('kWebToPhysicalKey'));
|
||||||
expect(output, contains('kWebLogicalLocationMap'));
|
expect(output, contains('kWebLogicalLocationMap'));
|
||||||
|
@ -20,8 +20,8 @@ export 'src/services/deferred_component.dart';
|
|||||||
export 'src/services/font_loader.dart';
|
export 'src/services/font_loader.dart';
|
||||||
export 'src/services/haptic_feedback.dart';
|
export 'src/services/haptic_feedback.dart';
|
||||||
export 'src/services/hardware_keyboard.dart';
|
export 'src/services/hardware_keyboard.dart';
|
||||||
export 'src/services/keyboard_key.dart';
|
export 'src/services/keyboard_key.g.dart';
|
||||||
export 'src/services/keyboard_maps.dart';
|
export 'src/services/keyboard_maps.g.dart';
|
||||||
export 'src/services/message_codec.dart';
|
export 'src/services/message_codec.dart';
|
||||||
export 'src/services/message_codecs.dart';
|
export 'src/services/message_codecs.dart';
|
||||||
export 'src/services/mouse_cursor.dart';
|
export 'src/services/mouse_cursor.dart';
|
||||||
|
@ -13,7 +13,7 @@ export 'dart:ui' show KeyData;
|
|||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
export 'raw_keyboard.dart' show RawKeyboard, RawKeyEvent;
|
export 'raw_keyboard.dart' show RawKeyboard, RawKeyEvent;
|
||||||
|
|
||||||
/// Represents a lock mode of a keyboard, such as [KeyboardLockMode.capsLock].
|
/// Represents a lock mode of a keyboard, such as [KeyboardLockMode.capsLock].
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
// Edit the template dev/tools/gen_keycodes/data/keyboard_maps.tmpl instead.
|
// Edit the template dev/tools/gen_keycodes/data/keyboard_maps.tmpl instead.
|
||||||
// See dev/tools/gen_keycodes/README.md for more information.
|
// See dev/tools/gen_keycodes/README.md for more information.
|
||||||
|
|
||||||
import 'keyboard_key.dart';
|
import 'keyboard_key.g.dart';
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
|
|
||||||
/// Maps Android-specific key codes to the matching [LogicalKeyboardKey].
|
/// Maps Android-specific key codes to the matching [LogicalKeyboardKey].
|
||||||
const Map<int, LogicalKeyboardKey> kAndroidToLogicalKey = <int, LogicalKeyboardKey>{
|
const Map<int, LogicalKeyboardKey> kAndroidToLogicalKey = <int, LogicalKeyboardKey>{
|
@ -7,7 +7,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
|
|
||||||
import 'binding.dart';
|
import 'binding.dart';
|
||||||
import 'hardware_keyboard.dart';
|
import 'hardware_keyboard.dart';
|
||||||
import 'keyboard_key.dart';
|
import 'keyboard_key.g.dart';
|
||||||
import 'raw_keyboard_android.dart';
|
import 'raw_keyboard_android.dart';
|
||||||
import 'raw_keyboard_fuchsia.dart';
|
import 'raw_keyboard_fuchsia.dart';
|
||||||
import 'raw_keyboard_ios.dart';
|
import 'raw_keyboard_ios.dart';
|
||||||
@ -19,7 +19,7 @@ import 'system_channels.dart';
|
|||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder, ValueChanged;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder, ValueChanged;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
|
|
||||||
/// An enum describing the side of the keyboard that a key is on, to allow
|
/// An enum describing the side of the keyboard that a key is on, to allow
|
||||||
/// discrimination between which key is pressed (e.g. the left or right SHIFT
|
/// discrimination between which key is pressed (e.g. the left or right SHIFT
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'keyboard_maps.dart';
|
import 'keyboard_maps.g.dart';
|
||||||
import 'raw_keyboard.dart';
|
import 'raw_keyboard.dart';
|
||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
||||||
|
|
||||||
// Android sets the 0x80000000 bit on a character to indicate that it is a
|
// Android sets the 0x80000000 bit on a character to indicate that it is a
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'keyboard_maps.dart';
|
import 'keyboard_maps.g.dart';
|
||||||
import 'raw_keyboard.dart';
|
import 'raw_keyboard.dart';
|
||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
||||||
|
|
||||||
/// Platform-specific key event data for Fuchsia.
|
/// Platform-specific key event data for Fuchsia.
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'keyboard_maps.dart';
|
import 'keyboard_maps.g.dart';
|
||||||
import 'raw_keyboard.dart';
|
import 'raw_keyboard.dart';
|
||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
||||||
|
|
||||||
/// Maps iOS specific string values of nonvisible keys to logical keys
|
/// Maps iOS specific string values of nonvisible keys to logical keys
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'keyboard_maps.dart';
|
import 'keyboard_maps.g.dart';
|
||||||
import 'raw_keyboard.dart';
|
import 'raw_keyboard.dart';
|
||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
||||||
|
|
||||||
/// Platform-specific key event data for Linux.
|
/// Platform-specific key event data for Linux.
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'keyboard_maps.dart';
|
import 'keyboard_maps.g.dart';
|
||||||
import 'raw_keyboard.dart';
|
import 'raw_keyboard.dart';
|
||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
||||||
|
|
||||||
/// Convert a UTF32 rune to its lower case.
|
/// Convert a UTF32 rune to its lower case.
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'keyboard_maps.dart';
|
import 'keyboard_maps.g.dart';
|
||||||
import 'raw_keyboard.dart';
|
import 'raw_keyboard.dart';
|
||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
||||||
|
|
||||||
String? _unicodeChar(String key) {
|
String? _unicodeChar(String key) {
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'keyboard_maps.dart';
|
import 'keyboard_maps.g.dart';
|
||||||
import 'raw_keyboard.dart';
|
import 'raw_keyboard.dart';
|
||||||
|
|
||||||
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
|
||||||
|
|
||||||
export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
export 'keyboard_key.g.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
|
||||||
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
|
||||||
|
|
||||||
// Virtual key VK_PROCESSKEY in Win32 API.
|
// Virtual key VK_PROCESSKEY in Win32 API.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter/src/services/keyboard_key.dart';
|
import 'package:flutter/src/services/keyboard_key.g.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
import '../rendering/mock_canvas.dart';
|
import '../rendering/mock_canvas.dart';
|
||||||
|
@ -6,7 +6,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter/src/services/keyboard_key.dart';
|
import 'package:flutter/src/services/keyboard_key.g.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
import '../rendering/mock_canvas.dart';
|
import '../rendering/mock_canvas.dart';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user