Fix the character field of the RawKeyEvent to hold correct data on non-Android platforms. (#65667)

This fixes a problem where the character field of the RawKeyEvent was not being set at all for non-Android platforms.

I also updated the key maps, and corrected a problem with the Windows key map where the backquote character wasn't correctly mapped.
This commit is contained in:
Greg Spencer
2020-09-15 13:02:16 -07:00
committed by GitHub
parent b8a39c15f8
commit 199a7c1964
8 changed files with 78 additions and 17 deletions

View File

@@ -79,6 +79,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
final String modifierList = data.modifiersPressed.keys.map<String>(_getEnumName).join(', ').replaceAll('Modifier', '');
final List<Widget> dataText = <Widget>[
Text('${_event.runtimeType}'),
if (_event.character?.isNotEmpty ?? false) Text('character produced: "${_event.character}"'),
Text('modifiers set: $modifierList'),
];
if (data is RawKeyEventDataAndroid) {
@@ -114,6 +115,10 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
dataText.add(Text('scanCode: ${data.scanCode}'));
dataText.add(Text('characterCodePoint: ${data.characterCodePoint}'));
dataText.add(Text('modifiers: ${data.modifiers} (${_asHex(data.modifiers)})'));
} else if (data is RawKeyEventDataWeb) {
dataText.add(Text('key: ${data.key}'));
dataText.add(Text('code: ${data.code}'));
dataText.add(Text('metaState: ${data.metaState} (${_asHex(data.metaState)})'));
}
dataText.add(Text('logical: ${_event.logicalKey}'));
dataText.add(Text('physical: ${_event.physicalKey}'));

View File

@@ -2472,7 +2472,9 @@
"gtk": [
"quoteleft"
],
"windows": null
"windows": [
"OEM_3"
]
},
"scanCodes": {
"android": [
@@ -2494,7 +2496,9 @@
"gtk": [
96
],
"windows": null
"windows": [
192
]
}
},
"comma": {
@@ -6565,7 +6569,9 @@
"windows": null
},
"scanCodes": {
"android": null,
"android": [
370
],
"usb": 786529,
"linux": 370,
"xkb": 378,
@@ -6822,7 +6828,9 @@
"windows": null
},
"scanCodes": {
"android": null,
"android": [
405
],
"usb": 786563,
"linux": 405,
"xkb": 413,
@@ -7891,7 +7899,9 @@
"windows": null
},
"scanCodes": {
"android": null,
"android": [
583
],
"usb": 786891,
"linux": 583,
"xkb": 591,

View File

@@ -132,7 +132,7 @@
"minus": ["OEM_MINUS"],
"period": ["OEM_PERIOD"],
"slash": ["OEM_2"],
"backQuote": ["OEM_3"],
"backquote": ["OEM_3"],
"gamepadA": ["GAMEPAD_A"],
"gamepadB": ["GAMEPAD_B"],
"gamepadX": ["GAMEPAD_X"],

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
// This file is generated by dev/tools/gen_keycodes/bin/gen_keycodes.dart and
// should not be edited directly.