This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Win32, Keyboard] TextInputPlugin is no longer a KeyboardHandlerBase #30456
Merged
dkwingsmt
merged 6 commits into
flutter:main
from
dkwingsmt:win-key-text-no-longer-key-handler
Jan 5, 2022
Merged
[Win32, Keyboard] TextInputPlugin is no longer a KeyboardHandlerBase #30456
dkwingsmt
merged 6 commits into
flutter:main
from
dkwingsmt:win-key-text-no-longer-key-handler
Jan 5, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…om/dkwingsmt/engine into win-key-text-no-longer-key-handler
gspencergoog
approved these changes
Jan 4, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flutter::BinaryMessenger* messenger, | ||
flutter::KeyboardKeyHandler::EventDispatcher dispatch_event, | ||
flutter::KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state) | ||
override { | ||
auto spy_key_event_handler = std::make_unique<SpyKeyboardKeyHandler>( | ||
auto spy_key_event_handler = new SpyKeyboardKeyHandler( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keep the make_unique
here? That way if someone later adds code that throws an exception or returns before the end of the function, this won't leak.
|
||
std::unique_ptr<TextInputPlugin> CreateTextInputPlugin( | ||
flutter::BinaryMessenger* messenger) override { | ||
auto spy_key_event_handler = new SpyTextInputPlugin(messenger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: use make_unique
instead.
8 tasks
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Jan 5, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Jan 5, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Jan 6, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Jan 6, 2022
zanderso
pushed a commit
to flutter/flutter
that referenced
this pull request
Jan 6, 2022
* 9481a79 Roll Skia from 45f64bd52835 to 6bebf036a502 (2 revisions) (flutter/engine#30659) * fb4a86c Roll Fuchsia Mac SDK from RyUwCnr_M... to vpa6vKu7U... (flutter/engine#30661) * 154bd96 Roll Skia from 6bebf036a502 to 5726d457cf15 (1 revision) (flutter/engine#30665) * ba23c6c Roll Skia from 5726d457cf15 to 61d0fbbca795 (5 revisions) (flutter/engine#30673) * e749ba3 Impl and test (flutter/engine#30488) * a78103c Removed "UiThread" annotation from MethodChannel#Result. (flutter/engine#30671) * f8a398f Fix crash in BackdropFilterLayer::Diff (flutter/engine#30460) * a6a856f Only provide frame damage to rasterizer if partial repaint is enabled (flutter/engine#30461) * 3a667ab Roll Fuchsia Mac SDK from vpa6vKu7U... to Al-HXHXyQ... (flutter/engine#30677) * 830abeb [web] roll CanvasKit 0.32.0; fix frame order in animated images (flutter/engine#30680) * c726121 Add a new display_list_benchmarks test suite (flutter/engine#30678) * f181c4d [web] flip browser image codec flag to opt-out (flutter/engine#30681) * 436a346 Remove the ios_tools Chromium-style dependency (flutter/engine#30538) * 3f63998 [web] bring libraries.yaml/libraries.json up to date (flutter/engine#30467) * ab1e8f5 Roll Skia from 61d0fbbca795 to 4981c921c6d7 (1 revision) (flutter/engine#30684) * 8e4124b Roll Skia from 4981c921c6d7 to d7771857e9e2 (2 revisions) (flutter/engine#30685) * acb60b4 Roll Fuchsia Mac SDK from Al-HXHXyQ... to G04Sc3__F... (flutter/engine#30687) * 0176295 [Win32, Keyboard] TextInputPlugin is no longer a KeyboardHandlerBase (flutter/engine#30456) * bcb4b35 Roll Skia from d7771857e9e2 to ec2e8f11b97a (1 revision) (flutter/engine#30688) * e09f8d1 Roll Dart SDK from 1697706df708 to ab5047720a9e (5 revisions) (flutter/engine#30690) * d60c816 Roll Dart SDK from 1697706df708 to f59531cc2973 (10 revisions) (flutter/engine#30691) * 417042c GN targets for generating release artifacts (flutter/engine#30679) * 7f31015 Roll Skia from ec2e8f11b97a to 84d6cf9b5b76 (7 revisions) (flutter/engine#30693) * fed9e0b Roll Skia from 84d6cf9b5b76 to 88c5af7ecd72 (3 revisions) (flutter/engine#30695) * 36eafae [fuchsia][shader warmup] fix for fxbug.dev/90387 (flutter/engine#30482) * 0c036a7 Revert "Only provide frame damage to rasterizer if partial repaint is enabled (#30461)" (flutter/engine#30696) * 8498779 [fuchsia] Fix failing SDK roll. (flutter/engine#30675)
JsouLiang
pushed a commit
to JsouLiang/engine
that referenced
this pull request
Jan 14, 2022
…lutter#30456) * Impl * format * Comment
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the Win32 keyboard system so that
TextInputPlugin
no longer derives fromKeyboardHandlerBase
. In this way,KeyboardKeyHandler
is now the onlyKeyboardKeyBase
.With this change, the
KeyboardHandlerBase
abstract is practically useless, but is kept to minimize changes of this PR. In the future it will be simplified and absorbed intoKeyboardKeyHandler
.This change serves two purposes:
Simply class structure
The previous structure, which consists of a two-layer abstract structure of
KeyboardHandlerBase
andKeyboardKeyHandlerDelegate
, turns out to be over-engineering:TextInputPlugin
hardly overlaps withKeyboardKeyHandler
at all. Making them derive the same base class adds a number of empty methods forKeyboardKeyHandler
.KeyboardHook
, butTextInputPlugin.KeyboardHook
never returns any value other than false. It's just a "listener".KeyboardHandlerBase
(fortunately, we don't.)Simplify async flow
With this change,
FlutterWindowsView::SendKey
will contain only one potentially asynchronous subroutine.As one of the most important steps of flutter/flutter#88021, it's planned to lift the redispatching mechanism from
KeyboardKeyHandler
toKeyboardManagerWin32
, which needs to makeFlutterWindowsView::SendKey
an asynchronous function by adding a "callback" argument.Currently
FlutterWindowsView::SendKey
traverses all of its 2KeyboardHandlerBase
to see if they'd like to handle the key. In theory, eitherKeyboardHandlerBase
can return true synchronously, and decide not to handle the key later, causing a redispatch. Therefore, to makeFlutterWindowsView::SendKey
asynchronous, it will have to manually implement something similar toPromise.all
. However, in practice,KeyboardKeyHandler
is the only one that can be asynchronous, and by no longer recognizingTextInputPlugin
as aKeyboardHandlerBase
, the "callback" can be processed in a much simpler way.This is one of the many steps to refactor the windows keyboard system.
This PR shouldn't need extra tests since it's only a refactor.
Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.