Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macOS fn key support. #44410

Merged
merged 3 commits into from Nov 9, 2019
Merged

Add macOS fn key support. #44410

merged 3 commits into from Nov 9, 2019

Conversation

@gspencergoog
Copy link
Contributor

gspencergoog commented Nov 8, 2019

Description

This adds support for the fn key on macOS. It adds it to the key mappings as a supplemental mapping that overwrites the one from the Chrome headers, since the chrome headers have a TODO, but no implementation of the key.

Also, ignore the fn key entirely on macOS. This is because On macOS laptop keyboards, the fn key is used to generate home/end and f1-f12, but it ALSO generates a separate down/up event for the fn key itself. Other platforms hide the fn key, and just produce the key that it is combined with, so to keep it possible to write cross platform code that looks at which keys are pressed, the fn key is ignored.

Tests

  • Added a test to make sure the fn key is ignored on macOS.

Breaking Change

  • No, this is not a breaking change.
gspencergoog added 3 commits Nov 6, 2019
Copy link
Contributor

darrenaustin left a comment

Didn't completely follow everything here, but it LGTM.

@@ -502,6 +502,15 @@ class RawKeyboard {
if (event == null) {
return;
}
if (event.data is RawKeyEventDataMacOs && event.logicalKey == LogicalKeyboardKey.fn) {

This comment has been minimized.

Copy link
@darrenaustin

darrenaustin Nov 8, 2019

Contributor

Does RawKeyEventDataMacOs only apply to macOS, or is it the entire Apple platform (i.e. iOS, iPadOS, etc)?

This comment has been minimized.

Copy link
@gspencergoog

gspencergoog Nov 8, 2019

Author Contributor

It only applies to macOS. We don't have any keyboard support on iOS at all (yet).

@gspencergoog gspencergoog merged commit c921c5a into flutter:master Nov 9, 2019
100 checks passed
100 checks passed
add_to_app_tests-macos Task Summary
Details
WIP Ready for review
Details
add_to_app_tests-macos
Details
analyze-linux Task Summary
Details
analyze-linux
Details
build_tests-linux Task Summary
Details
build_tests-linux
Details
build_tests-macos Task Summary
Details
build_tests-macos
Details
build_tests-windows Task Summary
Details
build_tests-windows
Details
cla/google All necessary CLAs are signed
customer_testing-linux Task Summary
Details
customer_testing-linux
Details
customer_testing-macos Task Summary
Details
customer_testing-macos
Details
customer_testing-windows Task Summary
Details
customer_testing-windows
Details
deploy_gallery-linux Task Summary
Details
deploy_gallery-linux
Details
deploy_gallery-macos Task Summary
Details
deploy_gallery-macos
Details
docs-linux Task Summary
Details
docs-linux
Details
firebase_test_lab_tests-linux Task Summary
Details
firebase_test_lab_tests-linux
Details
flutter-build
Details
framework_tests-libraries-linux Task Summary
Details
framework_tests-libraries-linux
Details
framework_tests-libraries-macos Task Summary
Details
framework_tests-libraries-macos
Details
framework_tests-libraries-windows Task Summary
Details
framework_tests-libraries-windows
Details
framework_tests-misc-linux Task Summary
Details
framework_tests-misc-linux
Details
framework_tests-misc-macos Task Summary
Details
framework_tests-misc-macos
Details
framework_tests-misc-windows Task Summary
Details
framework_tests-misc-windows
Details
framework_tests-widgets-linux Task Summary
Details
framework_tests-widgets-linux
Details
framework_tests-widgets-macos Task Summary
Details
framework_tests-widgets-macos
Details
framework_tests-widgets-windows Task Summary
Details
framework_tests-widgets-windows
Details
hostonly_devicelab_tests-0-linux Task Summary
Details
hostonly_devicelab_tests-0-linux
Details
hostonly_devicelab_tests-0-macos Task Summary
Details
hostonly_devicelab_tests-0-macos
Details
hostonly_devicelab_tests-0-windows Task Summary
Details
hostonly_devicelab_tests-0-windows
Details
hostonly_devicelab_tests-1-linux Task Summary
Details
hostonly_devicelab_tests-1-linux
Details
hostonly_devicelab_tests-1-macos Task Summary
Details
hostonly_devicelab_tests-1-macos
Details
hostonly_devicelab_tests-1-windows Task Summary
Details
hostonly_devicelab_tests-1-windows
Details
hostonly_devicelab_tests-2-linux Task Summary
Details
hostonly_devicelab_tests-2-linux
Details
hostonly_devicelab_tests-2-macos Task Summary
Details
hostonly_devicelab_tests-2-macos
Details
hostonly_devicelab_tests-2-windows Task Summary
Details
hostonly_devicelab_tests-2-windows
Details
hostonly_devicelab_tests-3_last-linux Task Summary
Details
hostonly_devicelab_tests-3_last-linux
Details
hostonly_devicelab_tests-3_last-macos Task Summary
Details
hostonly_devicelab_tests-3_last-macos
Details
hostonly_devicelab_tests-3_last-windows Task Summary
Details
hostonly_devicelab_tests-3_last-windows
Details
tool_tests-commands-linux Task Summary
Details
tool_tests-commands-linux
Details
tool_tests-commands-macos Task Summary
Details
tool_tests-commands-macos
Details
tool_tests-commands-windows Task Summary
Details
tool_tests-commands-windows
Details
tool_tests-general-linux Task Summary
Details
tool_tests-general-linux
Details
tool_tests-general-macos Task Summary
Details
tool_tests-general-macos
Details
tool_tests-general-windows Task Summary
Details
tool_tests-general-windows
Details
tool_tests-integration-linux Task Summary
Details
tool_tests-integration-linux
Details
tool_tests-integration-macos Task Summary
Details
tool_tests-integration-macos
Details
tool_tests-integration-windows Task Summary
Details
tool_tests-integration-windows
Details
web_tests-0-linux Task Summary
Details
web_tests-0-linux
Details
web_tests-1-linux Task Summary
Details
web_tests-1-linux
Details
web_tests-2-linux Task Summary
Details
web_tests-2-linux
Details
web_tests-3-linux Task Summary
Details
web_tests-3-linux
Details
web_tests-4-linux Task Summary
Details
web_tests-4-linux
Details
web_tests-5-linux Task Summary
Details
web_tests-5-linux
Details
web_tests-6-linux Task Summary
Details
sahandevs added a commit to sahandevs/flutter that referenced this pull request Nov 15, 2019
This adds support for the fn key on macOS. It adds it to the key mappings as a supplemental mapping that overwrites the one from the Chrome headers, since the chrome headers have a TODO, but no implementation of the key.

Also, ignore the fn key entirely on macOS. This is because On macOS laptop keyboards, the fn key is used to generate home/end and f1-f12, but it ALSO generates a separate down/up event for the fn key itself. Other platforms hide the fn key, and just produce the key that it is combined with, so to keep it possible to write cross platform code that looks at which keys are pressed, the fn key is ignored.
sahandevs added a commit to sahandevs/flutter that referenced this pull request Nov 15, 2019
This adds support for the fn key on macOS. It adds it to the key mappings as a supplemental mapping that overwrites the one from the Chrome headers, since the chrome headers have a TODO, but no implementation of the key.

Also, ignore the fn key entirely on macOS. This is because On macOS laptop keyboards, the fn key is used to generate home/end and f1-f12, but it ALSO generates a separate down/up event for the fn key itself. Other platforms hide the fn key, and just produce the key that it is combined with, so to keep it possible to write cross platform code that looks at which keys are pressed, the fn key is ignored.
sahandevs added a commit to sahandevs/flutter that referenced this pull request Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.