-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Implement dialog windows for the win32 platform #176309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Code Review
This pull request introduces support for dialog windows on the Win32 platform by refactoring HostWindow into a base class with HostWindowRegular and HostWindowDialog subclasses. This is a solid architectural change that also adds modal and modeless dialog capabilities, complete with updates to the multi-window example and new integration tests. My review focuses on a few areas for improvement, including focus management logic, adherence to platform conventions for dialogs, documentation, and a minor typo in the example code.
examples/multiple_windows/lib/app/dialog_window_edit_dialog.dart
Outdated
Show resolved
Hide resolved
justinmc
left a comment
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.
Looks as expected to me! Loic should probably review the engine code when he's back.
Can you add simple unit tests for the changes in _window_win32.dart? Assuming you can avoid bumping up against the FFI calls. I think you should be able to test that createDialogWindowController now returns a controller instead of throwing at least, and hopefully test the methods on DialogWindowControllerWin32 itself.
I'm going to try to get the example running on my Windows machine tonight, will post back.
engine/src/flutter/shell/platform/windows/host_window_dialog.cc
Outdated
Show resolved
Hide resolved
engine/src/flutter/shell/platform/windows/host_window_regular.cc
Outdated
Show resolved
Hide resolved
examples/multiple_windows/lib/app/dialog_window_edit_dialog.dart
Outdated
Show resolved
Hide resolved
I had tried this previously when I did the regular windows bits, but to no avail. There are too many things that we'd have to mock to have a meaningful unit test there. The integration tests should serve as the test of this API instead, as they are truer to reality in this regard. |
| FML_LOG(ERROR) << "Failed to create view"; | ||
| return nullptr; | ||
| } | ||
| FML_CHECK(view != nullptr); |
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.
I slightly prefer the previous model where we would try to not crash if the window could not be created (I assume this resulted in an exception on the Dart side). Should we stick to that approach? (Not a blocker for landing this PR).
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.
@knopp and I spoke about this earlier, but a failure to make a view is most likely a fatal error and a precondition to the engine working properly. We decided that it should be asserted rather than handled, since it would be breaking your app anyway
engine/src/flutter/shell/platform/windows/host_window_dialog.cc
Outdated
Show resolved
Hide resolved
|
I failed to get this running again. Last time |
I'm currently busy getting CI to stop failing, so you may have time to try 😆 But I will land beforehand regardless. We can make changes to the example app after if need be |
robert-ancell
left a comment
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.
I think a fix needed to stop the test failing on Linux, but otherwise just pedantic stuff.
dev/integration_tests/windowing_test/test_driver/main_test.dart
Outdated
Show resolved
Hide resolved
Head branch was pushed to by a user without write access
…10244) Manual roll requested by [email protected] flutter/flutter@7cd821c...a873a27 2025-10-16 [email protected] [tool] makes listing a shader also as an asset a build failure (flutter/flutter#176866) 2025-10-16 [email protected] Roll Packages from d062181 to 835dccb (7 revisions) (flutter/flutter#177100) 2025-10-16 [email protected] Handle the new location of Perfetto in create_updated_flutter_deps.py (flutter/flutter#177099) 2025-10-16 [email protected] Implement dialog windows for the win32 platform (flutter/flutter#176309) 2025-10-16 [email protected] `SelectableRegion` should not show flutter rendered context menu when web context menu is enabled (flutter/flutter#176855) 2025-10-16 [email protected] Manual roll Skia to 2d9df7c70b6f (flutter/flutter#177074) 2025-10-16 [email protected] feat: add `OptionsViewOpenDirection.mostSpace` to `RawAutocomplete` (flutter/flutter#172997) 2025-10-16 [email protected] [Android] Refactor `ImageReaderSurfaceProducer` restoration after app resumes (flutter/flutter#175937) 2025-10-15 [email protected] Refactor: migrate fade upwards page transition builder to widgets (flutter/flutter#175560) 2025-10-15 [email protected] Marks Windows windowing_test to be unflaky (flutter/flutter#176701) 2025-10-15 [email protected] fix: 🐛 Add equality and hashCode implementations to ScrollAwareImageProvider (flutter/flutter#175038) 2025-10-15 [email protected] Updates `sliver_tree.1.dart` to use `MediaQuery.widthOf(context)` (flutter/flutter#176888) 2025-10-15 [email protected] [web] Fix focus issues in newer versions of Chrome (flutter/flutter#176938) 2025-10-15 [email protected] [Android 16] Update `android_engine_vulkan_tests` to Test Against SDK 36 Emulator (flutter/flutter#176985) 2025-10-15 [email protected] Fix key events interception by RadioGroup when no Radio is focused. (flutter/flutter#176335) 2025-10-15 [email protected] Update cherry-pick instructions to include instructions for pre-release CPs (flutter/flutter#177020) 2025-10-15 [email protected] Manual roll Skia to c501c727a007 (flutter/flutter#177015) 2025-10-15 [email protected] Update examples to latest Linux runner style (flutter/flutter#177033) 2025-10-15 [email protected] [material/menu_anchor.dart] Create internal menu controller if external controller is changed to null. (flutter/flutter#176375) 2025-10-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix - TalkBack does not announce list information (#174374)" (flutter/flutter#177062) 2025-10-14 [email protected] Implement Regular Windows for Linux (flutter/flutter#176187) 2025-10-14 [email protected] Fix - TalkBack does not announce list information (flutter/flutter#174374) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
|
This change looks to be super breaking the tree. Can you please take over #177172 and find out why this test or the underlying code is having issues? |
Yup! I'll look today |
## What's new? - Implemented `DialogWindowControllerWin32` for win32 dialogs 🚀 - Refactored and updated the Win32 embedder to support dialogs - Updated the `multiple_windows` example to demonstrate both modal and modeless dialogs - Added integration tests for the dialog windows - Added tests for dialogs in the embedder ## How to test? 1. Run the `multiple_windows` example application with a local engine built from this pull request 2. Click the `Modeless Dialog` creation button on the main window 3. Open a regular window and click the `Modal Dialog` creation button 4. Note the behavior of modal and modeless dialogs ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. # Conflicts: # engine/src/flutter/shell/platform/windows/host_window.cc
## What's new? - Implemented `DialogWindowControllerWin32` for win32 dialogs 🚀 - Refactored and updated the Win32 embedder to support dialogs - Updated the `multiple_windows` example to demonstrate both modal and modeless dialogs - Added integration tests for the dialog windows - Added tests for dialogs in the embedder ## How to test? 1. Run the `multiple_windows` example application with a local engine built from this pull request 2. Click the `Modeless Dialog` creation button on the main window 3. Open a regular window and click the `Modal Dialog` creation button 4. Note the behavior of modal and modeless dialogs ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
What's new?
DialogWindowControllerWin32for win32 dialogs 🚀multiple_windowsexample to demonstrate both modal and modeless dialogsHow to test?
multiple_windowsexample application with a local engine built from this pull requestModeless Dialogcreation button on the main windowModal Dialogcreation buttonPre-launch Checklist
///).