Unverified Commit 9956a35a authored by Tong Mu's avatar Tong Mu Committed by GitHub

Hardware keyboard: codegen (#73440)

Rewrites tools/gen_keycodes, the script that generates key mappings across the framework and the engine.
parent 0cb0767b
## Keycode Generator
This directory contains a keycode generator that can generate Dart code for
the `LogicalKeyboardKey` and `PhysicalKeyboardKey` classes. It draws information
from both the Chromium and Android source bases and incorporates the
information it finds in those sources into a single key database in JSON form.
It then generates `keyboard_key.dart` (containing the `LogicalKeyboardKey` and
`PhysicalKeyboardKey` classes), and `keyboard_maps.dart`, containing
platform-specific immutable maps for translating platform keycodes and
information into the pre-defined key values in the `LogicalKeyboardKey` and
`PhysicalKeyboardKey` classes.
The `data` subdirectory contains both some local data files and the templates
used to generate the source files.
- `data/key_data.json`: contains the merged data from all the other sources.
This file will be regenerated if "--collect" is specified for the
gen_keycodes script.
- `data/key_name_to_android_name.json`: contains a mapping from Flutter key
names to Android keycode names (with the "KEY\_" prefix stripped off).
- `data/keyboard_key.tmpl`: contains the template for the `keyboard_key.dart`
file. Markers that begin and end with "@@@" denote the locations where
generated data will be inserted.
- `data/keyboard_maps.tmpl`: contains the template for the `keyboard_maps.dart`
file. Markers that begin and end with "@@@" denote the locations where
generated data will be inserted.
- `data/printable.json`: contains a mapping between Flutter key name and its
printable character. This character is used as the key label.
- `data/synonyms.json`: contains a mapping between pseudo-keys that represent
other keys and the sets of keys they represent. For example, this contains
the "shift" key that represents either a "shiftLeft" or "shiftRight" key.
the `LogicalKeyboardKey` and `PhysicalKeyboardKey` classes.
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_maps.dart`](../../../packages/flutter/lib/src/services/keyboard_maps.dart), which contains platform-specific immutable maps used for the `RawKeyboard` API.
For engine, it generates one key mapping file for each platform.
It draws information from various source bases, including online
repositories, and manual mapping in the `data` subdirectory. It incorporates
this information into a giant list of physical keys
([`physical_key_data.json`](data/physical_key_data.json)),
and another for logical keys
([`logical_key_data.json`](data/logical_key_data.json)).
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.
## Running the tool
To run the `gen_keycodes` tool using the checked in `key_data.json` file, run
it like so:
The tool can be run based on the existing database. To do this, run:
```bash
$FLUTTER_ROOT/bin/cache/dart-sdk/bin/dart bin/gen_keycodes.dart
/PATH/TO/ROOT/bin/gen_keycodes
```
This will regenerate the `keyboard_key.dart` and `keyboard_maps.dart` files in
place.
The tool can also be run by rebuilding the database by drawing online information
anew before generating the files. To do this, run:
```bash
/PATH/TO/ROOT/bin/gen_keycodes --collect
```
If you wish to incorporate and parse changes from the Chromium and Android
source trees, add `--collect` to the command line. The script will download and
incorporate the changed data automatically. Note that the parsing is specific to
the format of the source code that it is reading, so if the format of those
files changes appreciably, you will need to update the parser.
This will generate `physical_key_data.json` and `logical_key_data.json`. These
files should be checked in.
There are other options for manually specifying the file to read in place of the
downloaded files, use `--help` to see what is available.
By default this tool assumes that the gclient directory for flutter/engine
and the root for the flutter/flutter are placed at the same folder. If not,
use `--engine-root=/ENGINE/GCLIENT/ROOT` to specify the engine root.
If the data in those files changes in the future to be unhelpful, then we can
switch to another data source, or abandon the parsing and maintain
`key_data.json` manually. All output files and local input files should be
checked in.
Other options can be found using `--help`.
## Key Code ID Scheme
......
include: ../../../analysis_options.yaml
#!/usr/bin/env bash
set -euo pipefail
# Needed because if it is set, cd may print the path it changed to.
unset CDPATH
# On Mac OS, readlink -f doesn't work, so follow_links traverses the path one
# link at a time, and then cds into the link destination and find out where it
# ends up.
#
# The returned filesystem path must be a format usable by Dart's URI parser,
# since the Dart command line tool treats its argument as a file URI, not a
# filename. For instance, multiple consecutive slashes should be reduced to a
# single slash, since double-slashes indicate a URI "authority", and these are
# supposed to be filenames. There is an edge case where this will return
# multiple slashes: when the input resolves to the root directory. However, if
# that were the case, we wouldn't be running this shell, so we don't do anything
# about it.
#
# The function is enclosed in a subshell to avoid changing the working directory
# of the caller.
function follow_links() (
cd -P "$(dirname -- "$1")"
file="$PWD/$(basename -- "$1")"
while [[ -h "$file" ]]; do
cd -P "$(dirname -- "$file")"
file="$(readlink -- "$file")"
cd -P "$(dirname -- "$file")"
file="$PWD/$(basename -- "$file")"
done
echo "$file"
)
PROG_NAME="$(follow_links "${BASH_SOURCE[0]}")"
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
DART_BIN="$BIN_DIR/../../../../bin/dart"
"$DART_BIN" --enable-asserts "$BIN_DIR/gen_keycodes.dart" "$@"
## Files
### General
| 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. |
| [`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. |
| [`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.|
| [`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.|
| [`printable_to_numpads.json`](printable_to_numpads.json) | Maps a character to the names of the logical keys for these keys' number pad variations. This is used when generating logical keys to provide independent values for number pad logical keys. The web uses the character as the `key` for number pad keys, but Flutter's logical key model treats them as independent keys.|
| [`printable.json`](printable.json) | Maps Flutter key name to its printable character. This character is used as the key label.|
| [`synonyms.json`](synonyms.json) | Maps pseudo-keys that represent other keys to the sets of keys they represent. For example, this contains the "shift" key that represents either a "shiftLeft" or "shiftRight" key.|
### Framework
| File name | Explanation |
| ---- | ---- |
| [`keyboard_key.tmpl`](keyboard_key.tmpl) | The template for `keyboard_key.dart`. |
| [`keyboard_maps.tmpl`](keyboard_maps.tmpl) | The template for `keyboard_maps.dart`. |
### Android
| File name | Explanation |
| ---- | ---- |
| [`android_keyboard_map_java.tmpl`](android_keyboard_map_java.tmpl) | The template for `KeyboardMap.java`. |
| [`android_key_name_to_name.json`](android_key_name_to_name.json) | Maps a logical key name to the names of its corresponding keycode constants. This is used to convert logical keys.|
### iOS
| 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.) |
### Web
| File name | Explanation |
| ---- | ---- |
| [`web_key_map_dart.tmpl`](web_key_map_dart.tmpl) | The template for `key_map.dart`. |
| [`web_logical_location_mapping.json`](web_logical_location_mapping.json) | Maps a pair of the web's `key` and `location` to the name for its corresponding logical key. This is used to distinguish between logical keys with the same `key` but different `locations`. |
### Windows
| File name | Explanation |
| ---- | ---- |
| [`windows_flutter_key_map_cc.tmpl`](windows_flutter_key_map_cc.tmpl) | The template for `flutter_key_map.cc`. |
| [`windows_logical_to_window_vk.json`](windows_logical_to_window_vk.json) | Maps a logical key name to the names of its corresponding virtual keys in Win32. |
| [`windows_scancode_logical_map.json`](windows_scancode_logical_map.json) | Maps a physical key name to a logical key name. This is used to when a `keycode` maps to multiple keys (including when the `keycode` is 0), therefore can only be told apart by the scan code. |
### Linux (GTK)
| File name | Explanation |
| ---- | ---- |
| [`gtk_key_mapping_cc.tmpl`](gtk_key_mapping_cc.tmpl) | The template for `key_mapping.cc`. |
| [`gtk_lock_bit_mapping.json`](gtk_lock_bit_mapping.json) | Maps a name for GTK's modifier bit macro to Flutter's logical name (element #0) and physical name (element #1). This is used to generate checked keys that GTK should keep lock state synchronous on.|
| [`gtk_logical_name_mapping.json`](gtk_logical_name_mapping.json) | Maps a logical key name to the macro names of its corresponding `keyval`s. This is used to convert logical keys.|
| [`gtk_modifier_bit_mapping.json`](gtk_modifier_bit_mapping.json) | Maps a name for GTK's modifier bit macro to Flutter's logical name (element #0), physical name (element #1), and the physical name for the paired key (element #2). This is used to generate checked keys that GTK should keep pressing state synchronous on.|
| [`gtk_numpad_shift.json`](gtk_numpad_shift.json) | Maps the name of a `keyval` macro of a numpad key to that of the corresponding key with NumLock on. GTK uses different `keyval` for numpad keys with and without NumLock on, but Flutter's logical key model treats them as the same key.|
### Linux (GLFW)
| File name | Explanation |
| ---- | ---- |
| [`glfw_key_name_to_name.json`](glfw_key_name_to_name.json) | Maps a logical key name to the names of its GLFW macro. (Unused for now.) |
| [`glfw_keyboard_map_cc.tmpl`](glfw_keyboard_map_cc.tmpl) | The template for `keyboard_map.cc`. (Unused for now.) |
### macOS
| File name | Explanation |
| ---- | ---- |
| [`macos_key_code_map_cc.tmpl`](macos_key_code_map_cc.tmpl) | The template for `KeyCodeMap.cc`. |
| [`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
| File name | Explanation |
| ---- | ---- |
| [`fuchsia_keyboard_map_cc.tmpl`](fuchsia_keyboard_map_cc.tmpl) | The template for `keyboard_map.cc`. (Unused for now.) |
{
"Again": ["AGAIN"],
"AltLeft": ["ALT_LEFT"],
"AltRight": ["ALT_RIGHT"],
"AppSwitch": ["APP_SWITCH"],
"ArrowDown": ["DPAD_DOWN"],
"ArrowLeft": ["DPAD_LEFT"],
"ArrowRight": ["DPAD_RIGHT"],
"ArrowUp": ["DPAD_UP"],
"AudioVolumeDown": ["VOLUME_DOWN"],
"AudioVolumeMute": ["VOLUME_MUTE"],
"AudioVolumeUp": ["VOLUME_UP"],
"AVRInput": ["AVR_INPUT"],
"AVRPower": ["AVR_POWER"],
"BassBoost": ["BASSBOOST"],
"Print": ["PRINT"],
"Backquote": ["GRAVE"],
"Backslash": ["BACKSLASH"],
"Backspace": ["DEL"],
"BracketLeft": ["LEFT_BRACKET"],
"BracketRight": ["RIGHT_BRACKET"],
"BrightnessDown": ["BRIGHTNESS_DOWN"],
"BrightnessUp": ["BRIGHTNESS_UP"],
"BrowserFavorites": ["BOOKMARK"],
"BrowserForward": ["FORWARD"],
"BrowserSearch": ["SEARCH"],
"Call": ["CALL"],
"Camera": ["CAMERA"],
"CameraFocus": ["FOCUS"],
"CapsLock": ["CAPS_LOCK"],
"ChannelDown": ["CHANNEL_DOWN"],
"ChannelUp": ["CHANNEL_UP"],
"Clear": ["CLEAR"],
"Close": ["MEDIA_CLOSE", "CLOSE"],
"ClosedCaptionToggle": ["CAPTIONS"],
"ColorF0Red": ["PROG_RED"],
"ColorF1Green": ["PROG_GREEN"],
"ColorF2Yellow": ["PROG_YELLOW"],
"ColorF3Blue": ["PROG_BLUE"],
"Comma": ["COMMA"],
"ContextMenu": ["MENU"],
"ControlLeft": ["CTRL_LEFT"],
"ControlRight": ["CTRL_RIGHT"],
"Convert": ["HENKAN"],
"Copy": ["COPY"],
"Cut": ["CUT"],
"Delete": ["FORWARD_DEL"],
"Digit0": ["0"],
"Digit1": ["1"],
"Digit2": ["2"],
"Digit3": ["3"],
"Digit4": ["4"],
"Digit5": ["5"],
"Digit6": ["6"],
"Digit7": ["7"],
"Digit8": ["8"],
"Digit9": ["9"],
"DVR": ["DVR"],
"Eisu": ["EISU"],
"Eject": ["MEDIA_EJECT"],
"End": ["MOVE_END"],
"EndCall": ["ENDCALL"],
"Enter": ["ENTER"],
"Equal": ["EQUALS"],
"Escape": ["ESCAPE"],
"Exit": ["EXIT"],
"F1": ["F1"],
"F2": ["F2"],
"F3": ["F3"],
"F4": ["F4"],
"F5": ["F5"],
"F6": ["F6"],
"F7": ["F7"],
"F8": ["F8"],
"F9": ["F9"],
"F10": ["F10"],
"F11": ["F11"],
"F12": ["F12"],
"F13": ["F13"],
"F14": ["F14"],
"F15": ["F15"],
"F16": ["F16"],
"F17": ["F17"],
"F18": ["F18"],
"F19": ["F19"],
"F20": ["F20"],
"F21": ["F21"],
"F22": ["F22"],
"F23": ["F23"],
"F24": ["F24"],
"Find": ["FIND"],
"Fn": ["FUNCTION"],
"GameButton1": ["BUTTON_1"],
"GameButton2": ["BUTTON_2"],
"GameButton3": ["BUTTON_3"],
"GameButton4": ["BUTTON_4"],
"GameButton5": ["BUTTON_5"],
"GameButton6": ["BUTTON_6"],
"GameButton7": ["BUTTON_7"],
"GameButton8": ["BUTTON_8"],
"GameButton9": ["BUTTON_9"],
"GameButton10": ["BUTTON_10"],
"GameButton11": ["BUTTON_11"],
"GameButton12": ["BUTTON_12"],
"GameButton13": ["BUTTON_13"],
"GameButton14": ["BUTTON_14"],
"GameButton15": ["BUTTON_15"],
"GameButton16": ["BUTTON_16"],
"GameButtonA": ["BUTTON_A"],
"GameButtonB": ["BUTTON_B"],
"GameButtonC": ["BUTTON_C"],
"GameButtonLeft1": ["BUTTON_L1"],
"GameButtonLeft2": ["BUTTON_L2"],
"GameButtonMode": ["BUTTON_MODE"],
"GameButtonRight1": ["BUTTON_R1"],
"GameButtonRight2": ["BUTTON_R2"],
"GameButtonSelect": ["BUTTON_SELECT"],
"GameButtonStart": ["BUTTON_START"],
"GameButtonThumbLeft": ["BUTTON_THUMBL"],
"GameButtonThumbRight": ["BUTTON_THUMBR"],
"GameButtonX": ["BUTTON_X"],
"GameButtonY": ["BUTTON_Y"],
"GameButtonZ": ["BUTTON_Z"],
"GoBack": ["BACK"],
"GoHome": ["HOME"],
"GroupNext": ["LANGUAGE_SWITCH"],
"Guide": ["GUIDE"],
"HeadsetHook": ["HEADSETHOOK"],
"Help": ["HELP"],
"HiraganaKatakana": ["KATAKANA_HIRAGANA"],
"Home": ["MOVE_HOME"],
"Info": ["INFO"],
"Insert": ["INSERT"],
"KanjiMode": ["KANA"],
"KeyA": ["A"],
"KeyB": ["B"],
"KeyC": ["C"],
"KeyD": ["D"],
"KeyE": ["E"],
"KeyF": ["F"],
"KeyG": ["G"],
"KeyH": ["H"],
"KeyI": ["I"],
"KeyJ": ["J"],
"KeyK": ["K"],
"KeyL": ["L"],
"KeyM": ["M"],
"KeyN": ["N"],
"KeyO": ["O"],
"KeyP": ["P"],
"KeyQ": ["Q"],
"KeyR": ["R"],
"KeyS": ["S"],
"KeyT": ["T"],
"KeyU": ["U"],
"KeyV": ["V"],
"KeyW": ["W"],
"KeyX": ["X"],
"KeyY": ["Y"],
"KeyZ": ["Z"],
"IntlRo": ["RO"],
"IntlYen": ["YEN"],
"Lang1": [],
"Lang2": [],
"Lang3": ["KATAKANA"],
"Lang4": ["HIRAGANA"],
"LaunchAssistant": ["ASSIST"],
"LaunchCalendar": ["CALENDAR"],
"LaunchContacts": ["CONTACTS"],
"LaunchMail": ["ENVELOPE"],
"LaunchMusicPlayer": ["MUSIC"],
"LaunchWebBrowser": ["EXPLORER"],
"MannerMode": ["MANNER_MODE"],
"MediaAudioTrack": ["MEDIA_AUDIO_TRACK"],
"MediaFastForward": ["MEDIA_FAST_FORWARD"],
"MediaLast": ["LAST_CHANNEL"],
"MediaPause": ["MEDIA_PAUSE"],
"MediaPlay": ["MEDIA_PLAY"],
"MediaPlayPause": ["MEDIA_PLAY_PAUSE"],
"MediaRecord": ["MEDIA_RECORD"],
"MediaRewind": ["MEDIA_REWIND"],
"MediaSkipBackward": ["MEDIA_SKIP_BACKWARD"],
"MediaSkipForward": ["MEDIA_SKIP_FORWARD"],
"MediaStepBackward": ["MEDIA_STEP_BACKWARD"],
"MediaStepForward": ["MEDIA_STEP_FORWARD"],
"MediaStop": ["MEDIA_STOP"],
"MediaTopMenu": ["MEDIA_TOP_MENU"],
"MediaTrackNext": ["MEDIA_NEXT"],
"MediaTrackPrevious": ["MEDIA_PREVIOUS"],
"MetaLeft": ["META_LEFT"],
"MetaRight": ["META_RIGHT"],
"MicrophoneVolumeMute": ["MUTE"],
"Minus": ["MINUS"],
"ModeChange": ["SWITCH_CHARSET"],
"NavigateIn": ["NAVIGATE_IN"],
"NavigateNext": ["NAVIGATE_NEXT"],
"NavigateOut": ["NAVIGATE_OUT"],
"NavigatePrevious": ["NAVIGATE_PREVIOUS"],
"NewKey": ["NEW"],
"NonConvert": ["MUHENKAN"],
"None": ["UNKNOWN"],
"Notification": ["NOTIFICATION"],
"NumLock": ["NUM_LOCK"],
"Numpad0": ["NUMPAD_0"],
"Numpad1": ["NUMPAD_1"],
"Numpad2": ["NUMPAD_2"],
"Numpad3": ["NUMPAD_3"],
"Numpad4": ["NUMPAD_4"],
"Numpad5": ["NUMPAD_5"],
"Numpad6": ["NUMPAD_6"],
"Numpad7": ["NUMPAD_7"],
"Numpad8": ["NUMPAD_8"],
"Numpad9": ["NUMPAD_9"],
"NumpadAdd": ["NUMPAD_ADD"],
"NumpadComma": ["NUMPAD_COMMA"],
"NumpadDecimal": ["NUMPAD_DOT"],
"NumpadDivide": ["NUMPAD_DIVIDE"],
"NumpadEnter": ["NUMPAD_ENTER"],
"NumpadEqual": ["NUMPAD_EQUALS"],
"NumpadMultiply": ["NUMPAD_MULTIPLY"],
"NumpadParenLeft": ["NUMPAD_LEFT_PAREN"],
"NumpadParenRight": ["NUMPAD_RIGHT_PAREN"],
"NumpadSubtract": ["NUMPAD_SUBTRACT"],
"Open": ["OPEN"],
"PageDown": ["PAGE_DOWN"],
"PageUp": ["PAGE_UP"],
"Pairing": ["PAIRING"],
"Paste": ["PASTE"],
"Pause": ["BREAK"],
"Period": ["PERIOD"],
"Power": ["POWER"],
"PrintScreen": ["SYSRQ"],
"Props": ["PROPS"],
"Quote": ["APOSTROPHE"],
"Redo": ["REDO"],
"ScrollLock": ["SCROLL_LOCK"],
"Select": ["DPAD_CENTER"],
"Semicolon": ["SEMICOLON"],
"Settings": ["SETTINGS"],
"ShiftLeft": ["SHIFT_LEFT"],
"ShiftRight": ["SHIFT_RIGHT"],
"Slash": ["SLASH"],
"Sleep": ["SLEEP"],
"Space": ["SPACE"],
"STBInput": ["STB_INPUT"],
"STBPower": ["STB_POWER"],
"Suspend": ["SUSPEND"],
"Symbol": ["SYM"],
"Tab": ["TAB"],
"Teletext": ["TV_TELETEXT"],
"TV": ["TV"],
"TV3DMode": ["3D_MODE"],
"TVAntennaCable": ["TV_ANTENNA_CABLE"],
"TVAudioDescription": ["TV_AUDIO_DESCRIPTION"],
"TVAudioDescriptionMixDown": ["TV_AUDIO_DESCRIPTION_MIX_DOWN"],
"TVAudioDescriptionMixUp": ["TV_AUDIO_DESCRIPTION_MIX_UP"],
"TVContentsMenu": ["TV_CONTENTS_MENU"],
"TVDataService": ["TV_DATA_SERVICE"],
"TVInput": ["TV_INPUT"],
"TVInputComponent1": ["TV_INPUT_COMPONENT_1"],
"TVInputComponent2": ["TV_INPUT_COMPONENT_2"],
"TVInputComposite1": ["TV_INPUT_COMPOSITE_1"],
"TVInputComposite2": ["TV_INPUT_COMPOSITE_2"],
"TVInputHDMI1": ["TV_INPUT_HDMI_1"],
"TVInputHDMI2": ["TV_INPUT_HDMI_2"],
"TVInputHDMI3": ["TV_INPUT_HDMI_3"],
"TVInputHDMI4": ["TV_INPUT_HDMI_4"],
"TVInputVGA1": ["TV_INPUT_VGA_1"],
"TVNetwork": ["TV_NETWORK"],
"TVNumberEntry": ["TV_NUMBER_ENTRY"],
"TVPower": ["TV_POWER"],
"TVRadioService": ["TV_RADIO_SERVICE"],
"TVSatellite": ["TV_SATELLITE"],
"TVSatelliteBS": ["TV_SATELLITE_BS"],
"TVSatelliteCS": ["TV_SATELLITE_CS"],
"TVSatelliteToggle": ["TV_SATELLITE_SERVICE"],
"TVTerrestrialAnalog": ["TV_TERRESTRIAL_ANALOG"],
"TVTerrestrialDigital": ["TV_TERRESTRIAL_DIGITAL"],
"TVTimer": ["TV_TIMER_PROGRAMMING"],
"Undo": ["UNDO"],
"WakeUp": ["WAKEUP"],
"ZenkakuHankaku": ["ZENKAKU_HANKAKU"],
"ZoomIn": ["ZOOM_IN"],
"ZoomOut": ["ZOOM_OUT"],
"ZoomToggle": ["TV_ZOOM_MODE"]
}
// Copyright 2014 The Flutter Authors. All rights reserved.
package io.flutter.embedding.android;
// 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>
// 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 dev/tools/gen_keycodes/data/keyboard_map_android_cc.tmpl instead.
// Edit the template dev/tools/gen_keycodes/data/android_keyboard_map_java.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
/// Maps XKB specific key code values representing [PhysicalKeyboardKey].
const std::map<int, int> g_xkb_to_physical_key = {
@@@XKB_SCAN_CODE_MAP@@@
};
import java.util.HashMap;
public class KeyboardMap {
public static final HashMap<Long, Long> scanCodeToPhysical =
new HashMap<Long, Long>() {
private static final long serialVersionUID = 1L;
{
@@@ANDROID_SCAN_CODE_MAP@@@
}
};
public static final HashMap<Long, Long> keyCodeToLogical =
new HashMap<Long, Long>() {
private static final long serialVersionUID = 1L;
{
@@@ANDROID_KEY_CODE_MAP@@@
}
};
}
{
"Shift": ["ShiftLeft", "ShiftRight"],
"Meta": ["MetaLeft", "MetaRight"],
"Alt": ["AltLeft", "AltRight"],
"Control": ["ControlLeft", "ControlRight"]
}
......@@ -8,7 +8,7 @@
// 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_fuchsia_cc.tmpl instead.
// Edit the template dev/tools/gen_keycodes/data/fuchsia_keyboard_map_cc.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
/// Maps Fuchsia-specific IDs to the matching LogicalKeyboardKey.
......
{
"AltLeft": ["LEFT_ALT"],
"AltRight": ["RIGHT_ALT"],
"ArrowDown": ["DOWN"],
"ArrowLeft": ["LEFT"],
"ArrowRight": ["RIGHT"],
"ArrowUp": ["UP"],
"Backquote": ["GRAVE_ACCENT"],
"Backslash": ["BACKSLASH"],
"Backspace": ["BACKSPACE"],
"BracketLeft": ["LEFT_BRACKET"],
"BracketRight": ["RIGHT_BRACKET"],
"CapsLock": ["CAPS_LOCK"],
"Comma": ["COMMA"],
"ContextMenu": ["MENU"],
"ControlLeft": ["LEFT_CONTROL"],
"ControlRight": ["RIGHT_CONTROL"],
"Delete": ["DELETE"],
"Digit0": ["0"],
"Digit1": ["1"],
"Digit2": ["2"],
"Digit3": ["3"],
"Digit4": ["4"],
"Digit5": ["5"],
"Digit6": ["6"],
"Digit7": ["7"],
"Digit8": ["8"],
"Digit9": ["9"],
"End": ["END"],
"Enter": ["ENTER"],
"Equal": ["EQUAL"],
"Escape": ["ESCAPE"],
"F1": ["F1"],
"F2": ["F2"],
"F3": ["F3"],
"F4": ["F4"],
"F5": ["F5"],
"F6": ["F6"],
"F7": ["F7"],
"F8": ["F8"],
"F9": ["F9"],
"F10": ["F10"],
"F11": ["F11"],
"F12": ["F12"],
"F13": ["F13"],
"F14": ["F14"],
"F15": ["F15"],
"F16": ["F16"],
"F17": ["F17"],
"F18": ["F18"],
"F19": ["F19"],
"F20": ["F20"],
"F21": ["F21"],
"F22": ["F22"],
"F23": ["F23"],
"F25": ["F25"],
"Home": ["HOME"],
"Insert": ["INSERT"],
"KeyA": ["A"],
"KeyB": ["B"],
"KeyC": ["C"],
"KeyD": ["D"],
"KeyE": ["E"],
"KeyF": ["F"],
"KeyG": ["G"],
"KeyH": ["H"],
"KeyI": ["I"],
"KeyJ": ["J"],
"KeyK": ["K"],
"KeyL": ["L"],
"KeyM": ["M"],
"KeyN": ["N"],
"KeyO": ["O"],
"KeyP": ["P"],
"KeyQ": ["Q"],
"KeyR": ["R"],
"KeyS": ["S"],
"KeyT": ["T"],
"KeyU": ["U"],
"KeyV": ["V"],
"KeyW": ["W"],
"KeyX": ["X"],
"KeyY": ["Y"],
"KeyZ": ["Z"],
"MetaLeft": ["LEFT_SUPER"],
"MetaRight": ["RIGHT_SUPER"],
"Minus": ["MINUS"],
"NumLock": ["NUM_LOCK"],
"Numpad0": ["KP_0"],
"Numpad1": ["KP_1"],
"Numpad2": ["KP_2"],
"Numpad3": ["KP_3"],
"Numpad4": ["KP_4"],
"Numpad5": ["KP_5"],
"Numpad6": ["KP_6"],
"Numpad7": ["KP_7"],
"Numpad8": ["KP_8"],
"Numpad9": ["KP_9"],
"NumpadAdd": ["KP_ADD"],
"NumpadDecimal": ["KP_DECIMAL"],
"NumpadDivide": ["KP_DIVIDE"],
"NumpadEnter": ["KP_ENTER"],
"NumpadEqual": ["KP_EQUAL"],
"NumpadMultiply": ["KP_MULTIPLY"],
"NumpadSubtract": ["NUMPAD_SUBTRACT"],
"PageDown": ["PAGE_DOWN"],
"PageUp": ["PAGE_UP"],
"Pause": ["PAUSE"],
"Period": ["PERIOD"],
"PrintScreen": ["PRINT_SCREEN"],
"Quote": ["APOSTROPHE"],
"Semicolon": ["SEMICOLON"],
"ShiftLeft": ["LEFT_SHIFT"],
"ShiftRight": ["RIGHT_SHIFT"],
"Slash": ["SLASH"],
"Space": ["SPACE"],
"Tab": ["TAB"]
}
......@@ -8,7 +8,7 @@
// 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_glfw_cc.tmpl instead.
// Edit the template dev/tools/gen_keycodes/data/glfw_keyboard_map_cc.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
/// Maps GLFW-specific key codes to the matching [LogicalKeyboardKey].
......
// 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 "key_mapping.h"
#include <glib.h>
#include <map>
#include "flutter/shell/platform/linux/fl_key_embedder_responder_private.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 dev/tools/gen_keycodes/data/gtk_key_mapping_cc.tmpl
// instead. See dev/tools/gen_keycodes/README.md for more information.
// Insert a new entry into a hashtable from uint64 to uint64.
//
// Returns whether the newly added value was already in the hash table or not.
static bool insert_record(GHashTable* table, guint64 xkb, guint64 fl_key) {
return g_hash_table_insert(table, uint64_to_gpointer(xkb),
uint64_to_gpointer(fl_key));
}
void initialize_xkb_to_physical_key(GHashTable* table) {
@@@XKB_SCAN_CODE_MAP@@@
}
void initialize_gtk_keyval_to_logical_key(GHashTable* table) {
@@@GTK_KEYVAL_CODE_MAP@@@
}
void initialize_modifier_bit_to_checked_keys(GHashTable* table) {
FlKeyEmbedderCheckedKey* data;
@@@GTK_MODIFIER_BIT_MAP@@@
}
void initialize_lock_bit_to_checked_keys(GHashTable* table) {
FlKeyEmbedderCheckedKey* data;
@@@GTK_MODE_BIT_MAP@@@
}
{
"LOCK": ["CapsLock", "CapsLock"],
"MOD2": ["NumLock", "NumLock"]
}
{
"NumpadAdd": ["KP_Add"],
"NumpadMultiply": ["KP_Multiply"],
"NumpadSubtract": ["KP_Subtract"],
"NumpadDivide": ["KP_Divide"],
"Space": ["KP_Space"],
"Period": ["KP_Decimal"],
"NumpadEqual": ["KP_Equal"],
"Numpad0": ["KP_0", "KP_Insert"],
"Numpad1": ["KP_1", "KP_End"],
"Numpad2": ["KP_2", "KP_Down"],
"Numpad3": ["KP_3", "KP_Page_Down"],
"Numpad4": ["KP_4", "KP_Left"],
"Numpad5": ["KP_5"],
"Numpad6": ["KP_6", "KP_Right"],
"Numpad7": ["KP_7", "KP_Home"],
"Numpad8": ["KP_8", "KP_Up"],
"Numpad9": ["KP_9", "KP_Page_Up"],
"NumpadDecimal": ["KP_Period", "KP_Delete"],
"NumpadEnter": ["KP_Enter"],
"AltLeft": ["Alt_L"],
"AltRight": ["Alt_R", "ISO_Level3_Shift"],
"ArrowDown": ["Down"],
"ArrowLeft": ["Left"],
"ArrowRight": ["Right"],
"ArrowUp": ["Up"],
"Attn": ["3270_Attn"],
"AudioVolumeDown": ["AudioLowerVolume"],
"AudioVolumeMute": ["AudioMute"],
"AudioVolumeUp": ["AudioRaiseVolume"],
"Backspace": ["BackSpace"],
"BrightnessDown": ["MonBrightnessDown"],
"BrightnessUp": ["MonBrightnessUp"],
"BrowserBack": ["Back"],
"BrowserFavorites": ["Favorites"],
"BrowserFavourites": ["Favourites"],
"BrowserForward": ["Forward"],
"BrowserHome": ["HomePage"],
"BrowserRefresh": ["Refresh"],
"BrowserSearch": ["Search"],
"BrowserStop": ["Stop"],
"Cancel": ["Cancel"],
"CapsLock": ["Caps_Lock"],
"Clear": ["Clear"],
"Close": ["Close"],
"CodeInput": ["Codeinput"],
"ContextMenu": ["Menu"],
"ControlLeft": ["Control_L"],
"ControlRight": ["Control_R"],
"Copy": ["Copy", "3270_Copy"],
"Cut": ["Cut"],
"Delete": ["Delete"],
"Eisu": ["Eisu_Shift"],
"Eject": ["Eject"],
"End": ["End"],
"Enter": ["Return", "3270_Enter", "ISO_Enter"],
"EraseEof": ["3270_EraseEOF"],
"Escape": ["Escape"],
"ExSel": ["3270_ExSelect"],
"Execute": ["Execute"],
"F1": ["F1", "KP_F1"],
"F2": ["F2", "KP_F2"],
"F3": ["F3", "KP_F3"],
"F4": ["F4", "KP_F4"],
"F5": ["F5"],
"F6": ["F6"],
"F7": ["F7"],
"F8": ["F8"],
"F9": ["F9"],
"F10": ["F10"],
"F11": ["F11"],
"F12": ["F12"],
"F13": ["F13"],
"F14": ["F14"],
"F15": ["F15"],
"F16": ["F16"],
"F17": ["F17"],
"F18": ["F18"],
"F19": ["F19"],
"F20": ["F20"],
"F21": ["F21"],
"F22": ["F22"],
"F23": ["F23"],
"F24": ["F24"],
"F25": ["F25"],
"Find": ["Find"],
"GroupFirst": ["ISO_First_Group"],
"GroupLast": ["ISO_Last_Group"],
"GroupNext": ["ISO_Next_Group"],
"GroupPrevious": ["ISO_Prev_Group"],
"HangulMode": ["Hangul"],
"HanjaMode": ["Hangul_Hanja"],
"Hankaku": ["Hankaku"],
"Help": ["Help"],
"Hiragana": ["Hiragana"],
"HiraganaKatakana": ["Hiragana_Katakana"],
"Home": ["Home"],
"Hybernate": ["Hybernate"],
"Hyper": ["Hyper_L", "Hyper_R"],
"Insert": ["Insert"],
"IntlYen": ["yen"],
"KanjiMode": ["Kanji"],
"Katakana": ["Katakana"],
"KbdIllumDown": ["KbdBrightnessDown"],
"KbdIllumUp": ["KbdBrightnessUp"],
"LaunchAudioBrowser": ["Music"],
"LaunchCalendar": ["Calendar"],
"LaunchDocuments": ["Document"],
"LaunchInternetBrowser": ["WWW"],
"LaunchMail": ["Mail"],
"LaunchPhone": ["Phone"],
"LaunchScreenSaver": ["ScreenSaver"],
"LogOff": ["LogOff"],
"MailForward": ["MailForward"],
"MailReply": ["Reply"],
"MailSend": ["Send"],
"MediaFastForward": ["AudioForward"],
"MediaPause": ["AudioPause"],
"MediaPlay": ["AudioPlay", "3270_Play"],
"MediaRecord": ["AudioRecord"],
"MediaRewind": ["AudioRewind"],
"MediaStop": ["AudioStop"],
"MediaTrackNext": ["AudioNext"],
"MediaTrackPrevious": ["AudioPrev"],
"MetaLeft": ["Meta_L"],
"MetaRight": ["Meta_R"],
"ModeChange": ["Mode_switch"],
"New": ["New"],
"NumLock": ["Num_Lock"],
"Open": ["Open"],
"PageDown": ["Page_Down"],
"PageUp": ["Page_Up"],
"Paste": ["Paste"],
"Pause": ["Pause"],
"PowerOff": ["PowerOff"],
"PreviousCandidate": ["PreviousCandidate"],
"Print": ["Print"],
"PrintScreen": ["3270_PrintScreen"],
"Redo": ["Redo"],
"Resume": ["Resume"],
"Romaji": ["Romaji"],
"Save": ["Save"],
"ScrollLock": ["Scroll_Lock"],
"Select": ["Select"],
"ShiftLeft": ["Shift_L"],
"ShiftRight": ["Shift_R"],
"SingleCandidate": ["SingleCandidate"],
"Sleep": ["Sleep"],
"SpellCheck": ["Spell"],
"Standby": ["Standby"],
"Super": ["Super_L", "Super_R"],
"Suspend": ["Suspend"],
"Tab": ["Tab", "KP_Tab", "ISO_Left_Tab"],
"Undo": ["Undo"],
"WakeUp": ["WakeUp"],
"Zenkaku": ["Zenkaku"],
"ZenkakuHankaku": ["Zenkaku_Hankaku"],
"ZoomIn": ["ZoomIn"],
"ZoomOut": ["ZoomOut"]
}
{
"SHIFT": ["ShiftLeft", "ShiftLeft", "ShiftRight"],
"CONTROL": ["ControlLeft", "ControlLeft", "ControlRight"],
"MOD1": ["AltLeft", "AltLeft", "AltRight"],
"META": ["MetaLeft", "MetaLeft", "MetaRight"]
}
{
"Numpad0": "NumpadInsert",
"Numpad1": "NumpadEnd",
"Numpad2": "NumpadDown",
"Numpad3": "NumpadPageDown",
"Numpad4": "NumpadLeft",
"Numpad6": "NumpadRight",
"Numpad7": "NumpadHome",
"Numpad8": "NumpadUp",
"Numpad9": "NumpadPageUp",
"NumpadPeriod": "NumpadDelete"
}
......@@ -8,7 +8,7 @@
// 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_ios_cc.tmpl instead.
// Edit the template dev/tools/gen_keycodes/data/ios_keyboard_map_cc.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
// Maps macOS-specific key code values representing [PhysicalKeyboardKey].
......
{
"Backspace": ["Backspace"],
"Escape": ["Escape"],
"CapsLock": ["CapsLock"],
"NumLock": ["NumLock"],
"ArrowDown": ["ArrowDown"],
"ArrowLeft": ["ArrowLeft"],
"ArrowRight": ["ArrowRight"],
"ArrowUp": ["ArrowUp"],
"End": ["End"],
"Home": ["Home"],
"PageDown": ["PageDown"],
"PageUp": ["PageUp"],
"Insert": ["Insert"],
"Delete": ["Delete"],
"ContextMenu": ["ContextMenu"],
"F1": ["F1"],
"F2": ["F2"],
"F3": ["F3"],
"F4": ["F4"],
"F5": ["F5"],
"F6": ["F6"],
"F7": ["F7"],
"F8": ["F8"],
"F9": ["F9"],
"F10": ["F10"],
"F11": ["F11"],
"F12": ["F12"],
"F13": ["F13"],
"F14": ["F14"],
"F15": ["F15"],
"F16": ["F16"],
"F17": ["F17"],
"F18": ["F18"],
"F19": ["F19"],
"F20": ["F20"],
"NumpadEnter": ["NumpadEnter"],
"NumpadMultiply": ["NumpadMultiply"],
"NumpadAdd": ["NumpadAdd"],
"NumpadComma": ["NumpadComma"],
"NumpadSubtract": ["NumpadSubtract"],
"NumpadDecimal": ["NumpadDecimal"],
"NumpadDivide": ["NumpadDivide"],
"Numpad0": ["Numpad0"],
"Numpad1": ["Numpad1"],
"Numpad2": ["Numpad2"],
"Numpad3": ["Numpad3"],
"Numpad4": ["Numpad4"],
"Numpad5": ["Numpad5"],
"Numpad6": ["Numpad6"],
"Numpad7": ["Numpad7"],
"Numpad8": ["Numpad8"],
"Numpad9": ["Numpad9"],
"NumpadEqual": ["NumpadEqual"],
"AltLeft": ["AltLeft"],
"ControlLeft": ["ControlLeft"],
"MetaLeft": ["MetaLeft"],
"ShiftLeft": ["ShiftLeft"],
"AltRight": ["AltRight"],
"ControlRight": ["ControlRight"],
"MetaRight": ["MetaRight"],
"ShiftRight": ["ShiftRight"],
"Lang1": ["Lang1"],
"Lang2": ["Lang2"],
"Lang3": ["Lang3"],
"Lang4": ["Lang4"],
"Lang5": ["Lang5"],
"IntlYen": ["IntlYen"],
"IntlRo": ["IntlRo"],
"AudioVolumeUp": ["AudioVolumeUp"],
"AudioVolumeDown": ["AudioVolumeDown"],
"AudioVolumeMute": ["AudioVolumeMute"]
}
{
"again": ["AGAIN"],
"altLeft": ["ALT_LEFT"],
"altRight": ["ALT_RIGHT"],
"appSwitch": ["APP_SWITCH"],
"arrowDown": ["DPAD_DOWN"],
"arrowLeft": ["DPAD_LEFT"],
"arrowRight": ["DPAD_RIGHT"],
"arrowUp": ["DPAD_UP"],
"audioVolumeDown": ["VOLUME_DOWN"],
"audioVolumeMute": ["VOLUME_MUTE"],
"audioVolumeUp": ["VOLUME_UP"],
"avrInput": ["AVR_INPUT"],
"avrPower": ["AVR_POWER"],
"bassBoost": ["BASSBOOST"],
"print": ["PRINT"],
"backquote": ["GRAVE"],
"backslash": ["BACKSLASH"],
"backspace": ["DEL"],
"bracketLeft": ["LEFT_BRACKET"],
"bracketRight": ["RIGHT_BRACKET"],
"brightnessDown": ["BRIGHTNESS_DOWN"],
"brightnessUp": ["BRIGHTNESS_UP"],
"browserFavorites": ["BOOKMARK"],
"browserForward": ["FORWARD"],
"browserSearch": ["SEARCH"],
"call": ["CALL"],
"camera": ["CAMERA"],
"cameraFocus": ["FOCUS"],
"capsLock": ["CAPS_LOCK"],
"channelDown": ["CHANNEL_DOWN"],
"channelUp": ["CHANNEL_UP"],
"clear": ["CLEAR"],
"close": ["MEDIA_CLOSE", "CLOSE"],
"closedCaptionToggle": ["CAPTIONS"],
"colorF0Red": ["PROG_RED"],
"colorF1Green": ["PROG_GREEN"],
"colorF2Yellow": ["PROG_YELLOW"],
"colorF3Blue": ["PROG_BLUE"],
"comma": ["COMMA"],
"contextMenu": ["MENU"],
"controlLeft": ["CTRL_LEFT"],
"controlRight": ["CTRL_RIGHT"],
"convert": ["HENKAN"],
"copy": ["COPY"],
"cut": ["CUT"],
"delete": ["FORWARD_DEL"],
"digit0": ["0"],
"digit1": ["1"],
"digit2": ["2"],
"digit3": ["3"],
"digit4": ["4"],
"digit5": ["5"],
"digit6": ["6"],
"digit7": ["7"],
"digit8": ["8"],
"digit9": ["9"],
"dvr": ["DVR"],
"eisu": ["EISU"],
"eject": ["MEDIA_EJECT"],
"end": ["MOVE_END"],
"endCall": ["ENDCALL"],
"enter": ["ENTER"],
"equal": ["EQUALS"],
"escape": ["ESCAPE"],
"exit": ["EXIT"],
"f1": ["F1"],
"f2": ["F2"],
"f3": ["F3"],
"f4": ["F4"],
"f5": ["F5"],
"f6": ["F6"],
"f7": ["F7"],
"f8": ["F8"],
"f9": ["F9"],
"f10": ["F10"],
"f11": ["F11"],
"f12": ["F12"],
"f13": ["F13"],
"f14": ["F14"],
"f15": ["F15"],
"f16": ["F16"],
"f17": ["F17"],
"f18": ["F18"],
"f19": ["F19"],
"f20": ["F20"],
"f21": ["F21"],
"f22": ["F22"],
"f23": ["F23"],
"f24": ["F24"],
"find": ["FIND"],
"fn": ["FUNCTION"],
"gameButton1": ["BUTTON_1"],
"gameButton2": ["BUTTON_2"],
"gameButton3": ["BUTTON_3"],
"gameButton4": ["BUTTON_4"],
"gameButton5": ["BUTTON_5"],
"gameButton6": ["BUTTON_6"],
"gameButton7": ["BUTTON_7"],
"gameButton8": ["BUTTON_8"],
"gameButton9": ["BUTTON_9"],
"gameButton10": ["BUTTON_10"],
"gameButton11": ["BUTTON_11"],
"gameButton12": ["BUTTON_12"],
"gameButton13": ["BUTTON_13"],
"gameButton14": ["BUTTON_14"],
"gameButton15": ["BUTTON_15"],
"gameButton16": ["BUTTON_16"],
"gameButtonA": ["BUTTON_A"],
"gameButtonB": ["BUTTON_B"],
"gameButtonC": ["BUTTON_C"],
"gameButtonLeft1": ["BUTTON_L1"],
"gameButtonLeft2": ["BUTTON_L2"],
"gameButtonMode": ["BUTTON_MODE"],
"gameButtonRight1": ["BUTTON_R1"],
"gameButtonRight2": ["BUTTON_R2"],
"gameButtonSelect": ["BUTTON_SELECT"],
"gameButtonStart": ["BUTTON_START"],
"gameButtonThumbLeft": ["BUTTON_THUMBL"],
"gameButtonThumbRight": ["BUTTON_THUMBR"],
"gameButtonX": ["BUTTON_X"],
"gameButtonY": ["BUTTON_Y"],
"gameButtonZ": ["BUTTON_Z"],
"goBack": ["BACK"],
"goHome": ["HOME"],
"groupNext": ["LANGUAGE_SWITCH"],
"guide": ["GUIDE"],
"headsetHook": ["HEADSETHOOK"],
"help": ["HELP"],
"hiraganaKatakana": ["KATAKANA_HIRAGANA"],
"home": ["MOVE_HOME"],
"info": ["INFO"],
"insert": ["INSERT"],
"kanjiMode": ["KANA"],
"keyA": ["A"],
"keyB": ["B"],
"keyC": ["C"],
"keyD": ["D"],
"keyE": ["E"],
"keyF": ["F"],
"keyG": ["G"],
"keyH": ["H"],
"keyI": ["I"],
"keyJ": ["J"],
"keyK": ["K"],
"keyL": ["L"],
"keyM": ["M"],
"keyN": ["N"],
"keyO": ["O"],
"keyP": ["P"],
"keyQ": ["Q"],
"keyR": ["R"],
"keyS": ["S"],
"keyT": ["T"],
"keyU": ["U"],
"keyV": ["V"],
"keyW": ["W"],
"keyX": ["X"],
"keyY": ["Y"],
"keyZ": ["Z"],
"lang3": ["KATAKANA"],
"lang4": ["HIRAGANA"],
"launchAssistant": ["ASSIST"],
"launchCalculator": ["CALCULATOR"],
"launchCalendar": ["CALENDAR"],
"launchContacts": ["CONTACTS"],
"launchMail": ["ENVELOPE"],
"launchMusicPlayer": ["MUSIC"],
"launchWebBrowser": ["EXPLORER"],
"mannerMode": ["MANNER_MODE"],
"mediaAudioTrack": ["MEDIA_AUDIO_TRACK"],
"mediaFastForward": ["MEDIA_FAST_FORWARD"],
"mediaLast": ["LAST_CHANNEL"],
"mediaPause": ["MEDIA_PAUSE"],
"mediaPlay": ["MEDIA_PLAY"],
"mediaPlayPause": ["MEDIA_PLAY_PAUSE"],
"mediaRecord": ["MEDIA_RECORD"],
"mediaRewind": ["MEDIA_REWIND"],
"mediaSkipBackward": ["MEDIA_SKIP_BACKWARD"],
"mediaSkipForward": ["MEDIA_SKIP_FORWARD"],
"mediaStepBackward": ["MEDIA_STEP_BACKWARD"],
"mediaStepForward": ["MEDIA_STEP_FORWARD"],
"mediaStop": ["MEDIA_STOP"],
"mediaTopMenu": ["MEDIA_TOP_MENU"],
"mediaTrackNext": ["MEDIA_NEXT"],
"mediaTrackPrevious": ["MEDIA_PREVIOUS"],
"metaLeft": ["META_LEFT"],
"metaRight": ["META_RIGHT"],
"microphoneVolumeMute": ["MUTE"],
"minus": ["MINUS"],
"modeChange": ["SWITCH_CHARSET"],
"navigateIn": ["NAVIGATE_IN"],
"navigateNext": ["NAVIGATE_NEXT"],
"navigateOut": ["NAVIGATE_OUT"],
"navigatePrevious": ["NAVIGATE_PREVIOUS"],
"newKey": ["NEW"],
"nonConvert": ["MUHENKAN"],
"none": ["UNKNOWN"],
"notification": ["NOTIFICATION"],
"numLock": ["NUM_LOCK"],
"numpad0": ["NUMPAD_0"],
"numpad1": ["NUMPAD_1"],
"numpad2": ["NUMPAD_2"],
"numpad3": ["NUMPAD_3"],
"numpad4": ["NUMPAD_4"],
"numpad5": ["NUMPAD_5"],
"numpad6": ["NUMPAD_6"],
"numpad7": ["NUMPAD_7"],
"numpad8": ["NUMPAD_8"],
"numpad9": ["NUMPAD_9"],
"numpadAdd": ["NUMPAD_ADD"],
"numpadComma": ["NUMPAD_COMMA"],
"numpadDecimal": ["NUMPAD_DOT"],
"numpadDivide": ["NUMPAD_DIVIDE"],
"numpadEnter": ["NUMPAD_ENTER"],
"numpadEqual": ["NUMPAD_EQUALS"],
"numpadMultiply": ["NUMPAD_MULTIPLY"],
"numpadParenLeft": ["NUMPAD_LEFT_PAREN"],
"numpadParenRight": ["NUMPAD_RIGHT_PAREN"],
"numpadSubtract": ["NUMPAD_SUBTRACT"],
"open": ["OPEN"],
"pageDown": ["PAGE_DOWN"],
"pageUp": ["PAGE_UP"],
"pairing": ["PAIRING"],
"paste": ["PASTE"],
"pause": ["BREAK"],
"period": ["PERIOD"],
"power": ["POWER"],
"printScreen": ["SYSRQ"],
"props": ["PROPS"],
"quote": ["APOSTROPHE"],
"redo": ["REDO"],
"scrollLock": ["SCROLL_LOCK"],
"select": ["DPAD_CENTER"],
"semicolon": ["SEMICOLON"],
"settings": ["SETTINGS"],
"shiftLeft": ["SHIFT_LEFT"],
"shiftRight": ["SHIFT_RIGHT"],
"slash": ["SLASH"],
"sleep": ["SLEEP"],
"space": ["SPACE"],
"standby": ["SLEEP"],
"stbInput": ["STB_INPUT"],
"stbPower": ["STB_POWER"],
"suspend": ["SUSPEND"],
"symbol": ["SYM"],
"tab": ["TAB"],
"teletext": ["TV_TELETEXT"],
"tv": ["TV"],
"tv3dMode": ["3D_MODE"],
"tvAntennaCable": ["TV_ANTENNA_CABLE"],
"tvAudioDescription": ["TV_AUDIO_DESCRIPTION"],
"tvAudioDescriptionMixDown": ["TV_AUDIO_DESCRIPTION_MIX_DOWN"],
"tvAudioDescriptionMixUp": ["TV_AUDIO_DESCRIPTION_MIX_UP"],
"tvContentsMenu": ["TV_CONTENTS_MENU"],
"tvDataService": ["TV_DATA_SERVICE"],
"tvInput": ["TV_INPUT"],
"tvInputComponent1": ["TV_INPUT_COMPONENT_1"],
"tvInputComponent2": ["TV_INPUT_COMPONENT_2"],
"tvInputComposite1": ["TV_INPUT_COMPOSITE_1"],
"tvInputComposite2": ["TV_INPUT_COMPOSITE_2"],
"tvInputHdmi1": ["TV_INPUT_HDMI_1"],
"tvInputHdmi2": ["TV_INPUT_HDMI_2"],
"tvInputHdmi3": ["TV_INPUT_HDMI_3"],
"tvInputHdmi4": ["TV_INPUT_HDMI_4"],
"tvInputVga1": ["TV_INPUT_VGA_1"],
"tvNetwork": ["TV_NETWORK"],
"tvNumberEntry": ["TV_NUMBER_ENTRY"],
"tvPower": ["TV_POWER"],
"tvRadioService": ["TV_RADIO_SERVICE"],
"tvSatellite": ["TV_SATELLITE"],
"tvSatelliteBs": ["TV_SATELLITE_BS"],
"tvSatelliteCs": ["TV_SATELLITE_CS"],
"tvSatelliteToggle": ["TV_SATELLITE_SERVICE"],
"tvTerrestrialAnalog": ["TV_TERRESTRIAL_ANALOG"],
"tvTerrestrialDigital": ["TV_TERRESTRIAL_DIGITAL"],
"tvTimer": ["TV_TIMER_PROGRAMMING"],
"undo": ["UNDO"],
"wakeUp": ["WAKEUP"],
"zenkakuHankaku": ["ZENKAKU_HANKAKU"],
"zoomIn": ["ZOOM_IN"],
"zoomOut": ["ZOOM_OUT"],
"zoomToggle": ["TV_ZOOM_MODE"]
}
{
"altLeft": ["LEFT_ALT"],
"altRight": ["RIGHT_ALT"],
"arrowDown": ["DOWN"],
"arrowLeft": ["LEFT"],
"arrowRight": ["RIGHT"],
"arrowUp": ["UP"],
"backquote": ["GRAVE_ACCENT"],
"backslash": ["BACKSLASH"],
"backspace": ["BACKSPACE"],
"bracketLeft": ["LEFT_BRACKET"],
"bracketRight": ["RIGHT_BRACKET"],
"capsLock": ["CAPS_LOCK"],
"comma": ["COMMA"],
"contextMenu": ["MENU"],
"controlLeft": ["LEFT_CONTROL"],
"controlRight": ["RIGHT_CONTROL"],
"delete": ["DELETE"],
"digit0": ["0"],
"digit1": ["1"],
"digit2": ["2"],
"digit3": ["3"],
"digit4": ["4"],
"digit5": ["5"],
"digit6": ["6"],
"digit7": ["7"],
"digit8": ["8"],
"digit9": ["9"],
"end": ["END"],
"enter": ["ENTER"],
"equal": ["EQUAL"],
"escape": ["ESCAPE"],
"f1": ["F1"],
"f2": ["F2"],
"f3": ["F3"],
"f4": ["F4"],
"f5": ["F5"],
"f6": ["F6"],
"f7": ["F7"],
"f8": ["F8"],
"f9": ["F9"],
"f10": ["F10"],
"f11": ["F11"],
"f12": ["F12"],
"f13": ["F13"],
"f14": ["F14"],
"f15": ["F15"],
"f16": ["F16"],
"f17": ["F17"],
"f18": ["F18"],
"f19": ["F19"],
"f20": ["F20"],
"f21": ["F21"],
"f22": ["F22"],
"f23": ["F23"],
"f25": ["F25"],
"home": ["HOME"],
"insert": ["INSERT"],
"keyA": ["A"],
"keyB": ["B"],
"keyC": ["C"],
"keyD": ["D"],
"keyE": ["E"],
"keyF": ["F"],
"keyG": ["G"],
"keyH": ["H"],
"keyI": ["I"],
"keyJ": ["J"],
"keyK": ["K"],
"keyL": ["L"],
"keyM": ["M"],
"keyN": ["N"],
"keyO": ["O"],
"keyP": ["P"],
"keyQ": ["Q"],
"keyR": ["R"],
"keyS": ["S"],
"keyT": ["T"],
"keyU": ["U"],
"keyV": ["V"],
"keyW": ["W"],
"keyX": ["X"],
"keyY": ["Y"],
"keyZ": ["Z"],
"metaLeft": ["LEFT_SUPER"],
"metaRight": ["RIGHT_SUPER"],
"minus": ["MINUS"],
"numLock": ["NUM_LOCK"],
"numpad0": ["KP_0"],
"numpad1": ["KP_1"],
"numpad2": ["KP_2"],
"numpad3": ["KP_3"],
"numpad4": ["KP_4"],
"numpad5": ["KP_5"],
"numpad6": ["KP_6"],
"numpad7": ["KP_7"],
"numpad8": ["KP_8"],
"numpad9": ["KP_9"],
"numpadAdd": ["KP_ADD"],
"numpadDecimal": ["KP_DECIMAL"],
"numpadDivide": ["KP_DIVIDE"],
"numpadEnter": ["KP_ENTER"],
"numpadEqual": ["KP_EQUAL"],
"numpadMultiply": ["KP_MULTIPLY"],
"numpadSubtract": ["NUMPAD_SUBTRACT"],
"pageDown": ["PAGE_DOWN"],
"pageUp": ["PAGE_UP"],
"pause": ["PAUSE"],
"period": ["PERIOD"],
"printScreen": ["PRINT_SCREEN"],
"quote": ["APOSTROPHE"],
"semicolon": ["SEMICOLON"],
"shiftLeft": ["LEFT_SHIFT"],
"shiftRight": ["RIGHT_SHIFT"],
"slash": ["SLASH"],
"space": ["SPACE"],
"tab": ["TAB"]
}
{
"altLeft": ["Alt_L"],
"altRight": ["Alt_R", "ISO_Level3_Shift"],
"arrowDown": ["Down", "KP_Down"],
"arrowLeft": ["Left", "KP_Left"],
"arrowRight": ["Right", "KP_Right"],
"arrowUp": ["Up", "KP_Up"],
"audioVolumeDown": ["AudioLowerVolume"],
"audioVolumeMute": ["AudioMute"],
"audioVolumeUp": ["AudioRaiseVolume"],
"backquote": ["quoteleft"],
"backslash": ["backslash"],
"backspace": ["BackSpace"],
"bracketLeft": ["bracketleft"],
"bracketRight": ["bracketright"],
"brightnessDown": ["MonBrightnessDown"],
"brightnessUp": ["MonBrightnessUp"],
"browserBack": ["Back"],
"browserFavorites": ["Favorites"],
"browserFavourites": ["Favourites"],
"browserForward": ["Forward"],
"browserHome": ["HomePage"],
"browserRefresh": ["Refresh"],
"browserSearch": ["Search"],
"browserStop": ["Stop"],
"capsLock": ["Caps_Lock"],
"close": ["Close"],
"comma": ["comma"],
"contextMenu": ["Menu"],
"controlLeft": ["Control_L"],
"controlRight": ["Control_R"],
"copy": ["Copy", "3270_Copy"],
"delete": ["Delete", "KP_Delete"],
"digit0": ["0"],
"digit1": ["1"],
"digit2": ["2"],
"digit3": ["3"],
"digit4": ["4"],
"digit5": ["5"],
"digit6": ["6"],
"digit7": ["7"],
"digit8": ["8"],
"digit9": ["9"],
"eject": ["Eject"],
"end": ["End", "KP_End"],
"enter": ["Return", "Enter", "ISO_Enter"],
"equal": ["equal"],
"escape": ["Escape"],
"f1": ["F1", "KP_F1"],
"f2": ["F2", "KP_F2"],
"f3": ["F3", "KP_F3"],
"f4": ["F4", "KP_F4"],
"f5": ["F5"],
"f6": ["F6"],
"f7": ["F7"],
"f8": ["F8"],
"f9": ["F9"],
"f10": ["F10"],
"f11": ["F11"],
"f12": ["F12"],
"f13": ["F13"],
"f14": ["F14"],
"f15": ["F15"],
"f16": ["F16"],
"f17": ["F17"],
"f18": ["F18"],
"f19": ["F19"],
"f20": ["F20"],
"f21": ["F21"],
"f22": ["F22"],
"f23": ["F23"],
"f24": ["F24"],
"f25": ["F25"],
"find": ["Find"],
"help": ["Help"],
"home": ["Home", "KP_Home"],
"hyper": ["Hyper_L", "Hyper_R"],
"insert": ["Insert", "KP_Insert"],
"intlYen": ["yen"],
"kanaMode": ["kana_switch"],
"kbdIllumDown": ["KbdBrightnessDown"],
"kbdIllumUp": ["KbdBrightnessUp"],
"keyA": ["A"],
"keyB": ["B"],
"keyC": ["C"],
"keyD": ["D"],
"keyE": ["E"],
"keyF": ["F"],
"keyG": ["G"],
"keyH": ["H"],
"keyI": ["I"],
"keyJ": ["J"],
"keyK": ["K"],
"keyL": ["L"],
"keyM": ["M"],
"keyN": ["N"],
"keyO": ["O"],
"keyP": ["P"],
"keyQ": ["Q"],
"keyR": ["R"],
"keyS": ["S"],
"keyT": ["T"],
"keyU": ["U"],
"keyV": ["V"],
"keyW": ["W"],
"keyX": ["X"],
"keyY": ["Y"],
"keyZ": ["Z"],
"launchAudioBrowser": ["Music"],
"launchCalendar": ["Calendar"],
"launchDocuments": ["Document"],
"launchInternetBrowser": ["WWW"],
"launchMail": ["Mail"],
"launchPhone": ["Phone"],
"launchScreenSaver": ["ScreenSaver"],
"logOff": ["LogOff"],
"mailForward": ["MailForward"],
"mailReply": ["Reply"],
"mailSend": ["Send"],
"mediaFastForward": ["AudioForward"],
"mediaPause": ["AudioPause"],
"mediaPlay": ["AudioPlay", "3270_Play"],
"mediaRecord": ["AudioRecord"],
"mediaRewind": ["AudioRewind"],
"mediaStop": ["AudioStop"],
"mediaTrackNext": ["AudioNext"],
"mediaTrackPrevious": ["AudioPrev"],
"metaLeft": ["Meta_L"],
"metaRight": ["Meta_R"],
"minus": ["minus"],
"newKey": ["New"],
"numLock": ["Num_Lock"],
"numpad0": ["KP_0"],
"numpad1": ["KP_1"],
"numpad2": ["KP_2"],
"numpad3": ["KP_3"],
"numpad4": ["KP_4"],
"numpad5": ["KP_5"],
"numpad6": ["KP_6"],
"numpad7": ["KP_7"],
"numpad8": ["KP_8"],
"numpad9": ["KP_9"],
"numpadAdd": ["KP_Add"],
"numpadDecimal": ["KP_Decimal"],
"numpadDivide": ["KP_Divide"],
"numpadEnter": ["KP_Enter"],
"numpadEqual": ["KP_Equal"],
"numpadMultiply": ["KP_Multiply"],
"numpadSubtract": ["KP_Subtract"],
"open": ["Open"],
"pageDown": ["Page_Down", "KP_Page_Down"],
"pageUp": ["Page_Up", "KP_Page_Up"],
"paste": ["Paste"],
"pause": ["Pause"],
"period": ["period"],
"power": ["PowerOff"],
"print": ["Print"],
"printScreen": ["3270_PrintScreen"],
"quote": ["apostrophe"],
"redo": ["Redo"],
"resume": ["Resume"],
"save": ["Save"],
"scrollLock": ["Scroll_Lock"],
"select": ["Select"],
"semicolon": ["semicolon"],
"shiftLeft": ["Shift_L"],
"shiftRight": ["Shift_R"],
"slash": ["slash"],
"sleep": ["Sleep"],
"space": ["space", "KP_Space"],
"spellCheck": ["Spell"],
"superKey": ["Super_L", "Super_R"],
"suspend": ["Suspend"],
"tab": ["Tab", "KP_Tab", "ISO_Left_Tab"],
"undo": ["Undo"],
"wakeUp": ["WakeUp"],
"zoomIn": ["ZoomIn"],
"zoomOut": ["ZoomOut"]
}
{
"leftMouseButton": ["LBUTTON"],
"rightMouseButton": ["RBUTTON"],
"cancel": ["CANCEL"],
"middleMouseButton": ["MBUTTON"],
"xMouseButton1": ["XBUTTON1"],
"xMouseButton2": ["XBUTTON2"],
"backspace": ["BACK"],
"tab": ["TAB"],
"clear": ["CLEAR"],
"enter": ["RETURN"],
"shift": ["SHIFT"],
"control": ["CONTROL"],
"menu": ["MENU"],
"pause": ["PAUSE"],
"capsLock": ["CAPITAL"],
"kana": ["KANA"],
"hangeul": ["HANGEUL"],
"hangul": ["HANGUL"],
"junja": ["JUNJA"],
"final": ["FINAL"],
"hanja": ["HANJA"],
"kanji": ["KANJI"],
"escape": ["ESCAPE"],
"convert": ["CONVERT"],
"nonconvert": ["NONCONVERT"],
"accept": ["ACCEPT"],
"modeChange": ["MODECHANGE"],
"space": ["SPACE"],
"prior": ["PRIOR"],
"next": ["NEXT"],
"end": ["END"],
"home": ["HOME"],
"arrowLeft": ["LEFT"],
"arrowUp": ["UP"],
"arrowRight": ["RIGHT"],
"arrowDown": ["DOWN"],
"select": ["SELECT"],
"print": ["PRINT"],
"execute": ["EXECUTE"],
"snapshot": ["SNAPSHOT"],
"insert": ["INSERT"],
"delete": ["DELETE"],
"help": ["HELP"],
"metaLeft": ["LWIN"],
"metaRight": ["RWIN"],
"apps": ["APPS"],
"sleep": ["SLEEP"],
"numpad0": ["NUMPAD0"],
"numpad1": ["NUMPAD1"],
"numpad2": ["NUMPAD2"],
"numpad3": ["NUMPAD3"],
"numpad4": ["NUMPAD4"],
"numpad5": ["NUMPAD5"],
"numpad6": ["NUMPAD6"],
"numpad7": ["NUMPAD7"],
"numpad8": ["NUMPAD8"],
"numpad9": ["NUMPAD9"],
"numpadMultiply": ["MULTIPLY"],
"numpadAdd": ["ADD"],
"numpadSeparator": ["SEPARATOR"],
"numpadSubtract": ["SUBTRACT"],
"numpadDecimal": ["DECIMAL"],
"numpadDivide": ["DIVIDE"],
"f1": ["F1"],
"f2": ["F2"],
"f3": ["F3"],
"f4": ["F4"],
"f5": ["F5"],
"f6": ["F6"],
"f7": ["F7"],
"f8": ["F8"],
"f9": ["F9"],
"f10": ["F10"],
"f11": ["F11"],
"f12": ["F12"],
"f13": ["F13"],
"f14": ["F14"],
"f15": ["F15"],
"f16": ["F16"],
"f17": ["F17"],
"f18": ["F18"],
"f19": ["F19"],
"f20": ["F20"],
"f21": ["F21"],
"f22": ["F22"],
"f23": ["F23"],
"f24": ["F24"],
"navigationView": ["NAVIGATION_VIEW"],
"navigationMenu": ["NAVIGATION_MENU"],
"navigationUp": ["NAVIGATION_UP"],
"navigationDown": ["NAVIGATION_DOWN"],
"navigationLeft": ["NAVIGATION_LEFT"],
"navigationRight": ["NAVIGATION_RIGHT"],
"navigationAccept": ["NAVIGATION_ACCEPT"],
"navigationCancel": ["NAVIGATION_CANCEL"],
"numlock": ["NUMLOCK"],
"scroll": ["SCROLL"],
"numpadEqual": ["OEM_NEC_EQUAL"],
"oemFjJisho": ["OEM_FJ_JISHO"],
"oemFjMasshou": ["OEM_FJ_MASSHOU"],
"oemFjTouroku": ["OEM_FJ_TOUROKU"],
"oemFjLoya": ["OEM_FJ_LOYA"],
"oemFjRoya": ["OEM_FJ_ROYA"],
"shiftLeft": ["LSHIFT"],
"shiftRight": ["RSHIFT"],
"controlLeft": ["LCONTROL"],
"controlRight": ["RCONTROL"],
"altLeft": ["LMENU"],
"altRight": ["RMENU"],
"browserBack": ["BROWSER_BACK"],
"browserForward": ["BROWSER_FORWARD"],
"browserRefresh": ["BROWSER_REFRESH"],
"browserStop": ["BROWSER_STOP"],
"browserSearch": ["BROWSER_SEARCH"],
"browserFavorites": ["BROWSER_FAVORITES"],
"browserHome": ["BROWSER_HOME"],
"volumeMute": ["VOLUME_MUTE"],
"volumeDown": ["VOLUME_DOWN"],
"volumeUp": ["VOLUME_UP"],
"mediaNextTrack": ["MEDIA_NEXT_TRACK"],
"mediaPrevTrack": ["MEDIA_PREV_TRACK"],
"mediaStop": ["MEDIA_STOP"],
"mediaPlayPause": ["MEDIA_PLAY_PAUSE"],
"launchMail": ["LAUNCH_MAIL"],
"launchMediaSelect": ["LAUNCH_MEDIA_SELECT"],
"launchApp1": ["LAUNCH_APP1"],
"launchApp2": ["LAUNCH_APP2"],
"semicolon": ["OEM_1"],
"equal": ["OEM_PLUS"],
"comma": ["OEM_COMMA"],
"minus": ["OEM_MINUS"],
"period": ["OEM_PERIOD"],
"slash": ["OEM_2"],
"backquote": ["OEM_3"],
"gamepadA": ["GAMEPAD_A"],
"gamepadB": ["GAMEPAD_B"],
"gamepadX": ["GAMEPAD_X"],
"gamepadY": ["GAMEPAD_Y"],
"gamepadRightShoulder": ["GAMEPAD_RIGHT_SHOULDER"],
"gamepadLeftShoulder": ["GAMEPAD_LEFT_SHOULDER"],
"gamepadLeftTrigger": ["GAMEPAD_LEFT_TRIGGER"],
"gamepadRightTrigger": ["GAMEPAD_RIGHT_TRIGGER"],
"gamepadDpadUp": ["GAMEPAD_DPAD_UP"],
"gamepadDpadDown": ["GAMEPAD_DPAD_DOWN"],
"gamepadDpadLeft": ["GAMEPAD_DPAD_LEFT"],
"gamepadDpadRight": ["GAMEPAD_DPAD_RIGHT"],
"gamepadMenu": ["GAMEPAD_MENU"],
"gamepadView": ["GAMEPAD_VIEW"],
"gamepadLeftThumbstickButton": ["GAMEPAD_LEFT_THUMBSTICK_BUTTON"],
"gamepadRightThumbstickButton": ["GAMEPAD_RIGHT_THUMBSTICK_BUTTON"],
"gamepadLeftThumbstickUp": ["GAMEPAD_LEFT_THUMBSTICK_UP"],
"gamepadLeftThumbstickDown": ["GAMEPAD_LEFT_THUMBSTICK_DOWN"],
"gamepadLeftThumbstickRight": ["GAMEPAD_LEFT_THUMBSTICK_RIGHT"],
"gamepadLeftThumbstickLeft": ["GAMEPAD_LEFT_THUMBSTICK_LEFT"],
"gamepadRightThumbstickUp": ["GAMEPAD_RIGHT_THUMBSTICK_UP"],
"gamepadRightThumbstickDown": ["GAMEPAD_RIGHT_THUMBSTICK_DOWN"],
"gamepadRightThumbstickRight": ["GAMEPAD_RIGHT_THUMBSTICK_RIGHT"],
"gamepadRightThumbstickLeft": ["GAMEPAD_RIGHT_THUMBSTICK_LEFT"],
"bracketLeft": ["OEM_4"],
"backslash": ["OEM_5"],
"bracketRight": ["OEM_6"],
"quote": ["OEM_7"],
"oem8": ["OEM_8"],
"oemAx": ["OEM_AX"],
"oem102": ["OEM_102"],
"icoHelp": ["ICO_HELP"],
"ico00": ["ICO_00"],
"processkey": ["PROCESSKEY"],
"icoClear": ["ICO_CLEAR"],
"packet": ["PACKET"],
"oemReset": ["OEM_RESET"],
"oemJump": ["OEM_JUMP"],
"oemPa1": ["OEM_PA1"],
"oemPa2": ["OEM_PA2"],
"oemPa3": ["OEM_PA3"],
"oemWsctrl": ["OEM_WSCTRL"],
"oemCusel": ["OEM_CUSEL"],
"oemAttn": ["OEM_ATTN"],
"oemFinish": ["OEM_FINISH"],
"oemCopy": ["OEM_COPY"],
"oemAuto": ["OEM_AUTO"],
"oemEnlw": ["OEM_ENLW"],
"oemBacktab": ["OEM_BACKTAB"],
"attn": ["ATTN"],
"crsel": ["CRSEL"],
"exsel": ["EXSEL"],
"ereof": ["EREOF"],
"play": ["PLAY"],
"zoom": ["ZOOM"],
"noname": ["NONAME"],
"pa1": ["PA1"],
"oemClear": ["OEM_CLEAR"],
"0": ["0"],
"1": ["1"],
"2": ["2"],
"3": ["3"],
"4": ["4"],
"5": ["5"],
"6": ["6"],
"7": ["7"],
"8": ["8"],
"9": ["9"],
"keyA": ["A"],
"keyB": ["B"],
"keyC": ["C"],
"keyD": ["D"],
"keyE": ["E"],
"keyF": ["F"],
"keyG": ["G"],
"keyH": ["H"],
"keyI": ["I"],
"keyJ": ["J"],
"keyK": ["K"],
"keyL": ["L"],
"keyM": ["M"],
"keyN": ["N"],
"keyO": ["O"],
"keyP": ["P"],
"keyQ": ["Q"],
"keyR": ["R"],
"keyS": ["S"],
"keyT": ["T"],
"keyU": ["U"],
"keyV": ["V"],
"keyW": ["W"],
"keyX": ["X"],
"keyY": ["Y"],
"keyZ": ["Z"]
}
// 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 dev/tools/gen_keycodes/data/keyboard_map_android_cc.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
// Maps Android-specific key codes to the matching LogicalKeyboardKey id.
const std::map<int, int> g_android_to_logical_key = {
@@@ANDROID_KEY_CODE_MAP@@@
};
// Maps Android-specific scan codes to the matching PhysicalKeyboardKey id (a.k.a. HID USB code).
const std::map<int, int> g_android_to_physical_key = {
@@@ANDROID_SCAN_CODE_MAP@@@
};
// A map of Android 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. Maps Android key codes to PhysicalKeyboardKey
// codes (USB HID codes).
const std::map<int, int> g_android_numpad_map = {
@@@ANDROID_NUMPAD_MAP@@@
};
// 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 dev/tools/gen_keycodes/data/keyboard_map_windows_cc.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
/// Maps g_windows_to_physical_key specific key code values representing [PhysicalKeyboardKey].
const std::map<int, uint64_t> g_windows_to_physical_key = {
@@@WINDOWS_SCAN_CODE_MAP@@@
};
/// Maps Windows-specific key codes to the matching [LogicalKeyboardKey].
const std::map<int, uint64_t> g_windows_to_logical_key = {
@@@WINDOWS_KEY_CODE_MAP@@@
};
/// A map of GLFW 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, uint64_t> g_windows_numpad_map = {
@@@WINDOWS_NUMPAD_MAP@@@
};
......@@ -59,6 +59,16 @@ const Map<int, LogicalKeyboardKey> kMacOsFunctionKeyMap = <int, LogicalKeyboardK
@@@MACOS_FUNCTION_KEY_MAP@@@
};
/// A map of macOS key codes presenting [LogicalKeyboardKey].
///
/// Logical key codes are not available in macOS key events. Most of the logical keys
/// are derived from its `characterIgnoringModifiers`, but those keys that don't
/// have a character representation will be derived from their key codes using
/// this map.
const Map<int, LogicalKeyboardKey> kMacOsToLogicalKey = <int, LogicalKeyboardKey>{
@@@MACOS_KEY_CODE_MAP@@@
};
/// Maps iOS-specific key code values representing [PhysicalKeyboardKey].
///
/// iOS doesn't provide a scan code, but a virtual keycode to represent a physical key.
......@@ -73,6 +83,16 @@ const Map<int, LogicalKeyboardKey> kIosNumPadMap = <int, LogicalKeyboardKey>{
@@@IOS_NUMPAD_MAP@@@
};
/// A map of iOS key codes presenting [LogicalKeyboardKey].
///
/// Logical key codes are not available in iOS key events. Most of the logical keys
/// are derived from its `characterIgnoringModifiers`, but those keys that don't
/// have a character representation will be derived from their key codes using
/// this map.
const Map<int, LogicalKeyboardKey> kIosToLogicalKey = <int, LogicalKeyboardKey>{
@@@IOS_KEY_CODE_MAP@@@
};
/// Maps GLFW-specific key codes to the matching [LogicalKeyboardKey].
const Map<int, LogicalKeyboardKey> kGlfwToLogicalKey = <int, LogicalKeyboardKey>{
@@@GLFW_KEY_CODE_MAP@@@
......@@ -119,6 +139,13 @@ const Map<String, LogicalKeyboardKey> kWebNumPadMap = <String, LogicalKeyboardKe
@@@WEB_NUMPAD_MAP@@@
};
/// A map of Web KeyboardEvent keys which needs to be decided based on location,
/// typically for numpad kyes and modifier keys. Used to provide different key
/// objects for keys like KEY_EQUALS and NUMPAD_EQUALS.
const Map<String, List<LogicalKeyboardKey?>> kWebLocationMap = <String, List<LogicalKeyboardKey?>>{
@@@WEB_LOCATION_MAP@@@
};
/// Maps Windows KeyboardEvent codes to the matching [LogicalKeyboardKey].
const Map<int, LogicalKeyboardKey> kWindowsToLogicalKey = <int, LogicalKeyboardKey>{
@@@WINDOWS_LOGICAL_KEY_MAP@@@
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// 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>
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#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
......@@ -11,22 +13,22 @@
// Edit the template dev/tools/gen_keycodes/data/keyboard_map_macos_cc.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
// Maps macOS-specific key code values representing [PhysicalKeyboardKey].
//
// MacOS doesn't provide a scan code, but a virtual keycode to represent a physical key.
const std::map<int, int> g_macos_to_physical_key = {
@@@MASK_CONSTANTS@@@
const NSDictionary* keyCodeToPhysicalKey = @{
@@@MACOS_SCAN_CODE_MAP@@@
};
// A map of macOS 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_macos_numpad_map = {
@@@MACOS_NUMPAD_MAP@@@
const NSDictionary* keyCodeToLogicalKey = @{
@@@MACOS_KEYCODE_LOGICAL_MAP@@@
};
// A map of macOS key codes which are numbered function keys, so that they
// can be excluded when asking "is the Fn modifier down?".
const std::map<int, int> g_macos_function_key_map = {
@@@MACOS_FUNCTION_KEY_MAP@@@
const NSDictionary* keyCodeToModifierFlag = @{
@@@KEYCODE_TO_MODIFIER_FLAG_MAP@@@
};
const NSDictionary* modifierFlagToKeyCode = @{
@@@MODIFIER_FLAG_TO_KEYCODE_MAP@@@
};
@@@SPECIAL_KEY_CONSTANTS@@@
{
"Backspace": ["Backspace"],
"Escape": ["Escape"],
"CapsLock": ["CapsLock"],
"Fn": ["Fn"],
"NumLock": ["NumLock"],
"ArrowDown": ["ArrowDown"],
"ArrowLeft": ["ArrowLeft"],
"ArrowRight": ["ArrowRight"],
"ArrowUp": ["ArrowUp"],
"End": ["End"],
"Home": ["Home"],
"PageDown": ["PageDown"],
"PageUp": ["PageUp"],
"Insert": ["Insert"],
"Delete": ["Delete"],
"ContextMenu": ["ContextMenu"],
"F1": ["F1"],
"F2": ["F2"],
"F3": ["F3"],
"F4": ["F4"],
"F5": ["F5"],
"F6": ["F6"],
"F7": ["F7"],
"F8": ["F8"],
"F9": ["F9"],
"F10": ["F10"],
"F11": ["F11"],
"F12": ["F12"],
"F13": ["F13"],
"F14": ["F14"],
"F15": ["F15"],
"F16": ["F16"],
"F17": ["F17"],
"F18": ["F18"],
"F19": ["F19"],
"F20": ["F20"],
"NumpadEnter": ["NumpadEnter"],
"NumpadMultiply": ["NumpadMultiply"],
"NumpadAdd": ["NumpadAdd"],
"NumpadComma": ["NumpadComma"],
"NumpadSubtract": ["NumpadSubtract"],
"NumpadDecimal": ["NumpadDecimal"],
"NumpadDivide": ["NumpadDivide"],
"Numpad0": ["Numpad0"],
"Numpad1": ["Numpad1"],
"Numpad2": ["Numpad2"],
"Numpad3": ["Numpad3"],
"Numpad4": ["Numpad4"],
"Numpad5": ["Numpad5"],
"Numpad6": ["Numpad6"],
"Numpad7": ["Numpad7"],
"Numpad8": ["Numpad8"],
"Numpad9": ["Numpad9"],
"NumpadEqual": ["NumpadEqual"],
"AltLeft": ["AltLeft"],
"ControlLeft": ["ControlLeft"],
"MetaLeft": ["MetaLeft"],
"ShiftLeft": ["ShiftLeft"],
"AltRight": ["AltRight"],
"ControlRight": ["ControlRight"],
"MetaRight": ["MetaRight"],
"ShiftRight": ["ShiftRight"],
"Lang1": ["Lang1"],
"Lang2": ["Lang2"],
"IntlYen": ["IntlYen"],
"IntlRo": ["IntlRo"],
"AudioVolumeUp": ["AudioVolumeUp"],
"AudioVolumeDown": ["AudioVolumeDown"],
"AudioVolumeMute": ["AudioVolumeMute"]
}
{
"valueMask": {
"value": "0x000FFFFFFFF",
"description": [
"Mask for the 32-bit value portion of the key code.",
"This is used by platform-specific code to generate Flutter key codes."
]
},
"platformMask": {
"value": "0x0FF00000000",
"description": [
"Mask for the platform prefix portion of the key code.",
"This is used by platform-specific code to generate Flutter key codes."
]
},
"unicodePlane": {
"value": "0x00000000000",
"description": [
"The code prefix for keys which have a Unicode representation.",
"This is used by platform-specific code to generate Flutter key codes."
]
},
"autogeneratedMask": {
"value": "0x10000000000",
"description": [
"Mask for the auto-generated bit portion of the key code.",
"This is used by platform-specific code to generate new Flutter key codes for keys which are not recognized."
]
},
"synonymMask": {
"value": "0x20000000000",
"description": [
"Mask for the synonym pseudo-keys generated for keys which appear in more than one place on the keyboard.",
"IDs in this range are used to represent keys which appear in multiple places on the keyboard, such as the SHIFT, ALT, CTRL, and numeric keypad keys. These key codes will never be generated by the key event system, but may be used in key maps to represent the union of all the keys of each type in order to match them.",
"To look up the synonyms that are defined, look in the [synonyms] map."
]
},
"hidPlane": {
"value": "0x00100000000",
"description": [
"The code prefix for keys which do not have a Unicode representation.",
"This is used by platform-specific code to generate Flutter key codes using HID Usage codes."
]
}
}
This diff is collapsed.
{
"backquote": "`",
"backslash": "\\",
"bracketLeft": "[",
"bracketRight": "]",
"comma": ",",
"digit0": "0",
"digit1": "1",
"digit2": "2",
"digit3": "3",
"digit4": "4",
"digit5": "5",
"digit6": "6",
"digit7": "7",
"digit8": "8",
"digit9": "9",
"equal": "=",
"keyA": "a",
"keyB": "b",
"keyC": "c",
"keyD": "d",
"keyE": "e",
"keyF": "f",
"keyG": "g",
"keyH": "h",
"keyI": "i",
"keyJ": "j",
"keyK": "k",
"keyL": "l",
"keyM": "m",
"keyN": "n",
"keyO": "o",
"keyP": "p",
"keyQ": "q",
"keyR": "r",
"keyS": "s",
"keyT": "t",
"keyU": "u",
"keyV": "v",
"keyW": "w",
"keyX": "x",
"keyY": "y",
"keyZ": "z",
"minus": "-",
"numpad0": "0",
"numpad1": "1",
"numpad2": "2",
"numpad3": "3",
"numpad4": "4",
"numpad5": "5",
"numpad6": "6",
"numpad7": "7",
"numpad8": "8",
"numpad9": "9",
"numpadAdd": "+",
"numpadComma": ",",
"numpadDecimal": ".",
"numpadDivide": "/",
"numpadEqual": "=",
"numpadMultiply": "*",
"numpadParenLeft": "(",
"numpadParenRight": ")",
"numpadSubtract": "-",
"period": ".",
"quote": "'",
"semicolon": ";",
"slash": "/",
"space": " "
"Backquote": "`",
"Backslash": "\\",
"BracketLeft": "[",
"BracketRight": "]",
"Comma": ",",
"Digit0": "0",
"Digit1": "1",
"Digit2": "2",
"Digit3": "3",
"Digit4": "4",
"Digit5": "5",
"Digit6": "6",
"Digit7": "7",
"Digit8": "8",
"Digit9": "9",
"Equal": "=",
"KeyA": "a",
"KeyB": "b",
"KeyC": "c",
"KeyD": "d",
"KeyE": "e",
"KeyF": "f",
"KeyG": "g",
"KeyH": "h",
"KeyI": "i",
"KeyJ": "j",
"KeyK": "k",
"KeyL": "l",
"KeyM": "m",
"KeyN": "n",
"KeyO": "o",
"KeyP": "p",
"KeyQ": "q",
"KeyR": "r",
"KeyS": "s",
"KeyT": "t",
"KeyU": "u",
"KeyV": "v",
"KeyW": "w",
"KeyX": "x",
"KeyY": "y",
"KeyZ": "z",
"Minus": "-",
"Numpad0": "0",
"Numpad1": "1",
"Numpad2": "2",
"Numpad3": "3",
"Numpad4": "4",
"Numpad5": "5",
"Numpad6": "6",
"Numpad7": "7",
"Numpad8": "8",
"Numpad9": "9",
"NumpadAdd": "+",
"NumpadComma": ",",
"NumpadDecimal": ".",
"NumpadDivide": "/",
"NumpadEqual": "=",
"NumpadMultiply": "*",
"NumpadParenLeft": "(",
"NumpadParenRight": ")",
"NumpadSubtract": "-",
"Period": ".",
"Quote": "'",
"Semicolon": ";",
"Slash": "/",
"Space": " "
}
{
"0": "Numpad0",
"1": "Numpad1",
"2": "Numpad2",
"3": "Numpad3",
"4": "Numpad4",
"5": "Numpad5",
"6": "Numpad6",
"7": "Numpad7",
"8": "Numpad8",
"9": "Numpad9",
".": "NumpadDecimal",
"+": "NumpadAdd",
"-": "NumpadSubtract",
"*": "NumpadMultiply",
"/": "NumpadDivide",
"=": "NumpadEqual",
",": "NumpadComma",
"(": "NumpadParenLeft",
")": "NumpadParenRight",
"\u000D": "NumpadEnter"
}
// These are supplemental key codes to be added to those that Chromium
// defines. Since the web doesn't have game controller buttons defined in the
// These are supplemental code data to be added to those that Chromium
// defines.
// ============================================================
// Game controller buttons
// ============================================================
// Since the web doesn't have game controller buttons defined in the
// same way, these map USB HID codes for game controller buttons to
// Android/Linux button names.
//
......@@ -44,6 +50,10 @@
DOM_CODE(0x05ff1e, 0x0000, 0x0000, 0x0000, 0xffff, "GameButtonY", BUTTON_Y),
DOM_CODE(0x05ff1f, 0x0000, 0x0000, 0x0000, 0xffff, "GameButtonZ", BUTTON_Z),
// ============================================================
// Fn key for Mac
// ============================================================
// The Mac defines a key code for the Fn key on Mac keyboards, but it's not
// defined on other platforms. Chromium does define an "Fn" row, but doesn't
// give it a Mac keycode. This overrides their definition.
......
// These are supplemental key data to be added to those that Chromium
// defines.
// ============================================================
// Printable keys
// ============================================================
// Key Enum Unicode code point
DOM_KEY_UNI("Space", SPACE, ' '),
DOM_KEY_UNI("Exclamation", EXCLAMATION, '!'),
DOM_KEY_UNI("NumberSign", NUMBER_SIGN, '#'),
DOM_KEY_UNI("Dollar", DOLLAR, '$'),
DOM_KEY_UNI("Percent", PERCENT, '%'),
DOM_KEY_UNI("Ampersand", AMPERSAND, '&'),
DOM_KEY_UNI("QuoteSingle", QUOTE_SINGLE, 0x0027),
DOM_KEY_UNI("Quote", QUOTE, '"')",
DOM_KEY_UNI("ParenthesisLeft", PARENTHESIS_LEFT, '('),
DOM_KEY_UNI("ParenthesisRight", PARENTHESIS_RIGHT, ')'),
DOM_KEY_UNI("Asterisk", ASTERISK, '*'),
DOM_KEY_UNI("Add", ADD, '+'),
DOM_KEY_UNI("Comma", COMMA, ','),
DOM_KEY_UNI("Minus", MINUS, '-'),
DOM_KEY_UNI("Period", PERIOD, '.'),
DOM_KEY_UNI("Slash", SLASH, '/'),
DOM_KEY_UNI("Digit0", DIGIT0, '0'),
DOM_KEY_UNI("Digit1", DIGIT1, '1'),
DOM_KEY_UNI("Digit2", DIGIT2, '2'),
DOM_KEY_UNI("Digit3", DIGIT3, '3'),
DOM_KEY_UNI("Digit4", DIGIT4, '4'),
DOM_KEY_UNI("Digit5", DIGIT5, '5'),
DOM_KEY_UNI("Digit6", DIGIT6, '6'),
DOM_KEY_UNI("Digit7", DIGIT7, '7'),
DOM_KEY_UNI("Digit8", DIGIT8, '8'),
DOM_KEY_UNI("Digit9", DIGIT9, '9'),
DOM_KEY_UNI("Colon", COLON, ':'),
DOM_KEY_UNI("Semicolon", SEMICOLON, ';'),
DOM_KEY_UNI("Less", LESS, '<'),
DOM_KEY_UNI("Equal", EQUAL, '='),
DOM_KEY_UNI("Greater", GREATER, '>'),
DOM_KEY_UNI("Question", QUESTION, '?'),
DOM_KEY_UNI("At", AT, '@'),
DOM_KEY_UNI("BracketLeft", BRACKET_LEFT, '['),
DOM_KEY_UNI("Backslash", BACKSLASH, 0x005c),
DOM_KEY_UNI("BracketRight", BRACKET_RIGHT, ']'),
DOM_KEY_UNI("Caret", CARET, '^'),
DOM_KEY_UNI("Backquote", BACKQUOTE, '`'),
DOM_KEY_UNI("Underscore", UNDERSCORE, '_'),
DOM_KEY_UNI("KeyA", KEY_A, 'a'),
DOM_KEY_UNI("KeyB", KEY_B, 'b'),
DOM_KEY_UNI("KeyC", KEY_C, 'c'),
DOM_KEY_UNI("KeyD", KEY_D, 'd'),
DOM_KEY_UNI("KeyE", KEY_E, 'e'),
DOM_KEY_UNI("KeyF", KEY_F, 'f'),
DOM_KEY_UNI("KeyG", KEY_G, 'g'),
DOM_KEY_UNI("KeyH", KEY_H, 'h'),
DOM_KEY_UNI("KeyI", KEY_I, 'i'),
DOM_KEY_UNI("KeyJ", KEY_J, 'j'),
DOM_KEY_UNI("KeyK", KEY_K, 'k'),
DOM_KEY_UNI("KeyL", KEY_L, 'l'),
DOM_KEY_UNI("KeyM", KEY_M, 'm'),
DOM_KEY_UNI("KeyN", KEY_N, 'n'),
DOM_KEY_UNI("KeyO", KEY_O, 'o'),
DOM_KEY_UNI("KeyP", KEY_P, 'p'),
DOM_KEY_UNI("KeyQ", KEY_Q, 'q'),
DOM_KEY_UNI("KeyR", KEY_R, 'r'),
DOM_KEY_UNI("KeyS", KEY_S, 's'),
DOM_KEY_UNI("KeyT", KEY_T, 't'),
DOM_KEY_UNI("KeyU", KEY_U, 'u'),
DOM_KEY_UNI("KeyV", KEY_V, 'v'),
DOM_KEY_UNI("KeyW", KEY_W, 'w'),
DOM_KEY_UNI("KeyX", KEY_X, 'x'),
DOM_KEY_UNI("KeyY", KEY_Y, 'y'),
DOM_KEY_UNI("KeyZ", KEY_Z, 'z'),
DOM_KEY_UNI("BraceLeft", BRACE_LEFT, '{'),
DOM_KEY_UNI("BraceRight", BRACE_RIGHT, '}'),
DOM_KEY_UNI("Tilde", TILDE, '~'),
DOM_KEY_UNI("Bar", BAR, '|'),
// ============================================================
// Game controller buttons
// ============================================================
// Since the web doesn't have game controller buttons defined in the
// same way, these map USB HID codes for game controller buttons to
// Android/Linux button names.
// Key Enum Value
DOM_KEY_MAP("GameButton1", GAME_BUTTON_1, 0x05ff01),
DOM_KEY_MAP("GameButton2", GAME_BUTTON_2, 0x05ff02),
DOM_KEY_MAP("GameButton3", GAME_BUTTON_3, 0x05ff03),
DOM_KEY_MAP("GameButton4", GAME_BUTTON_4, 0x05ff04),
DOM_KEY_MAP("GameButton5", GAME_BUTTON_5, 0x05ff05),
DOM_KEY_MAP("GameButton6", GAME_BUTTON_6, 0x05ff06),
DOM_KEY_MAP("GameButton7", GAME_BUTTON_7, 0x05ff07),
DOM_KEY_MAP("GameButton8", GAME_BUTTON_8, 0x05ff08),
DOM_KEY_MAP("GameButton9", GAME_BUTTON_9, 0x05ff09),
DOM_KEY_MAP("GameButton10", GAME_BUTTON_10, 0x05ff0a),
DOM_KEY_MAP("GameButton11", GAME_BUTTON_11, 0x05ff0b),
DOM_KEY_MAP("GameButton12", GAME_BUTTON_12, 0x05ff0c),
DOM_KEY_MAP("GameButton13", GAME_BUTTON_13, 0x05ff0d),
DOM_KEY_MAP("GameButton14", GAME_BUTTON_14, 0x05ff0e),
DOM_KEY_MAP("GameButton15", GAME_BUTTON_15, 0x05ff0f),
DOM_KEY_MAP("GameButton16", GAME_BUTTON_16, 0x05ff10),
DOM_KEY_MAP("GameButtonA", GAME_BUTTON_A, 0x05ff11),
DOM_KEY_MAP("GameButtonB", GAME_BUTTON_B, 0x05ff12),
DOM_KEY_MAP("GameButtonC", GAME_BUTTON_C, 0x05ff13),
DOM_KEY_MAP("GameButtonLeft1", GAME_BUTTON_L1, 0x05ff14),
DOM_KEY_MAP("GameButtonLeft2", GAME_BUTTON_L2, 0x05ff15),
DOM_KEY_MAP("GameButtonMode", GAME_BUTTON_MODE, 0x05ff16),
DOM_KEY_MAP("GameButtonRight1", GAME_BUTTON_R1, 0x05ff17),
DOM_KEY_MAP("GameButtonRight2", GAME_BUTTON_R2, 0x05ff18),
DOM_KEY_MAP("GameButtonSelect", GAME_BUTTON_SELECT, 0x05ff19),
DOM_KEY_MAP("GameButtonStart", GAME_BUTTON_START, 0x05ff1a),
DOM_KEY_MAP("GameButtonThumbLeft", GAME_BUTTON_THUMBL, 0x05ff1b),
DOM_KEY_MAP("GameButtonThumbRight", GAME_BUTTON_THUMBR, 0x05ff1c),
DOM_KEY_MAP("GameButtonX", GAME_BUTTON_X, 0x05ff1d),
DOM_KEY_MAP("GameButtonY", GAME_BUTTON_Y, 0x05ff1e),
DOM_KEY_MAP("GameButtonZ", GAME_BUTTON_Z, 0x05ff1f),
// ============================================================
// Other buttons
// ============================================================
// Key Enum Value
DOM_KEY_MAP("None", NONE, 0x0),
DOM_KEY_MAP("Suspend", SUSPEND, 0x100000014),
DOM_KEY_MAP("Resume", RESUME, 0x100000015),
DOM_KEY_MAP("Sleep", SLEEP, 0x100010082),
DOM_KEY_MAP("IntlBackslash", INTL_BACKSLASH, 0x100070064),
DOM_KEY_MAP("IntlRo", INTL_RO, 0x100070087),
DOM_KEY_MAP("IntlYen", INTL_YEN, 0x100070089),
DOM_KEY_MAP("Lang1", LANG1, 0x100070090),
DOM_KEY_MAP("Lang2", LANG2, 0x100070091),
DOM_KEY_MAP("Lang3", LANG3, 0x100070092),
DOM_KEY_MAP("Lang4", LANG4, 0x100070093),
DOM_KEY_MAP("Lang5", LANG5, 0x100070094),
DOM_KEY_MAP("Abort", ABORT, 0x10007009b),
{
"shift": ["ShiftLeft", "ShiftRight"],
"meta": ["MetaLeft", "MetaRight"],
"alt": ["AltLeft", "AltRight"],
"control": ["ControlLeft", "ControlRight"]
"Shift": ["ShiftLeft", "ShiftRight"],
"Meta": ["MetaLeft", "MetaRight"],
"Alt": ["AltLeft", "AltRight"],
"Control": ["ControlLeft", "ControlRight"]
}
......@@ -6,9 +6,12 @@
// 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/keyboard_map_web.tmpl instead.
// Edit the template dev/tools/gen_keycodes/data/web_key_map_dart.tmpl instead.
// See dev/tools/gen_keycodes/README.md for more information.
// @dart = 2.12
part of engine;
/// Maps Web KeyboardEvent codes to the matching LogicalKeyboardKey id.
const Map<String, int> kWebToLogicalKey = <String, int>{
@@@WEB_LOGICAL_KEY_CODE_MAP@@@
......@@ -19,9 +22,14 @@ const Map<String, int> kWebToPhysicalKey = <String, int>{
@@@WEB_PHYSICAL_KEY_CODE_MAP@@@
};
/// A map of Web KeyboardEvent 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 Map<String, int> kWebNumPadMap = <String, int>{
@@@WEB_NUMPAD_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@@@
};
{
"0": ["Digit0", null, null, "Numpad0"],
"1": ["Digit1", null, null, "Numpad1"],
"2": ["Digit2", null, null, "Numpad2"],
"3": ["Digit3", null, null, "Numpad3"],
"4": ["Digit4", null, null, "Numpad4"],
"5": ["Digit5", null, null, "Numpad5"],
"6": ["Digit6", null, null, "Numpad6"],
"7": ["Digit7", null, null, "Numpad7"],
"8": ["Digit8", null, null, "Numpad8"],
"9": ["Digit9", null, null, "Numpad9"],
".": ["Period", null, null, "NumpadDecimal"],
"Insert": ["Insert", null, null, "Numpad0"],
"End": ["End", null, null, "Numpad1"],
"ArrowDown": ["ArrowDown", null, null, "Numpad2"],
"PageDown": ["PageDown", null, null, "Numpad3"],
"ArrowLeft": ["ArrowLeft", null, null, "Numpad4"],
"Clear": ["Clear", null, null, "Numpad5"],
"ArrowRight": ["ArrowRight", null, null, "Numpad6"],
"Home": ["Home", null, null, "Numpad7"],
"ArrowUp": ["ArrowUp", null, null, "Numpad8"],
"PageUp": ["PageUp", null, null, "Numpad9"],
"Delete": ["Delete", null, null, "NumpadDecimal"],
"/": ["Slash", null, null, "NumpadDivide"],
"*": ["Asterisk", null, null, "NumpadMultiply"],
"-": ["Minus", null, null, "NumpadSubtract"],
"+": ["Add", null, null, "NumpadAdd"],
"Enter": ["Enter", null, null, "NumpadEnter"],
"Shift": [null, "ShiftLeft", "ShiftRight", null],
"Control": [null, "ControlLeft", "ControlRight", null],
"Alt": [null, "AltLeft", "AltRight", null],
"Meta": [null, "MetaLeft", "MetaRight", null]
}
// 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.
#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_KEY_MAP_H_
#define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_KEY_MAP_H_
#include "flutter/shell/platform/windows/keyboard_key_embedder_handler.h"
#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 dev/tools/gen_keycodes/data/windows_flutter_key_map_cc.tmpl
// instead. See dev/tools/gen_keycodes/README.md for more information.
namespace flutter {
std::map<uint64_t, uint64_t> KeyboardKeyEmbedderHandler::windowsToPhysicalMap_ =
{
@@@WINDOWS_SCAN_CODE_MAP@@@
};
std::map<uint64_t, uint64_t> KeyboardKeyEmbedderHandler::windowsToLogicalMap_ =
{
@@@WINDOWS_KEY_CODE_MAP@@@
};
std::map<uint64_t, uint64_t> KeyboardKeyEmbedderHandler::scanCodeToLogicalMap_ =
{
@@@WINDOWS_SCAN_CODE_TO_LOGICAL_MAP@@@
};
} // namespace flutter
#endif
{
"Cancel": ["CANCEL"],
"Backspace": ["BACK"],
"Tab": ["TAB"],
"Clear": ["CLEAR"],
"Enter": ["RETURN"],
"Menu": ["MENU"],
"Pause": ["PAUSE"],
"CapsLock": ["CAPITAL"],
"Lang1": ["HANGUL", "HANGEUL", "KANA"],
"JunjaMode": ["JUNJA"],
"FinalMode": ["FINAL"],
"HanjaMode": ["HANJA"],
"KanjiMode": ["KANJI"],
"Escape": ["ESCAPE"],
"Convert": ["CONVERT"],
"Nonconvert": ["NONCONVERT"],
"Accept": ["ACCEPT"],
"ModeChange": ["MODECHANGE"],
"Space": ["SPACE"],
"Home": ["HOME"],
"End": ["END"],
"ArrowLeft": ["LEFT"],
"ArrowUp": ["UP"],
"ArrowRight": ["RIGHT"],
"ArrowDown": ["DOWN"],
"Sleep": ["SLEEP"],
"Select": ["SELECT"],
"Print": ["PRINT"],
"Execute": ["EXECUTE"],
"Snapshot": ["SNAPSHOT"],
"Insert": ["INSERT"],
"Delete": ["DELETE"],
"Help": ["HELP"],
"MetaLeft": ["LWIN"],
"MetaRight": ["RWIN"],
"ContextMenu": ["APPS"],
"PageDown": ["NEXT"],
"PageUp": ["PRIOR"],
"Numpad0": ["NUMPAD0"],
"Numpad1": ["NUMPAD1"],
"Numpad2": ["NUMPAD2"],
"Numpad3": ["NUMPAD3"],
"Numpad4": ["NUMPAD4"],
"Numpad5": ["NUMPAD5"],
"Numpad6": ["NUMPAD6"],
"Numpad7": ["NUMPAD7"],
"Numpad8": ["NUMPAD8"],
"Numpad9": ["NUMPAD9"],
"NumpadMultiply": ["MULTIPLY"],
"NumpadAdd": ["ADD"],
"NumpadSeparator": ["SEPARATOR"],
"NumpadSubtract": ["SUBTRACT"],
"NumpadDecimal": ["DECIMAL"],
"NumpadDivide": ["DIVIDE"],
"F1": ["F1"],
"F2": ["F2"],
"F3": ["F3"],
"F4": ["F4"],
"F5": ["F5"],
"F6": ["F6"],
"F7": ["F7"],
"F8": ["F8"],
"F9": ["F9"],
"F10": ["F10"],
"F11": ["F11"],
"F12": ["F12"],
"F13": ["F13"],
"F14": ["F14"],
"F15": ["F15"],
"F16": ["F16"],
"F17": ["F17"],
"F18": ["F18"],
"F19": ["F19"],
"F20": ["F20"],
"F21": ["F21"],
"F22": ["F22"],
"F23": ["F23"],
"F24": ["F24"],
"NavigationView": ["NAVIGATION_VIEW"],
"NavigationMenu": ["NAVIGATION_MENU"],
"NavigationUp": ["NAVIGATION_UP"],
"NavigationDown": ["NAVIGATION_DOWN"],
"NavigationLeft": ["NAVIGATION_LEFT"],
"NavigationRight": ["NAVIGATION_RIGHT"],
"NavigationAccept": ["NAVIGATION_ACCEPT"],
"NavigationCancel": ["NAVIGATION_CANCEL"],
"NumLock": ["NUMLOCK"],
"ScrollLock": ["SCROLL"],
"NumpadEqual": ["OEM_NEC_EQUAL"],
"ShiftLeft": ["LSHIFT", "SHIFT"],
"ShiftRight": ["RSHIFT"],
"ShiftLock": ["OEM_SHIFT"],
"ControlLeft": ["LCONTROL", "CONTROL"],
"ControlRight": ["RCONTROL"],
"AltLeft": ["LMENU"],
"AltRight": ["RMENU"],
"BrowserBack": ["BROWSER_BACK"],
"BrowserForward": ["BROWSER_FORWARD"],
"BrowserRefresh": ["BROWSER_REFRESH"],
"BrowserStop": ["BROWSER_STOP"],
"BrowserSearch": ["BROWSER_SEARCH"],
"BrowserFavorites": ["BROWSER_FAVORITES"],
"BrowserHome": ["BROWSER_HOME"],
"AudioVolumeMute": ["VOLUME_MUTE"],
"AudioVolumeDown": ["VOLUME_DOWN"],
"AudioVolumeUp": ["VOLUME_UP"],
"MediaNextTrack": ["MEDIA_NEXT_TRACK"],
"MediaPrevTrack": ["MEDIA_PREV_TRACK"],
"MediaStop": ["MEDIA_STOP"],
"MediaPlayPause": ["MEDIA_PLAY_PAUSE"],
"LaunchMail": ["LAUNCH_MAIL"],
"LaunchMediaSelect": ["LAUNCH_MEDIA_SELECT"],
"LaunchApp1": ["LAUNCH_APP1"],
"LaunchApp2": ["LAUNCH_APP2"],
"Semicolon": ["OEM_1"],
"Equal": ["OEM_PLUS"],
"Comma": ["OEM_COMMA"],
"Minus": ["OEM_MINUS"],
"Period": ["OEM_PERIOD"],
"Slash": ["OEM_2"],
"Backquote": ["OEM_3"],
"GameButton8": ["GAMEPAD_A"],
"GameButton9": ["GAMEPAD_B"],
"GameButton10": ["GAMEPAD_X"],
"GameButton11": ["GAMEPAD_Y"],
"GameButton12": ["GAMEPAD_RIGHT_SHOULDER"],
"GameButton13": ["GAMEPAD_LEFT_SHOULDER"],
"GameButton14": ["GAMEPAD_LEFT_TRIGGER"],
"GameButton15": ["GAMEPAD_RIGHT_TRIGGER"],
"GameButton16": ["GAMEPAD_DPAD_UP"],
"GameButton17": ["GAMEPAD_DPAD_DOWN"],
"GameButton18": ["GAMEPAD_DPAD_LEFT"],
"GameButton19": ["GAMEPAD_DPAD_RIGHT"],
"GamepadMenu": ["GAMEPAD_MENU"],
"GamepadView": ["GAMEPAD_VIEW"],
"GamepadLeftThumbstickButton": ["GAMEPAD_LEFT_THUMBSTICK_BUTTON"],
"GamepadRightThumbstickButton": ["GAMEPAD_RIGHT_THUMBSTICK_BUTTON"],
"GamepadLeftThumbstickUp": ["GAMEPAD_LEFT_THUMBSTICK_UP"],
"GamepadLeftThumbstickDown": ["GAMEPAD_LEFT_THUMBSTICK_DOWN"],
"GamepadLeftThumbstickRight": ["GAMEPAD_LEFT_THUMBSTICK_RIGHT"],
"GamepadLeftThumbstickLeft": ["GAMEPAD_LEFT_THUMBSTICK_LEFT"],
"GamepadRightThumbstickUp": ["GAMEPAD_RIGHT_THUMBSTICK_UP"],
"GamepadRightThumbstickDown": ["GAMEPAD_RIGHT_THUMBSTICK_DOWN"],
"GamepadRightThumbstickRight": ["GAMEPAD_RIGHT_THUMBSTICK_RIGHT"],
"GamepadRightThumbstickLeft": ["GAMEPAD_RIGHT_THUMBSTICK_LEFT"],
"BracketLeft": ["OEM_4"],
"Backslash": ["OEM_5"],
"BracketRight": ["OEM_6"],
"Quote": ["OEM_7"],
"Oem8": ["OEM_8"],
"OemAx": ["OEM_AX"],
"Oem102": ["OEM_102"],
"IcoHelp": ["ICO_HELP"],
"Ico00": ["ICO_00"],
"Processkey": ["PROCESSKEY"],
"IcoClear": ["ICO_CLEAR"],
"Packet": ["PACKET"],
"OemReset": ["OEM_RESET"],
"OemJump": ["OEM_JUMP"],
"OemPa1": ["OEM_PA1"],
"OemPa2": ["OEM_PA2"],
"OemPa3": ["OEM_PA3"],
"OemWsctrl": ["OEM_WSCTRL"],
"OemCusel": ["OEM_CUSEL"],
"OemAttn": ["OEM_ATTN"],
"OemFinish": ["OEM_FINISH"],
"OemCopy": ["OEM_COPY"],
"OemAuto": ["OEM_AUTO"],
"OemEnlw": ["OEM_ENLW"],
"OemBacktab": ["OEM_BACKTAB"],
"Attn": ["ATTN"],
"Crsel": ["CRSEL"],
"Exsel": ["EXSEL"],
"Ereof": ["EREOF"],
"Play": ["PLAY"],
"Zoom": ["ZOOM"],
"Noname": ["NONAME"],
"Pa1": ["PA1"],
"OemClear": ["OEM_CLEAR"],
"0": ["0"],
"1": ["1"],
"2": ["2"],
"3": ["3"],
"4": ["4"],
"5": ["5"],
"6": ["6"],
"7": ["7"],
"8": ["8"],
"9": ["9"],
"KeyA": ["A"],
"KeyB": ["B"],
"KeyC": ["C"],
"KeyD": ["D"],
"KeyE": ["E"],
"KeyF": ["F"],
"KeyG": ["G"],
"KeyH": ["H"],
"KeyI": ["I"],
"KeyJ": ["J"],
"KeyK": ["K"],
"KeyL": ["L"],
"KeyM": ["M"],
"KeyN": ["N"],
"KeyO": ["O"],
"KeyP": ["P"],
"KeyQ": ["Q"],
"KeyR": ["R"],
"KeyS": ["S"],
"KeyT": ["T"],
"KeyU": ["U"],
"KeyV": ["V"],
"KeyW": ["W"],
"KeyX": ["X"],
"KeyY": ["Y"],
"KeyZ": ["Z"]
}
{
"ControlRight": "ControlRight",
"AltRight": "AltRight",
"Numpad1": "Numpad1",
"Numpad2": "Numpad2",
"Numpad3": "Numpad3",
"Numpad4": "Numpad4",
"Numpad5": "Numpad5",
"Numpad6": "Numpad6",
"Numpad7": "Numpad7",
"Numpad8": "Numpad8",
"Numpad9": "Numpad9",
"Numpad0": "Numpad0",
"NumpadAdd": "NumpadAdd",
"NumpadDecimal": "NumpadDecimal",
"NumpadDivide": "NumpadDivide",
"NumpadEqual": "NumpadEqual",
"NumpadMultiply": "NumpadMultiply",
"NumpadSubtract": "NumpadSubtract"
}
......@@ -5,36 +5,23 @@
import 'package:path/path.dart' as path;
import 'base_code_gen.dart';
import 'key_data.dart';
import 'logical_key_data.dart';
import 'physical_key_data.dart';
import 'utils.dart';
/// Generates the key mapping of Android, based on the information in the key
/// Generates the key mapping for Android, based on the information in the key
/// data structure given to it.
class AndroidCodeGenerator extends PlatformCodeGenerator {
AndroidCodeGenerator(KeyData keyData) : super(keyData);
AndroidCodeGenerator(PhysicalKeyData physicalData, LogicalKeyData logicalData)
: super(physicalData, logicalData);
/// This generates the map of Android key codes to logical keys.
String get _androidKeyCodeMap {
final StringBuffer androidKeyCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
if (entry.androidKeyCodes != null) {
for (final int code in entry.androidKeyCodes.cast<int>()) {
androidKeyCodeMap.writeln(' { $code, ${toHex(entry.flutterId, digits: 10)} }, // ${entry.constantName}');
}
}
}
return androidKeyCodeMap.toString().trimRight();
}
/// This generates the map of Android number pad key codes to logical keys.
String get _androidNumpadMap {
final StringBuffer androidKeyCodeMap = StringBuffer();
for (final Key entry in numpadKeyData) {
if (entry.androidKeyCodes != null) {
for (final int code in entry.androidKeyCodes.cast<int>()) {
androidKeyCodeMap.writeln(' { $code, ${toHex(entry.flutterId, digits: 10)} }, // ${entry.constantName}');
}
for (final LogicalKeyEntry entry in logicalData.entries) {
for (final int code in entry.androidValues) {
androidKeyCodeMap.writeln(' put(${toHex(code, digits: 10)}L, ${toHex(entry.value, digits: 10)}L); // ${entry.constantName}');
}
}
return androidKeyCodeMap.toString().trimRight();
......@@ -43,10 +30,10 @@ class AndroidCodeGenerator extends PlatformCodeGenerator {
/// This generates the map of Android scan codes to physical keys.
String get _androidScanCodeMap {
final StringBuffer androidScanCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
for (final PhysicalKeyEntry entry in keyData.entries) {
if (entry.androidScanCodes != null) {
for (final int code in entry.androidScanCodes.cast<int>()) {
androidScanCodeMap.writeln(' { $code, ${toHex(entry.usbHidCode)} }, // ${entry.constantName}');
androidScanCodeMap.writeln(' put(${toHex(code, digits: 10)}L, ${toHex(entry.usbHidCode, digits: 10)}L); // ${entry.constantName}');
}
}
}
......@@ -54,14 +41,17 @@ class AndroidCodeGenerator extends PlatformCodeGenerator {
}
@override
String get templatePath => path.join(flutterRoot.path, 'dev', 'tools', 'gen_keycodes', 'data', 'keyboard_map_android_cc.tmpl');
String get templatePath => path.join(dataRoot, 'android_keyboard_map_java.tmpl');
@override
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot, 'shell', 'platform',
path.join('android', 'io', 'flutter', 'embedding', 'android', 'KeyboardMap.java'));
@override
Map<String, String> mappings() {
return <String, String>{
'ANDROID_SCAN_CODE_MAP': _androidScanCodeMap,
'ANDROID_KEY_CODE_MAP': _androidKeyCodeMap,
'ANDROID_NUMPAD_MAP': _androidNumpadMap,
};
}
}
......@@ -3,15 +3,14 @@
// found in the LICENSE file.
import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:gen_keycodes/logical_key_data.dart';
import 'key_data.dart';
import 'utils.dart';
import 'physical_key_data.dart';
String _injectDictionary(String template, Map<String, String> dictionary) {
String result = template;
for (final String key in dictionary.keys) {
result = result.replaceAll('@@@$key@@@', dictionary[key]);
result = result.replaceAll('@@@$key@@@', dictionary[key] ?? '@@@$key@@@');
}
return result;
}
......@@ -26,7 +25,7 @@ String _injectDictionary(String template, Map<String, String> dictionary) {
/// Subclasses must implement [templatePath] and [mappings].
abstract class BaseCodeGenerator {
/// Create a code generator while providing [keyData] to be used in [mappings].
BaseCodeGenerator(this.keyData);
BaseCodeGenerator(this.keyData, this.logicalData);
/// Absolute path to the template file that this file is generated on.
String get templatePath;
......@@ -42,30 +41,20 @@ abstract class BaseCodeGenerator {
}
/// The database of keys loaded from disk.
final KeyData keyData;
final PhysicalKeyData keyData;
final LogicalKeyData logicalData;
}
/// A code generator which also defines platform-based behavior.
abstract class PlatformCodeGenerator extends BaseCodeGenerator {
PlatformCodeGenerator(KeyData keyData) : super(keyData);
// Used by platform code generators.
List<Key> get numpadKeyData {
return keyData.data.where((Key entry) {
return entry.constantName.startsWith('numpad') && entry.keyLabel != null;
}).toList();
}
// Used by platform code generators.
List<Key> get functionKeyData {
final RegExp functionKeyRe = RegExp(r'^f[0-9]+$');
return keyData.data.where((Key entry) {
return functionKeyRe.hasMatch(entry.constantName);
}).toList();
}
PlatformCodeGenerator(PhysicalKeyData keyData, LogicalKeyData logicalData)
: super(keyData, logicalData);
/// Absolute path to the output file.
///
/// How this value will be used is based on the callee.
String outputPath(String platform) => path.join(flutterRoot.path, '..', path.join('engine', 'src', 'flutter', 'shell', 'platform', platform, 'keycodes', 'keyboard_map_$platform.h'));
String outputPath(String platform);
static String engineRoot = '';
}
// 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.
/* === LOGICAL KEY BITMASKS === */
// The following constants are used to composite the value for a Flutter logical
// key.
//
// A Flutter logical key supports up to 53-bits, as limited by JavaScript
// integers.
/* Bit 31-0: Value */
// The lower 32 bits represent different values within a plane.
/// Mask for the 32-bit value portion of the code.
const int kValueMask = 0x000FFFFFFFF;
/* Bit 39-32: Source of value */
// The next 8 bits represent where the values come from, consequently how to
// interpret them.
/// Mask for bit #39-32 portion of the code, indicating the source of the value.
const int kPlatformMask = 0x0FF00000000;
/// The code prefix for keys that have a Unicode representation, generated from
/// their code points.
///
/// See also:
///
/// * [kUnprintablePlane], for keys that are also generated from code points but
/// unprintable.
const int kUnicodePlane = 0x00000000000;
/// The code prefix for keys generated from their USB HID usages.
const int kHidPlane = 0x00100000000;
/// The code prefix for unrecognized keys that are unique to Android, generated
/// from platform-specific codes.
const int kAndroidPlane = 0x00200000000;
/// The code prefix for unrecognized keys that are unique to Fuchsia, generated
/// from platform-specific codes.
const int kFuchsiaPlane = 0x00300000000;
/// The code prefix for unrecognized keys that are unique to iOS, generated
/// from platform-specific codes.
const int kIosPlane = 0x00400000000;
/// The code prefix for unrecognized keys that are unique to macOS, generated
/// from platform-specific codes.
const int kMacOsPlane = 0x00500000000;
/// The code prefix for unrecognized keys that are unique to Gtk, generated from
/// platform-specific codes.
const int kGtkPlane = 0x00600000000;
/// The code prefix for unrecognized keys that are unique to Windows, generated
/// from platform-specific codes.
const int kWindowsPlane = 0x00700000000;
/// The code prefix for unrecognized keys that are unique to Web, generated from
/// platform-specific codes.
const int kWebPlane = 0x00800000000;
/// The code prefix for keys that do not have a Unicode representation, generated
/// from their code points.
///
/// See also:
///
/// * [kUnicodePlane], for keys that are also generated from code points but
/// printable.
const int kUnprintablePlane = 0x01000000000;
/* Bit 43-40: Key variation */
// The next 4 bits represent keys that have multiple variations, such as a left
// and right variation of a modifier key, or a Numpad variation of a digit key.
/// Mask for bit #43-40 portion of the code, indicating the variation of the key.
const int kVariationMask = 0xF0000000000;
/// The code prefix for pseudo-keys which represent collections of key synonyms,
/// such as Control.
const int kSynonymPlane = 0x20000000000;
/// The code prefix for the left modifier of a pair of modifiers, such as Control
/// Left.
const int kLeftModifierPlane = 0x30000000000;
/// The code prefix for the right modifier of a pair of modifiers, such as Control
/// Right.
const int kRightModifierPlane = 0x40000000000;
/// The code prefix for a Numpad key, such as Numpad 1.
const int kNumpadPlane = 0x50000000000;
class MaskConstant {
const MaskConstant({required this.name, required this.value, required this.description});
final String name;
final int value;
final List<String> description;
}
const List<MaskConstant> maskConstants = <MaskConstant>[
MaskConstant(
name: 'valueMask',
value: kValueMask,
description: <String>[
'Mask for the 32-bit value portion of the key code.',
'This is used by platform-specific code to generate Flutter key codes.',
],
),
MaskConstant(
name: 'platformMask',
value: kPlatformMask,
description: <String>[
'Mask for the platform prefix portion of the key code.',
'This is used by platform-specific code to generate Flutter key codes.'
],
),
MaskConstant(
name: 'unicodePlane',
value: kUnicodePlane,
description: <String>[
'The code prefix for keys which have a Unicode representation.',
'This is used by platform-specific code to generate Flutter key codes.'
],
),
MaskConstant(
name: 'synonymMask',
value: kSynonymPlane,
description: <String>[
'Mask for the synonym pseudo-keys generated for keys which appear in more than one place on the keyboard.',
'IDs in this range are used to represent keys which appear in multiple places on the keyboard, such as the SHIFT, ALT, CTRL, and numeric keypad keys. These key codes will never be generated by the key event system, but may be used in key maps to represent the union of all the keys of each type in order to match them.',
'To look up the synonyms that are defined, look in the [synonyms] map.'
],
),
MaskConstant(
name: 'hidPlane',
value: kHidPlane,
description: <String>[
'The code prefix for keys which do not have a Unicode representation.',
'This is used by platform-specific code to generate Flutter key codes using HID Usage codes.'
],
),
];
// 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.
import 'package:path/path.dart' as path;
import 'base_code_gen.dart';
import 'key_data.dart';
import 'utils.dart';
/// Generates the key mapping of Fuchsia, based on the information in the key
/// data structure given to it.
class FuchsiaCodeGenerator extends PlatformCodeGenerator {
FuchsiaCodeGenerator(KeyData keyData) : super(keyData);
/// This generates the map of Fuchsia key codes to logical keys.
String get _fuchsiaKeyCodeMap {
final StringBuffer fuchsiaKeyCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
if (entry.usbHidCode != null) {
fuchsiaKeyCodeMap.writeln(' { ${toHex(entry.flutterId)}, ${toHex(entry.flutterId, digits: 10)} }, // ${entry.constantName}');
}
}
return fuchsiaKeyCodeMap.toString().trimRight();
}
/// This generates the map of Fuchsia USB HID codes to physical keys.
String get _fuchsiaHidCodeMap {
final StringBuffer fuchsiaScanCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
if (entry.usbHidCode != null) {
fuchsiaScanCodeMap.writeln(' { ${toHex(entry.usbHidCode)}, ${toHex(entry.usbHidCode)} }, // ${entry.constantName}');
}
}
return fuchsiaScanCodeMap.toString().trimRight();
}
@override
String get templatePath => path.join(flutterRoot.path, 'dev', 'tools', 'gen_keycodes', 'data', 'keyboard_map_fuchsia_cc.tmpl');
@override
Map<String, String> mappings() {
return <String, String>{
'FUCHSIA_SCAN_CODE_MAP': _fuchsiaHidCodeMap,
'FUCHSIA_KEY_CODE_MAP': _fuchsiaKeyCodeMap,
};
}
}
// 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.
import 'package:path/path.dart' as path;
import 'base_code_gen.dart';
import 'key_data.dart';
import 'utils.dart';
/// Generates the key mapping of GLFW, based on the information in the key
/// data structure given to it.
class GlfwCodeGenerator extends PlatformCodeGenerator {
GlfwCodeGenerator(KeyData keyData) : super(keyData);
/// This generates the map of GLFW number pad key codes to logical keys.
String get _glfwNumpadMap {
final StringBuffer glfwNumpadMap = StringBuffer();
for (final Key entry in numpadKeyData) {
if (entry.glfwKeyCodes != null) {
for (final int code in entry.glfwKeyCodes.cast<int>()) {
glfwNumpadMap.writeln(' { $code, ${toHex(entry.flutterId, digits: 10)} }, // ${entry.constantName}');
}
}
}
return glfwNumpadMap.toString().trimRight();
}
/// This generates the map of GLFW key codes to logical keys.
String get _glfwKeyCodeMap {
final StringBuffer glfwKeyCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
if (entry.glfwKeyCodes != null) {
for (final int code in entry.glfwKeyCodes.cast<int>()) {
glfwKeyCodeMap.writeln(' { $code, ${toHex(entry.flutterId, digits: 10)} }, // ${entry.constantName}');
}
}
}
return glfwKeyCodeMap.toString().trimRight();
}
@override
String get templatePath => path.join(flutterRoot.path, 'dev', 'tools', 'gen_keycodes', 'data', 'keyboard_map_glfw_cc.tmpl');
@override
Map<String, String> mappings() {
return <String, String>{
'GLFW_KEY_CODE_MAP': _glfwKeyCodeMap,
'GLFW_NUMPAD_MAP': _glfwNumpadMap,
};
}
}
......@@ -5,33 +5,104 @@
import 'package:path/path.dart' as path;
import 'base_code_gen.dart';
import 'key_data.dart';
import 'logical_key_data.dart';
import 'physical_key_data.dart';
import 'utils.dart';
/// Generates the key mapping of GTK, based on the information in the key
/// Generates the key mapping for GTK, based on the information in the key
/// data structure given to it.
class GtkCodeGenerator extends PlatformCodeGenerator {
GtkCodeGenerator(KeyData keyData) : super(keyData);
GtkCodeGenerator(
PhysicalKeyData keyData,
LogicalKeyData logicalData,
String modifierBitMapping,
String lockBitMapping,
) : _modifierBitMapping = parseMapOfListOfString(modifierBitMapping),
_lockBitMapping = parseMapOfListOfString(lockBitMapping),
super(keyData, logicalData);
/// This generates the map of XKB scan codes to USB HID codes.
String get xkbScanCodeMap {
final StringBuffer xkbScanCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
/// This generates the map of XKB scan codes to Flutter physical keys.
String get _xkbScanCodeMap {
final OutputLines<int> lines = OutputLines<int>('GTK scancode map');
for (final PhysicalKeyEntry entry in keyData.entries) {
if (entry.xKbScanCode != null) {
xkbScanCodeMap.writeln(' { ${toHex(entry.xKbScanCode)}, ${toHex(entry.usbHidCode)} }, // ${entry.constantName}');
lines.add(entry.xKbScanCode!, ' insert_record(table, ${toHex(entry.xKbScanCode)}, ${toHex(entry.usbHidCode)}); // ${entry.constantName}');
}
}
return xkbScanCodeMap.toString().trimRight();
return lines.sortedJoin().trimRight();
}
/// This generates the map of GTK keyval codes to Flutter logical keys.
String get _gtkKeyvalCodeMap {
final OutputLines<int> lines = OutputLines<int>('GTK keyval map');
for (final LogicalKeyEntry entry in logicalData.entries) {
zipStrict(entry.gtkValues, entry.gtkNames, (int value, String name) {
lines.add(value, ' insert_record(table, ${toHex(value)}, ${toHex(entry.value, digits: 11)}); // $name');
});
}
return lines.sortedJoin().trimRight();
}
static String constructMapFromModToKeys(
Map<String, List<String>> source,
PhysicalKeyData physicalData,
LogicalKeyData logicalData,
String debugFunctionName,
) {
final StringBuffer result = StringBuffer();
source.forEach((String modifierBitName, List<String> keyNames) {
assert(keyNames.length == 2 || keyNames.length == 3);
final String primaryLogicalName = keyNames[0];
final String primaryPhysicalName = keyNames[1];
final String? secondaryPhysicalName = keyNames.length == 3 ? keyNames[2] : null;
final LogicalKeyEntry primaryLogical = logicalData.entryByName(primaryLogicalName);
final PhysicalKeyEntry primaryPhysical = physicalData.entryByName(primaryPhysicalName);
final PhysicalKeyEntry? secondaryPhysical = secondaryPhysicalName == null ? null : physicalData.entryByName(secondaryPhysicalName);
if (secondaryPhysical == null && secondaryPhysicalName != null) {
print('Unrecognized secondary physical key $secondaryPhysicalName specified for $debugFunctionName.');
return;
}
final String pad = secondaryPhysical == null ? '' : ' ';
result.writeln('''
data = g_new(FlKeyEmbedderCheckedKey, 1);
g_hash_table_insert(table, GUINT_TO_POINTER(GDK_${modifierBitName}_MASK), data);
data->is_caps_lock = ${primaryPhysicalName == 'CapsLock' ? 'true' : 'false'};
data->primary_logical_key = ${toHex(primaryLogical.value, digits: 11)};$pad // ${primaryLogical.constantName}
data->primary_physical_key = ${toHex(primaryPhysical.usbHidCode, digits: 9)};$pad // ${primaryPhysical.constantName}''');
if (secondaryPhysical != null) {
result.writeln('''
data->secondary_physical_key = ${toHex(secondaryPhysical.usbHidCode, digits: 9)}; // ${secondaryPhysical.constantName}''');
}
});
return result.toString().trimRight();
}
String get _gtkModifierBitMap {
return constructMapFromModToKeys(_modifierBitMapping, keyData, logicalData, 'gtkModifierBitMap');
}
final Map<String, List<String>> _modifierBitMapping;
String get _gtkModeBitMap {
return constructMapFromModToKeys(_lockBitMapping, keyData, logicalData, 'gtkModeBitMap');
}
final Map<String, List<String>> _lockBitMapping;
@override
String get templatePath => path.join(dataRoot, 'gtk_key_mapping_cc.tmpl');
@override
String get templatePath => path.join(flutterRoot.path, 'dev', 'tools', 'gen_keycodes', 'data', 'keyboard_map_linux_cc.tmpl');
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
'shell', 'platform', 'linux', 'key_mapping.cc');
@override
Map<String, String> mappings() {
return <String, String>{
'XKB_SCAN_CODE_MAP': xkbScanCodeMap,
'XKB_SCAN_CODE_MAP': _xkbScanCodeMap,
'GTK_KEYVAL_CODE_MAP': _gtkKeyvalCodeMap,
'GTK_MODIFIER_BIT_MAP': _gtkModifierBitMap,
'GTK_MODE_BIT_MAP': _gtkModeBitMap,
};
}
}
// 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.
import 'package:path/path.dart' as path;
import 'base_code_gen.dart';
import 'key_data.dart';
import 'utils.dart';
/// Generates the key mapping of iOS, based on the information in the key
/// data structure given to it.
class IosCodeGenerator extends PlatformCodeGenerator {
IosCodeGenerator(KeyData keyData) : super(keyData);
/// This generates the map of iOS key codes to physical keys.
String get _iosScanCodeMap {
final StringBuffer iosScanCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
if (entry.iosScanCode != null) {
iosScanCodeMap.writeln(' { ${toHex(entry.iosScanCode)}, ${toHex(entry.usbHidCode)} }, // ${entry.constantName}');
}
}
return iosScanCodeMap.toString().trimRight();
}
/// This generates the map of iOS number pad key codes to logical keys.
String get _iosNumpadMap {
final StringBuffer iosNumPadMap = StringBuffer();
for (final Key entry in numpadKeyData) {
if (entry.iosScanCode != null) {
iosNumPadMap.writeln(' { ${toHex(entry.iosScanCode)}, ${toHex(entry.flutterId, digits: 10)} }, // ${entry.constantName}');
}
}
return iosNumPadMap.toString().trimRight();
}
@override
String get templatePath => path.join(flutterRoot.path, 'dev', 'tools', 'gen_keycodes', 'data', 'keyboard_map_ios_cc.tmpl');
@override
String outputPath(String platform) => path.joinAll(<String>[flutterRoot.path, '..', 'engine', 'src', 'flutter', 'shell', 'platform', 'darwin', platform, 'keycodes', 'keyboard_map_$platform.h']);
@override
Map<String, String> mappings() {
// There is no iOS keycode map since iOS uses keycode to represent a physical key.
// The LogicalKeyboardKey is generated by raw_keyboard_macos.dart from the unmodified characters
// from NSEvent.
return <String, String>{
'IOS_SCAN_CODE_MAP': _iosScanCodeMap,
'IOS_NUMPAD_MAP': _iosNumpadMap
};
}
}
This diff is collapsed.
......@@ -5,39 +5,40 @@
import 'package:path/path.dart' as path;
import 'base_code_gen.dart';
import 'key_data.dart';
import 'constants.dart';
import 'logical_key_data.dart';
import 'physical_key_data.dart';
import 'utils.dart';
/// Given an [input] string, wraps the text at 80 characters and prepends each
/// line with the [prefix] string. Use for generated comments.
String _wrapString(String input, {String prefix = ' /// '}) {
final int wrapWidth = 80 - prefix.length;
final StringBuffer result = StringBuffer();
final List<String> words = input.split(RegExp(r'\s+'));
String currentLine = words.removeAt(0);
for (final String word in words) {
if ((currentLine.length + word.length) < wrapWidth) {
currentLine += ' $word';
} else {
result.writeln('$prefix$currentLine');
currentLine = word;
}
}
if (currentLine.isNotEmpty) {
result.writeln('$prefix$currentLine');
}
return result.toString();
String _wrapString(String input) {
return wrapString(input, prefix: ' /// ');
}
class SynonymKeyInfo {
SynonymKeyInfo(this.keys, this.name);
final List<LogicalKeyEntry> keys;
final String name;
// Use the first item in the synonyms as a template for the ID to use.
// It won't end up being the same value because it'll be in the pseudo-key
// plane.
LogicalKeyEntry get primaryKey => keys[0];
int get value => (primaryKey.value & ~kVariationMask) + kSynonymPlane;
String get constantName => upperCamelToLowerCamel(name);
}
/// Generates the keyboard_keys.dart based on the information in the key data
/// Generates the keyboard_key.dart based on the information in the key data
/// structure given to it.
class KeyboardKeysCodeGenerator extends BaseCodeGenerator {
KeyboardKeysCodeGenerator(KeyData keyData) : super(keyData);
KeyboardKeysCodeGenerator(PhysicalKeyData keyData, LogicalKeyData logicalData) : super(keyData, logicalData);
/// Gets the generated definitions of PhysicalKeyboardKeys.
String get _physicalDefinitions {
final StringBuffer definitions = StringBuffer();
for (final Key entry in keyData.data) {
for (final PhysicalKeyEntry entry in keyData.entries) {
final String firstComment = _wrapString('Represents the location of the '
'"${entry.commentName}" key on a generalized keyboard.');
final String otherComments = _wrapString('See the function '
......@@ -53,7 +54,7 @@ $otherComments static const PhysicalKeyboardKey ${entry.constantName} = Physica
String get _physicalDebugNames {
final StringBuffer result = StringBuffer();
for (final Key entry in keyData.data) {
for (final PhysicalKeyEntry entry in keyData.entries) {
result.write('''
${toHex(entry.usbHidCode, digits: 8)}: '${entry.commentName}',
''');
......@@ -64,7 +65,7 @@ $otherComments static const PhysicalKeyboardKey ${entry.constantName} = Physica
/// Gets the generated definitions of LogicalKeyboardKeys.
String get _logicalDefinitions {
final StringBuffer definitions = StringBuffer();
void printKey(int flutterId, String constantName, String commentName, {String otherComments}) {
void printKey(int flutterId, String constantName, String commentName, {String? otherComments}) {
final String firstComment = _wrapString('Represents the logical "$commentName" key on the keyboard.');
otherComments ??= _wrapString('See the function [RawKeyEvent.logicalKey] for more information.');
definitions.write('''
......@@ -74,22 +75,20 @@ $otherComments static const LogicalKeyboardKey $constantName = LogicalKeyboardK
''');
}
for (final Key entry in keyData.data) {
for (final LogicalKeyEntry entry in logicalData.entries) {
printKey(
entry.flutterId,
entry.value,
entry.constantName,
entry.commentName,
);
}
for (final String name in Key.synonyms.keys) {
for (final SynonymKeyInfo synonymInfo in synonyms) {
// Use the first item in the synonyms as a template for the ID to use.
// It won't end up being the same value because it'll be in the pseudo-key
// plane.
final Key entry = keyData.data.firstWhere((Key item) => item.name == Key.synonyms[name][0]);
final Set<String> unionNames = Key.synonyms[name].map<String>((dynamic name) {
return upperCamelToLowerCamel(name as String);
}).toSet();
printKey(Key.synonymPlane | entry.flutterId, name, Key.getCommentName(name),
final Set<String> unionNames = synonymInfo.keys.map(
(LogicalKeyEntry entry) => entry.constantName).toSet();
printKey(synonymInfo.value, synonymInfo.constantName, PhysicalKeyEntry.getCommentName(synonymInfo.name),
otherComments: _wrapString('This key represents the union of the keys '
'$unionNames when comparing keys. This key will never be generated '
'directly, its main use is in defining key maps.'));
......@@ -98,30 +97,26 @@ $otherComments static const LogicalKeyboardKey $constantName = LogicalKeyboardK
}
String get _logicalSynonyms {
final StringBuffer synonyms = StringBuffer();
for (final String name in Key.synonyms.keys) {
for (final String synonym in Key.synonyms[name].cast<String>()) {
final String keyName = upperCamelToLowerCamel(synonym);
synonyms.writeln(' $keyName: $name,');
final StringBuffer result = StringBuffer();
for (final SynonymKeyInfo synonymInfo in synonyms) {
for (final LogicalKeyEntry key in synonymInfo.keys) {
final String synonymName = upperCamelToLowerCamel(synonymInfo.name);
result.writeln(' ${key.constantName}: $synonymName,');
}
}
return synonyms.toString();
return result.toString();
}
String get _logicalKeyLabels {
final StringBuffer result = StringBuffer();
for (final Key entry in keyData.data) {
for (final LogicalKeyEntry entry in logicalData.entries) {
result.write('''
${toHex(entry.flutterId, digits: 11)}: '${entry.commentName}',
${toHex(entry.value, digits: 11)}: '${entry.commentName}',
''');
}
for (final String name in Key.synonyms.keys) {
// Use the first item in the synonyms as a template for the ID to use.
// It won't end up being the same value because it'll be in the pseudo-key
// plane.
final Key entry = keyData.data.firstWhere((Key item) => item.name == Key.synonyms[name][0]);
for (final SynonymKeyInfo synonymInfo in synonyms) {
result.write('''
${toHex(Key.synonymPlane | entry.flutterId, digits: 11)}: '${Key.getCommentName(name)}',
${toHex(synonymInfo.value)}: '${synonymInfo.name}',
''');
}
return result.toString();
......@@ -130,7 +125,7 @@ $otherComments static const LogicalKeyboardKey $constantName = LogicalKeyboardK
/// This generates the map of USB HID codes to physical keys.
String get _predefinedHidCodeMap {
final StringBuffer scanCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
for (final PhysicalKeyEntry entry in keyData.entries) {
scanCodeMap.writeln(' ${toHex(entry.usbHidCode)}: ${entry.constantName},');
}
return scanCodeMap.toString().trimRight();
......@@ -139,35 +134,39 @@ $otherComments static const LogicalKeyboardKey $constantName = LogicalKeyboardK
/// This generates the map of Flutter key codes to logical keys.
String get _predefinedKeyCodeMap {
final StringBuffer keyCodeMap = StringBuffer();
for (final Key entry in keyData.data) {
keyCodeMap.writeln(' ${toHex(entry.flutterId, digits: 10)}: ${entry.constantName},');
for (final LogicalKeyEntry entry in logicalData.entries) {
keyCodeMap.writeln(' ${toHex(entry.value, digits: 11)}: ${entry.constantName},');
}
for (final String entry in Key.synonyms.keys) {
// Use the first item in the synonyms as a template for the ID to use.
// It won't end up being the same value because it'll be in the pseudo-key
// plane.
final Key primaryKey = keyData.data.firstWhere((Key item) {
return item.name == Key.synonyms[entry][0];
}, orElse: () => null);
assert(primaryKey != null);
keyCodeMap.writeln(' ${toHex(Key.synonymPlane | primaryKey.flutterId, digits: 10)}: $entry,');
for (final SynonymKeyInfo synonymInfo in synonyms) {
keyCodeMap.writeln(' ${toHex(synonymInfo.value, digits: 11)}: ${synonymInfo.constantName},');
}
return keyCodeMap.toString().trimRight();
}
@override
String get templatePath => path.join(flutterRoot.path, 'dev', 'tools', 'gen_keycodes', 'data', 'keyboard_key.tmpl');
String get templatePath => path.join(dataRoot, 'keyboard_key.tmpl');
@override
Map<String, String> mappings() {
return <String, String>{
'PHYSICAL_KEY_MAP': _predefinedHidCodeMap,
'LOGICAL_KEY_MAP': _predefinedKeyCodeMap,
'LOGICAL_KEY_DEFINITIONS': _logicalDefinitions,
'LOGICAL_KEY_SYNONYMS': _logicalSynonyms,
'LOGICAL_KEY_KEY_LABELS': _logicalKeyLabels,
'PHYSICAL_KEY_MAP': _predefinedHidCodeMap,
'PHYSICAL_KEY_DEFINITIONS': _physicalDefinitions,
'PHYSICAL_KEY_DEBUG_NAMES': _physicalDebugNames,
};
}
late final List<SynonymKeyInfo> synonyms = LogicalKeyData.synonyms.entries.map(
(MapEntry<String, List<String>> synonymDefinition) {
final List<LogicalKeyEntry> entries = synonymDefinition.value.map(
(String name) => logicalData.entryByName(name)).toList();
return SynonymKeyInfo(
entries,
synonymDefinition.key,
);
}
).toList();
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@ name: gen_keycodes
description: Generates keycode source files from various resources.
environment:
sdk: ">=2.2.2 <3.0.0"
sdk: ">=2.12.0-0 <3.0.0"
dependencies:
args: 2.1.0
......
......@@ -107,6 +107,14 @@ class RawKeyEventDataIos extends RawKeyEventData {
if (newKey != null) {
return newKey;
}
// Keys that can't be derived with characterIgnoringModifiers will be
// derived from their key codes using this map.
final LogicalKeyboardKey? knownKey = kIosToLogicalKey[keyCode];
if (knownKey != null) {
return knownKey;
}
// If this key is printable, generate the LogicalKeyboardKey from its
// Unicode value. Control keys such as ESC, CRTL, and SHIFT are not
// printable. HOME, DEL, arrow keys, and function keys are considered
......
......@@ -76,6 +76,14 @@ class RawKeyEventDataMacOs extends RawKeyEventData {
if (numPadKey != null) {
return numPadKey;
}
// Keys that can't be derived with characterIgnoringModifiers will be
// derived from their key codes using this map.
final LogicalKeyboardKey? knownKey = kMacOsToLogicalKey[keyCode];
if (knownKey != null) {
return knownKey;
}
// If this key is printable, generate the LogicalKeyboardKey from its
// Unicode value. Control keys such as ESC, CRTL, and SHIFT are not
// printable. HOME, DEL, arrow keys, and function keys are considered
......
......@@ -29,11 +29,11 @@ void main() {
group(LogicalKeyboardKey, () {
test('Various classes of keys can be looked up by code', () async {
// Check a letter key
expect(LogicalKeyboardKey.findKeyByKeyId(0x0000000061), equals(LogicalKeyboardKey.keyA));
expect(LogicalKeyboardKey.findKeyByKeyId(LogicalKeyboardKey.keyA.keyId), equals(LogicalKeyboardKey.keyA));
// Check a control key
expect(LogicalKeyboardKey.findKeyByKeyId(0x0100070029), equals(LogicalKeyboardKey.escape));
expect(LogicalKeyboardKey.findKeyByKeyId(LogicalKeyboardKey.escape.keyId), equals(LogicalKeyboardKey.escape));
// Check a modifier key
expect(LogicalKeyboardKey.findKeyByKeyId(0x01000700e1), equals(LogicalKeyboardKey.shiftLeft));
expect(LogicalKeyboardKey.findKeyByKeyId(LogicalKeyboardKey.shiftLeft.keyId), equals(LogicalKeyboardKey.shiftLeft));
});
test('Control characters are recognized as such', () async {
// Check some common control characters
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment