Skip to content

Conversation

@knopp
Copy link
Member

@knopp knopp commented Feb 22, 2025

This wires PlatformDispatcher.onViewFocusChange and PlatformDispatches.requestViewFocusChange through embedder API.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

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

@knopp knopp requested a review from loic-sharma February 22, 2025 17:33
@github-actions github-actions bot added engine flutter/engine related. See also e: labels. f: focus Focus traversal, gaining or losing focus labels Feb 22, 2025
@knopp knopp requested a review from mattkae February 22, 2025 17:34
@knopp knopp changed the title [Embedder] Wire view focus event and request [Embedder] Wire view focus event and focus request Feb 22, 2025
@github-actions github-actions bot added platform-ios iOS applications specifically team-ios Owned by iOS platform team labels Feb 22, 2025
@github-actions github-actions bot added the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Feb 22, 2025
@knopp knopp force-pushed the view_focus_event branch 3 times, most recently from bea686b to cbbf1db Compare February 24, 2025 12:11
@github-actions github-actions bot added the platform-fuchsia Fuchsia code specifically label Feb 24, 2025
@knopp knopp requested a review from chinmaygarde February 24, 2025 12:11
/// @brief Notify the delegate that platform view focus state has changed.
///
/// @param[in] event The focus event describing the change.
virtual void OnPlatformViewSendViewFocusEvent(
Copy link
Member

Choose a reason for hiding this comment

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

Should we just default this OOL to be a no-op? You won't have to patch the mocks.

Copy link
Member Author

Choose a reason for hiding this comment

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

No other delegate method has default implementation. If the inconsistency is not an issue we can do it.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I don't think we had that many mocks. This is fine. But we can probably also clean up in a later patch.

Copy link
Contributor

@mattkae mattkae left a comment

Choose a reason for hiding this comment

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

A few things, but this mostly look sensible to me 🎉

// Focus state of a View.
// Must match ViewFocusState in ui/platform_dispatcher.dart.
enum class ViewFocusState : int64_t {
kUnfocused = 0,
Copy link
Member

Choose a reason for hiding this comment

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

Nit: = 0 is redundant.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like to have explicit value when mapping to values from another language. It is also used in key_data.h and possibly other places so I'd leave it there for consistency.

@chinmaygarde
Copy link
Member

The embedder API and the engine updates LGTM. But it looks like @mattkae has some feedback on the API. I'll defer to them for the approval. Thanks!

void PlatformConfigurationNativeApi::RequestViewFocusChange(int64_t view_id,
int64_t state,
int64_t direction) {
ViewFocusChangeRequest request{view_id, //
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing comment or should the // be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

The comment is there to force line break. Otherwise clang format puts first two argument in same line which doesn't look very readable. It's used in other parts of the engine as well.

@knopp knopp added this pull request to the merge queue Feb 25, 2025
Merged via the queue into flutter:master with commit 940fb3c Feb 25, 2025
175 of 176 checks passed
@knopp knopp deleted the view_focus_event branch February 25, 2025 18:13
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
@ardera
Copy link
Contributor

ardera commented Aug 13, 2025

Hey, shouldn't the enum members be namespaced, like the rest of the identifiers?

I actually got a build breakage because of this, because I use kForward as a video player playback direction in my application

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

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) engine flutter/engine related. See also e: labels. f: focus Focus traversal, gaining or losing focus platform-fuchsia Fuchsia code specifically platform-ios iOS applications specifically team-ios Owned by iOS platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants