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

[Win32, Keyboard] Lift redispatching to messages, via SendMessage. #31200

Merged
merged 12 commits into from
Feb 2, 2022

Conversation

dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Feb 2, 2022

Currently, event redispatching is checked at the start of OnKey, and events are redispatched with SendInput. With this PR, event redispatching is checked at the start of HandleMessage, and events are redispatched with SendMessage.

This change has the following benefits:

  • Redispatching via SendMessage keeps the exact content of messages, instead of having them twisted by SendInput. Notably, this allows redispatching SYS messages and character messages with diacritics.
  • Similarly, filtering at the top-most HandleMessage level makes filtering much more precise, including their direct result.

Since SendMessage is processed synchronously, instantly, without going through the message queue. This means that redispatched messages will no longer be mistaken as real messages, or vice versa.

Additionally, since it is no longer needed to convert between inputs and messages, or to put inputs in a queue, the mock classes have been greatly simplified.

This PR fixes flutter/flutter#84210, fixes flutter/flutter#95479, fixes flutter/flutter#88388, and fixes flutter/flutter#87843.

This PR is likely a fix to flutter/flutter#77179 and flutter/flutter#91482, since I can't reproduce them any more. But removing their temporary code will be done in a separate PR for the convenience of reference and revert.

This is one of the many steps to refactor the windows keyboard system.

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.

@dkwingsmt dkwingsmt changed the title Win key redispatch message [Win32, Keyboard] Lift redispatching to messages, via SendMessage. Feb 2, 2022
@dkwingsmt dkwingsmt marked this pull request as ready for review February 2, 2022 21:30
Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

This looks great! I love all the deleted code.

// The 25th bit of the LParam.
//
// Some messages are sent bit25 set. It's meaning is yet unknown.
bool bit25 = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the name. :-)

@dkwingsmt dkwingsmt added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Feb 2, 2022
@fluttergithubbot fluttergithubbot merged commit a533470 into flutter:main Feb 2, 2022
@dkwingsmt dkwingsmt deleted the win-key-redispatch-message branch February 3, 2022 00:59
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 3, 2022
@ghost
Copy link

ghost commented Feb 3, 2022

I made some tests on master branch now, and after pressing Enter, or reading a barcode, that sends a Enter key event on finish, only the keys enter and backspace keep working, all other keys stop working, on all text fields in my application.

@dkwingsmt
Copy link
Contributor Author

@vinicios-cervantes Is it still reproducing on master? Can you open an new issue for it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects: text input platform-windows waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
3 participants