-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor multi-window support #1
Refactor multi-window support #1
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.
Looks good, just some small details.
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 just have one main thought, but this all looks reasonable to me. Much easier to read 😄
thanks everyone for your work, I just want to know how much work left? |
This pull request refactors the multi-window support in the Windows embedder, originally introduced in the series of four PRs starting from flutter#56090. It consolidates features introduced across the four PRs (support for regular windows, popups, dialogs, and satellites) into a single PR to facilitate faster iteration during review. Once the code stabilizes, these changes will be split and propagated to the relevant branches.
See also the corresponding framework PR: canonical/flutter#12
What's New:
--enable-multi-window
command-line option. No changes are required in the runner code.Since the multi-window API remains non-public, windows cannot yet be created or destroyed from the runner code.
How It Works (In a Nutshell):
When multi-window support is enabled,
FlutterWindowsEngine
creates a uniquely ownedFlutterHostWindowController
that is responsible for managing the lifecycle of windows associated with the engine. The engine registers the "flutter/windowing" channel usingWindowingHandler
.When the Dart app requests a new window using the
createX
methods,WindowingHandler
callsFlutterHostWindowController::CreateHostWindow
with the decoded arguments. The controller creates a uniquely ownedFlutterHostWindow
object which manages a native Win32 window with a child Flutter view in its client area. Each view, represented byFlutterWindowsViewController
, is owned by its correspondingFlutterHostWindow
. When the Dart app requests the destruction of a window (given a view ID) or when the native window is closed from the system, the controller destroys the correspondingFlutterHostWindow
, which, in turn, cleans up the associated view controller.Window messages are first handled by a static
FlutterHostWindow::WndProc
function that initializes the native Win32 window upon receivingWM_NCCREATE
. Other messages are forwarded toFlutterHostWindowController::HandleMessage
to manage global behaviors (e.g., hiding satellites of inactive top-level windows). Finally, messages are passed back toFlutterHostWindow::HandleMessage
for window-specific behavior.Things To Do:
This is a work in progress. Things that still need to be done include:
shell/platform/common/geometry.h
) instead of defining new types inwindowing.h
.Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.