-
Notifications
You must be signed in to change notification settings - Fork 6k
Conversation
63eb3d8
to
3dd3204
Compare
bff99f2
to
e629820
Compare
cc @justinmc |
e629820
to
bc78b7b
Compare
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.
LGTM 👍
I've re-run some tests that seem to be infra failures.
// responder, which might be FlutterTextInputPlugin. If that's the case, the | ||
// plugin must not handle the event, otherwise the emoji picker would not | ||
// work (due to first responder returning YES from performKeyEquivalent:) | ||
// and there would be endless loop, because FlutterViewController will |
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.
Nit: "would be endless loop" => "would be an infinite loop"
// When NSWindow is nextResponder, keyboard manager will send to it | ||
// unhandled events (through [NSWindow keyDown:]). If event has both |
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.
Nit: "will send to it unhandled events" => "will send unhandled events to it"
bc78b7b
to
e0b6fa8
Compare
…125039) flutter/engine@c4396f9...d297361 2023-04-18 [email protected] [macOS] Fix Ctrl+Tab is broken (flutter/engine#40706) 2023-04-18 [email protected] Roll Fuchsia Mac SDK from K1LGtKXyxRlW3Q9O1... to qZHSvkpAU1-YYGvYc... (flutter/engine#41293) 2023-04-18 [email protected] Roll buildroot to 059d155b4d452efd9c4427c45cddfd9445144869 (flutter/engine#41288) 2023-04-18 [email protected] [Impeller] Remove glyph pixel rounding during text frame conversion (flutter/engine#41285) 2023-04-18 [email protected] Revert "Reland "Migrate mac_host_engine to engine v2 builds."" (flutter/engine#41284) 2023-04-17 [email protected] focus SkiaGPUObject wrappers on only those objects that need the protection (flutter/engine#41237) Also rolling transitive DEPS: fuchsia/sdk/core/mac-amd64 from K1LGtKXyxRlW to qZHSvkpAU1-Y If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Strong reference from |
This PR has duplicated the |
This comment was marked as outdated.
This comment was marked as outdated.
Actually, the comment above was wrong. I assumed that if text input plugin is first responder, it will get priority over |
#40706 added a duplicate `NSEvent (KeyEquivalentMarker)` category. This PR removes it. It also removes the call to `markAsKeyEquivalent` from `FlutterViewController`. That call is internal to `FlutterTextInputPlugin` and classes outside should not be calling it. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Fixes the issue in original PR where `FlutterViewWrapper` does not pass the key equivalent to subviews thus prevents `TextInputPlugin` from receiving it. Also adds a regression test for this scenario. Note that key equivalent flow does not respect the regular responder chain. It is passed from root view to down to subviews and if unhandled will be forwarded to menus. Original message: #40706 added a duplicate `NSEvent (KeyEquivalentMarker)` category. This PR removes it. It also removes the call to `markAsKeyEquivalent` from `FlutterViewController`. That call is internal to `FlutterTextInputPlugin` and classes outside should not be calling it. *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
#40706 added a duplicate `NSEvent (KeyEquivalentMarker)` category. This PR removes it. It also removes the call to `markAsKeyEquivalent` from `FlutterViewController`. That call is internal to `FlutterTextInputPlugin` and classes outside should not be calling it. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Fixes the issue in original PR where `FlutterViewWrapper` does not pass the key equivalent to subviews thus prevents `TextInputPlugin` from receiving it. Also adds a regression test for this scenario. Note that key equivalent flow does not respect the regular responder chain. It is passed from root view to down to subviews and if unhandled will be forwarded to menus. Original message: #40706 added a duplicate `NSEvent (KeyEquivalentMarker)` category. This PR removes it. It also removes the call to `markAsKeyEquivalent` from `FlutterViewController`. That call is internal to `FlutterTextInputPlugin` and classes outside should not be calling it. *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Description
This PR fixes Ctrl+Tab shortcut on macOS.
From https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/HandlingKeyEvents.html#//apple_ref/doc/uid/10000060i-CH7-SW11, some key events, such as Ctrl+Tab, are notified by calling
performKeyEvent
: instead ofkeyDown:
.The text input plugin already implement this method, this is why the shortcut works only when there is a TextField (TextInputPlugin is then activated), see 'Step 6' of flutter/flutter#122084 description.
Implementation
I had to implement
performKeyEvent:
onFlutterViewWrapper
because when adding it toFlutterView
it was not called (see this similar comment related to setBackgroundColor: #36906 (comment)).I also duplicated some code from FlutterTextInputPlugin.mm (the
KeyEquivalentMarker
definition) becauseFlutterViewWrapper.performKeyEvent:
takes precedence overFlutterTextInputPlugin.performKeyEvent:
so setting the marker is important to not breakFlutterTextInputPlugin.handleKeyEvent:
.Related Issue
Fixes flutter/flutter#122084
Tests
Adds 1 test.