Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@dkwingsmt
Copy link
Contributor

This PR changes how embedder API's SendKeyData sends ui.KeyData to the framework. This is a reland of #29638, which somehow became empty possibly due to the recent switch from master to main.

Currently the packet is sent over FFI through a series of DispatchKeyData methods that drill all the way from Window to EmbedderEngine. Not only is it cumbersome, but it also bypasses the existing buffering mechanism, leading to a crash as described in flutter/flutter#89748 (comment).

This PR changes the packet to be sent over the existing platform messenger, reusing the entirety of its code path and functionalities while keeping the embedder API unchanged.

This partially fixes flutter/flutter#89748 (comment). Since the buffer size is only 1, if 2 or more events are sent during the restart (which usually means holding multiple keys) the crash will still occur. There's a way to resize the buffer, but I haven't found a way to actually do it yet, and will explore as the next step.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[macOS][desktop] keyboard Input doesn't work anymore when entering text during hot restart

2 participants