diff --git a/dev/tools/gen_keycodes/bin/gen_keycodes.dart b/dev/tools/gen_keycodes/bin/gen_keycodes.dart index fa49600cfab5..156de145303e 100644 --- a/dev/tools/gen_keycodes/bin/gen_keycodes.dart +++ b/dev/tools/gen_keycodes/bin/gen_keycodes.dart @@ -65,7 +65,7 @@ Future getGlfwKeyCodes() async { } Future getGtkKeyCodes() async { - final Uri keyCodesUri = Uri.parse('https://gitlab.gnome.org/GNOME/gtk/-/raw/master/gdk/gdkkeysyms.h'); + final Uri keyCodesUri = Uri.parse('https://gitlab.gnome.org/GNOME/gtk/-/raw/gtk-3-24/gdk/gdkkeysyms.h'); return http.read(keyCodesUri); } diff --git a/dev/tools/gen_keycodes/data/android_key_name_to_name.json b/dev/tools/gen_keycodes/data/android_key_name_to_name.json index 3f8c991dd66d..51e0269fff99 100644 --- a/dev/tools/gen_keycodes/data/android_key_name_to_name.json +++ b/dev/tools/gen_keycodes/data/android_key_name_to_name.json @@ -201,7 +201,6 @@ "NavigatePrevious": ["NAVIGATE_PREVIOUS"], "NewKey": ["NEW"], "NonConvert": ["MUHENKAN"], - "None": ["UNKNOWN"], "Notification": ["NOTIFICATION"], "NumLock": ["NUM_LOCK"], "NumberSign": ["POUND"], diff --git a/dev/tools/gen_keycodes/data/gtk_logical_name_mapping.json b/dev/tools/gen_keycodes/data/gtk_logical_name_mapping.json index 2c73091d9899..1a2bd2b868ae 100644 --- a/dev/tools/gen_keycodes/data/gtk_logical_name_mapping.json +++ b/dev/tools/gen_keycodes/data/gtk_logical_name_mapping.json @@ -101,8 +101,6 @@ "IntlYen": ["yen"], "KanjiMode": ["Kanji"], "Katakana": ["Katakana"], - "KbdIllumDown": ["KbdBrightnessDown"], - "KbdIllumUp": ["KbdBrightnessUp"], "LaunchAudioBrowser": ["Music"], "LaunchCalendar": ["Calendar"], "LaunchDocuments": ["Document"], diff --git a/dev/tools/gen_keycodes/data/keyboard_key.tmpl b/dev/tools/gen_keycodes/data/keyboard_key.tmpl index 834611482cda..e13e03582fbe 100644 --- a/dev/tools/gen_keycodes/data/keyboard_key.tmpl +++ b/dev/tools/gen_keycodes/data/keyboard_key.tmpl @@ -166,10 +166,12 @@ class LogicalKeyboardKey extends KeyboardKey { @override bool operator ==(Object other) { - if (identical(this, other)) + if (identical(this, other)) { return true; - if (other.runtimeType != runtimeType) + } + if (other.runtimeType != runtimeType) { return false; + } return other is LogicalKeyboardKey && other.keyId == keyId; } @@ -348,10 +350,12 @@ class PhysicalKeyboardKey extends KeyboardKey { @override bool operator ==(Object other) { - if (identical(this, other)) + if (identical(this, other)) { return true; - if (other.runtimeType != runtimeType) + } + if (other.runtimeType != runtimeType) { return false; + } return other is PhysicalKeyboardKey && other.usbHidUsage == usbHidUsage; } diff --git a/dev/tools/gen_keycodes/lib/keyboard_maps_code_gen.dart b/dev/tools/gen_keycodes/lib/keyboard_maps_code_gen.dart index a30e59859595..39d4dc255495 100644 --- a/dev/tools/gen_keycodes/lib/keyboard_maps_code_gen.dart +++ b/dev/tools/gen_keycodes/lib/keyboard_maps_code_gen.dart @@ -305,8 +305,8 @@ class KeyboardMapsCodeGenerator extends BaseCodeGenerator { String get _webPhysicalKeyMap { final OutputLines lines = OutputLines('Web physical key map'); for (final PhysicalKeyEntry entry in keyData.entries) { - if (entry.name != null) { - lines.add(entry.name, " '${entry.name}': PhysicalKeyboardKey.${entry.constantName},"); + for (final String webCodes in entry.webCodes()) { + lines.add(entry.name, " '$webCodes': PhysicalKeyboardKey.${entry.constantName},"); } } return lines.sortedJoin().trimRight(); diff --git a/dev/tools/gen_keycodes/lib/logical_key_data.dart b/dev/tools/gen_keycodes/lib/logical_key_data.dart index a7d0d72843e2..5439e922d642 100644 --- a/dev/tools/gen_keycodes/lib/logical_key_data.dart +++ b/dev/tools/gen_keycodes/lib/logical_key_data.dart @@ -372,6 +372,9 @@ class LogicalKeyData { glfwNameToKeyCode.forEach((String glfwName, int value) { final String? name = nameToFlutterName[glfwName]; + if (name == null) { + return; + } final LogicalKeyEntry? entry = data[nameToFlutterName[glfwName]]; if (entry == null) { print('Invalid logical entry by name $name (from GLFW $glfwName)'); diff --git a/dev/tools/gen_keycodes/lib/physical_key_data.dart b/dev/tools/gen_keycodes/lib/physical_key_data.dart index 5e071a2305e5..49829930371e 100644 --- a/dev/tools/gen_keycodes/lib/physical_key_data.dart +++ b/dev/tools/gen_keycodes/lib/physical_key_data.dart @@ -259,6 +259,12 @@ class PhysicalKeyEntry { /// The Chromium event code for the key. final String? chromiumCode; + Iterable webCodes() sync* { + if (chromiumCode != null) { + yield chromiumCode!; + } + } + /// Creates a JSON map from the key data. Map toJson() { return removeEmptyValues({ diff --git a/dev/tools/gen_keycodes/lib/testing_key_codes_java_gen.dart b/dev/tools/gen_keycodes/lib/testing_key_codes_java_gen.dart index 4660f74e4630..281f6c26ce08 100644 --- a/dev/tools/gen_keycodes/lib/testing_key_codes_java_gen.dart +++ b/dev/tools/gen_keycodes/lib/testing_key_codes_java_gen.dart @@ -35,7 +35,7 @@ class KeyCodesJavaGenerator extends BaseCodeGenerator { final OutputLines lines = OutputLines('Physical Key list'); for (final PhysicalKeyEntry entry in keyData.entries) { lines.add(entry.usbHidCode, ''' - public static final long PHYSICAL_${_toUpperSnake(entry.constantName)} = ${toHex(entry.usbHidCode)}l;'''); + public static final long PHYSICAL_${_toUpperSnake(entry.constantName)} = ${toHex(entry.usbHidCode)}L;'''); } return lines.sortedJoin().trimRight(); } @@ -45,7 +45,7 @@ class KeyCodesJavaGenerator extends BaseCodeGenerator { final OutputLines lines = OutputLines('Logical Key list'); for (final LogicalKeyEntry entry in logicalData.entries) { lines.add(entry.value, ''' - public static final long LOGICAL_${_toUpperSnake(entry.constantName)} = ${toHex(entry.value, digits: 11)}l;'''); + public static final long LOGICAL_${_toUpperSnake(entry.constantName)} = ${toHex(entry.value, digits: 11)}L;'''); } return lines.sortedJoin().trimRight(); } diff --git a/dev/tools/gen_keycodes/lib/web_code_gen.dart b/dev/tools/gen_keycodes/lib/web_code_gen.dart index 09bf0705954d..3dca72b055d1 100644 --- a/dev/tools/gen_keycodes/lib/web_code_gen.dart +++ b/dev/tools/gen_keycodes/lib/web_code_gen.dart @@ -37,9 +37,9 @@ class WebCodeGenerator extends PlatformCodeGenerator { String get _webPhysicalKeyCodeMap { final OutputLines lines = OutputLines('Web physical map'); for (final PhysicalKeyEntry entry in keyData.entries) { - if (entry.name != null) { - lines.add(entry.name, - " '${entry.name}': ${toHex(entry.usbHidCode)}, // ${entry.constantName}"); + for (final String webCode in entry.webCodes()) { + lines.add(webCode, + " '$webCode': ${toHex(entry.usbHidCode)}, // ${entry.constantName}"); } } return lines.sortedJoin().trimRight(); diff --git a/packages/flutter/lib/src/services/keyboard_maps.dart b/packages/flutter/lib/src/services/keyboard_maps.dart index 89453719af7e..0c26814e1f9d 100644 --- a/packages/flutter/lib/src/services/keyboard_maps.dart +++ b/packages/flutter/lib/src/services/keyboard_maps.dart @@ -2459,14 +2459,9 @@ const Map kWebToPhysicalKey = kWebToPhysicalKey = kWebToPhysicalKey = kWebToPhysicalKey = kWebToPhysicalKey = kWebToPhysicalKey = kWebToPhysicalKey = kWebToPhysicalKey = kWebToPhysicalKey =