flutter/dev/tools/gen_keycodes/data/web_key_map_dart.tmpl
Tong Mu c8d0b1d9db
New scheme for keyboard logical key ID (#85121)
This PR updates the ID used by logical keyboard keys.

The logical key ID is still composed of 2 parts: 32 bits of value, and 8 bits of plane. But the assignment of planes has been drastically changed. HID plane is removed, and unprintable plane and Flutter plane are added. This is to reflect the new generation method for logical key IDs. Now keys that are defined by Flutter but not by dom_key_data are placed into the Flutter plane, including numpad keys, sided modifier keys, and gamepad keys. The values for platform planes have also been adjusted.

The generation script and README have been updated accordingly as well.

A new file, test_utils/key_codes.h is now generated to assist engine unit testing.

All lists generated by the script are now sorted by the key.
2021-07-14 13:07:22 -07:00

33 lines
1.1 KiB
Cheetah

// 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.
// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
// This file is generated by dev/tools/gen_keycodes/bin/gen_keycodes.dart and
// should not be edited directly.
//
// Edit the template dev/tools/gen_keycodes/data/web_key_map_dart.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
/// Maps Web KeyboardEvent keys to the matching LogicalKeyboardKey id.
const Map<String, int> kWebToLogicalKey = <String, int>{
@@@WEB_LOGICAL_KEY_CODE_MAP@@@
};
/// Maps Web KeyboardEvent codes to the matching PhysicalKeyboardKey USB HID code.
const Map<String, int> kWebToPhysicalKey = <String, int>{
@@@WEB_PHYSICAL_KEY_CODE_MAP@@@
};
/// Maps Web KeyboardEvent keys to Flutter logical IDs that depend on locations.
///
/// `KeyboardEvent.location` is defined as:
///
/// * 0: Standard
/// * 1: Left
/// * 2: Right
/// * 3: Numpad
const Map<String, List<int?>> kWebLogicalLocationMap = <String, List<int?>>{
@@@WEB_LOGICAL_LOCATION_MAP@@@
};