Repository navigation
Implement satellite windows on Win32 - #192939
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
93d3b92 to
fbd68af
Compare
e649291 to
6f770f2
Compare
|
This will need to be rebased on #192990 |
Satellite windows are auxiliary top-level windows anchored to a parent:
they are decorated and activatable like a regular window, are positioned
once at creation by a Dart-supplied positioner, then retain their offset
from the parent as it moves. They cannot be minimized on their own, can
be reparented at runtime without changing screen position, and are
destroyed along with their parent.
The public framework API (SatelliteWindowController, SatelliteWindow,
WindowingOwner.createSatelliteWindowController) already landed; every
backend threw UnimplementedError. This fills in the Win32 backend, making
it the first platform with working satellites.
Engine:
* Add WindowArchetype::kSatellite.
* Add HostWindowSatellite, deriving from HostWindowSized. Fixed-size
satellites resolve their placement synchronously during construction
so the window is created at its target position; sized-to-content
satellites position from ApplyContentSize after the first frame.
Both paths align the window frame, rather than the window rectangle,
with the positioner's origin.
* Add HostWindow::CreateSatelliteWindow.
* Track satellites in WindowManager and propagate parent movement on
WM_WINDOWPOSCHANGED, resolving handles to live satellites on each
iteration since nested message handling may destroy them.
* Reject reparenting that would make a satellite its own ancestor,
which would otherwise recurse until the stack is exhausted.
Framework:
* Implement SatelliteWindowControllerWin32 and its FFI bindings. The
positioner callback scales by the parent's device pixel ratio, since
the anchor rect is in the parent's coordinate space and the
satellite's own view does not exist yet when the callback first runs.
Example:
* Add satellite window support to the multiple_windows example app,
including creation, editing and positioning of satellites.
9c83293 to
4a8ac1f
Compare
There was a problem hiding this comment.
Code Review
This pull request implements satellite windows on the Windows platform, introducing the HostWindowSatellite class in C++ and the corresponding SatelliteWindowControllerWin32 in Dart, along with associated unit tests and updates to the multiple-windows example. Feedback on the changes suggests using std::optional<POINT> to safely track the parent window's position and avoid incorrect movement deltas if GetWindowRect fails. Additionally, it is recommended to trigger window metrics events on any dimension inequality rather than only when the size decreases, and to call SetWindowPos with SWP_FRAMECHANGED after modifying the window owner with SetWindowLongPtr to force immediate OS updates.
# Conflicts: # engine/src/flutter/shell/platform/windows/window_manager.cc
|
autosubmit label was removed for flutter/flutter/192939, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
|
autosubmit label was removed for flutter/flutter/192939, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
Rerunning google tests... |
This pull request implements satellite windows for Win32 📡 ## What's new? - Moved `AlignOriginWithFrame` to `HostWindow` - Moved `GetInitialWindowSize` to `HostWindow` - Add WindowArchetype::kSatellite. - Add HostWindowSatellite, deriving from HostWindowSized. Fixed-size satellites resolve their placement synchronously during construction so the window is created at its target position; sized-to-content satellites position from ApplyContentSize after the first frame. Both paths align the window frame, rather than the window rectangle, with the positioner's origin. - Add HostWindow::CreateSatelliteWindow - Propagate parent movement on `WM_WINDOWPOSCHANGED` to satellites in order to move them with their parent - Reject reparenting that would make a satellite its own ancestor - Implement SatelliteWindowControllerWin32 and its FFI bindings - Add satellite windows to the example application ## How to test? Run the multiple windows example application and play with satellites there 🎉 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [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 in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [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.
This pull request implements satellite windows for Win32 📡
What's new?
AlignOriginWithFrametoHostWindowGetInitialWindowSizetoHostWindowWM_WINDOWPOSCHANGEDto satellites in order to move them with their parentHow to test?
Run the multiple windows example application and play with satellites there 🎉
Pre-launch Checklist
///).