X Tutup
The Wayback Machine - https://web.archive.org/web/20200906074217/https://github.com/flutter/flutter/pull/65193
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

Generate RawKeyEvents for iOS 13.4+ #65193

Open
wants to merge 7 commits into
base: master
from

Conversation

@KammererTob
Copy link

KammererTob commented Sep 3, 2020

This is based on the UIKey introduction in 13.4 and this PR: flutter/engine#20972

Description

This PR generates RawKeyEventData for iOS and in turn RawKeyDownEvent and RawKeyUpEvent appropriately.
The mapping for the keyCodes to PhysicalKeyboardKeys was done based on this documentation: https://developer.apple.com/documentation/uikit/uikeyboardhidusage?language=objc, which seems to be a complete copy of the usage table found here: https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
I have not included every key listed there since they seemed to be very hardware specific, but i can add them if desired.

I also noticed that the RawKeyDownEvent has a character property which is filled with message['character']. This does not work for MacOs and iOS since it is called "characters" for both of them. I was not sure if this was intentional or an oversight. Should this be changed to "character" for iOS and MacOS?

This PR depends on an engine PR: flutter/engine#20972, although it should not be breaking even without this.

Related Issues

#31945

Tests

I added iOS as a platform to the already excellent tests for the other platforms. I also added specific tests for iOS in the style of other tests already existing for other platforms.

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • No, no existing tests failed, so this is not a breaking change.
KammererTob added 3 commits Sep 1, 2020
@KammererTob KammererTob marked this pull request as draft Sep 3, 2020
@KammererTob
Copy link
Author

KammererTob commented Sep 3, 2020

I just realized that i did not use gen_keycodes.dart to generate the key map. Will work on that.

@flutter-dashboard
Copy link

flutter-dashboard bot commented Sep 3, 2020

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

@HansMuller HansMuller requested a review from gspencergoog Sep 3, 2020
KammererTob added 3 commits Sep 4, 2020
@KammererTob KammererTob marked this pull request as ready for review Sep 5, 2020
@flutter-dashboard flutter-dashboard bot added the team label Sep 5, 2020
@KammererTob
Copy link
Author

KammererTob commented Sep 5, 2020

I have now made the iOS key code mapping generatable and collectable from the chromium files. This works since the key codes used for iOS are bascially the usbHidCodes (which only very few missing).
Few notes:

  • The gen_keycodes.dart also generates header (.h) files inside the engine/src/shell/platform/.../keycodes folder. I did not find any usage for those files and they also do not appear to be checked in. I am mentioning this since i had to split the darwin file into two: keyboard_map_ios.h and keyboard_map_macos.h
  • I removed the // @dart = 2.8 comment on top of the keyboard_maps.tmpl file since this lead to errors when importing the generated file
  • The raw_keyboard_ios.dart file contains a _kiOSToLogicalMap map, which defines a mapping for special non-visible keys in iOS: https://developer.apple.com/documentation/uikit/uikeycommand/input_strings_for_special_keys?language=objc. I was unsure if this is the right place for the mapping, but i felt like it would be wrong to put this very specific use-case in the keyboard_maps.dart file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.
X Tutup