Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
116a72e
multiwindow: engine
knopp May 12, 2025
6409a21
multiwindow: framework
knopp May 12, 2025
3a2ef54
multiwindow: ref app
knopp May 12, 2025
e0ade03
windowstate: framework
knopp Jun 1, 2025
f938b4b
windowstate: engine
knopp Jun 1, 2025
63b51cb
windowstate: ref app
knopp Jun 1, 2025
6fe7149
refactor: change how FlutterHostWindow construction is done
mattkae Jun 13, 2025
ccd2f80
minor: remove enable-windowing flag
mattkae Jun 13, 2025
e4b6492
minor: add path to dart file for WindowArchetype comment
mattkae Jun 13, 2025
992fa18
refactor: add BoxConstraints abstraction on win32 platform
mattkae Jun 13, 2025
e55b799
task: add max pending_messages count
mattkae Jun 13, 2025
76fc387
rename: exported WindowManager methods
mattkae Jun 13, 2025
edf3b88
rename FlutterHostWindowController to WindowManager
mattkae Jun 13, 2025
4a4d8d7
nit: using FML_CHECK over assert for has_size check
mattkae Jun 13, 2025
a4ca74b
doc: fix bad window manager docstring
mattkae Jun 13, 2025
4b46e13
rename: get_window_manager to window_manager
mattkae Jun 13, 2025
35d91d2
nit: return FlutterViewId from create regular window FFI call
mattkae Jun 13, 2025
0f7087f
nit: use FlutterViewId in WindowsMessage
mattkae Jun 13, 2025
4d74922
nit: use FlutterViewId in the definition as well
mattkae Jun 13, 2025
8ae3912
docs: adding a comment to InternalFlutterWindows_WindowManager_GetWin…
mattkae Jun 13, 2025
30cf117
rename: to get top level window handle
mattkae Jun 13, 2025
2355a12
refactor: move user32 methods into the WindowsProcTable abstraction
mattkae Jun 16, 2025
26aa9c1
style: fix IsolateScope nit
mattkae Jun 16, 2025
275d5f7
Windows pr feedback (#54)
mattkae Jun 16, 2025
9ed43d0
Update win32 API per latest FFI
mattkae Jun 16, 2025
a72cd92
refactor: improve BoxConstraints constructor
mattkae Jun 17, 2025
5023998
refactor: improve BoxConstraints constructor (#55)
mattkae Jun 17, 2025
ddb942a
rename: FlutterHostWindow -> HostWindow
mattkae Jun 18, 2025
6b32581
rename: createRegularWindow -> CreateRegularWindow
mattkae Jun 18, 2025
7b79835
rename: proc_table -> win32
mattkae Jun 18, 2025
8c3a89a
refactor: do not send windows metrics event twice
mattkae Jun 18, 2025
1600f14
rename: FlutterWindowSizing -> WindowSizing
mattkae Jun 18, 2025
0d7f90a
refactor: make the BoxConstraints biggest/smallest accessors non-opti…
mattkae Jun 20, 2025
ff4086a
Additional pr feedback (#56)
mattkae Jun 20, 2025
caecbf9
docstrings: fix typos on HostWindow
mattkae Jun 23, 2025
3f157c8
docstrings: fix typos on HostWindow (#58)
mattkae Jun 23, 2025
1b228be
docs: on GetViewFromTopLevelWindow
mattkae Jun 24, 2025
f626f80
docs: controller -> manager
mattkae Jun 24, 2025
8ecdd02
docs: controller -> manager again
mattkae Jun 24, 2025
6deff8e
task: use std::function instead of C style pointer for on_message_
mattkae Jun 24, 2025
88a7f26
docs: documenting Isolate::Current()
mattkae Jun 24, 2025
b60341e
task: WindowManager::CreateRegularWindow returns -1 if creation fails
mattkae Jun 24, 2025
c3efe1f
task: remove unused function
mattkae Jun 24, 2025
1fa3caa
task: remove pending_messages
mattkae Jun 24, 2025
3ddc90b
More windows pr feedback (#60)
mattkae Jun 24, 2025
703b21a
rename: WindowSizing members
mattkae Jun 25, 2025
21a31c4
engine: macOS feedback
knopp Jul 2, 2025
15f12fb
engine: rename ffi methods
knopp Jul 7, 2025
045cccc
framework: rename ffi methods
knopp Jul 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev/bots/allowlist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const Set<String> kCorePackageAllowList = <String>{
'clock',
'collection',
'fake_async',
'ffi',
'file',
'flutter',
'flutter_driver',
Expand Down
1 change: 1 addition & 0 deletions engine/src/flutter/ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@
../../../flutter/shell/platform/windows/direct_manipulation_unittests.cc
../../../flutter/shell/platform/windows/dpi_utils_unittests.cc
../../../flutter/shell/platform/windows/fixtures
../../../flutter/shell/platform/windows/flutter_host_window_controller_unittests.cc
../../../flutter/shell/platform/windows/flutter_project_bundle_unittests.cc
../../../flutter/shell/platform/windows/flutter_window_unittests.cc
../../../flutter/shell/platform/windows/flutter_windows_engine_unittests.cc
Expand Down
20 changes: 20 additions & 0 deletions engine/src/flutter/ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -52793,6 +52793,8 @@ ORIGIN: ../../../flutter/shell/platform/common/flutter_platform_node_delegate.h
ORIGIN: ../../../flutter/shell/platform/common/geometry.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/incoming_message_dispatcher.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/incoming_message_dispatcher.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/isolate_scope.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/isolate_scope.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/json_message_codec.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/json_message_codec.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/json_method_codec.cc + ../../../flutter/LICENSE
Expand All @@ -52813,6 +52815,7 @@ ORIGIN: ../../../flutter/shell/platform/common/text_input_model.cc + ../../../fl
ORIGIN: ../../../flutter/shell/platform/common/text_input_model.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/text_range.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon-Bridging-Header.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/common/windowing.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/common/availability_version_check.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/common/availability_version_check.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/common/buffer_conversions.h + ../../../flutter/LICENSE
Expand Down Expand Up @@ -53091,6 +53094,9 @@ ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterVie
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProviderTest.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewProvider.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewTest.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterWindowController.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterWindowController.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterWindowControllerTest.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap.g.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMapTest.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap_Internal.h + ../../../flutter/LICENSE
Expand Down Expand Up @@ -53549,6 +53555,10 @@ ORIGIN: ../../../flutter/shell/platform/windows/external_texture_d3d.h + ../../.
ORIGIN: ../../../flutter/shell/platform/windows/external_texture_pixelbuffer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/external_texture_pixelbuffer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/flutter_desktop_messenger.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/flutter_host_window.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/flutter_host_window.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/flutter_host_window_controller.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/flutter_host_window_controller.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/flutter_key_map.g.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/flutter_platform_node_delegate_windows.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h + ../../../flutter/LICENSE
Expand Down Expand Up @@ -55832,6 +55842,8 @@ FILE: ../../../flutter/shell/platform/common/flutter_platform_node_delegate.h
FILE: ../../../flutter/shell/platform/common/geometry.h
FILE: ../../../flutter/shell/platform/common/incoming_message_dispatcher.cc
FILE: ../../../flutter/shell/platform/common/incoming_message_dispatcher.h
FILE: ../../../flutter/shell/platform/common/isolate_scope.cc
FILE: ../../../flutter/shell/platform/common/isolate_scope.h
FILE: ../../../flutter/shell/platform/common/json_message_codec.cc
FILE: ../../../flutter/shell/platform/common/json_message_codec.h
FILE: ../../../flutter/shell/platform/common/json_method_codec.cc
Expand All @@ -55854,6 +55866,7 @@ FILE: ../../../flutter/shell/platform/common/text_range.h
FILE: ../../../flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon-Bridging-Header.h
FILE: ../../../flutter/shell/platform/darwin/common/SwiftTestingMain.swift
FILE: ../../../flutter/shell/platform/darwin/common/SwiftTestingRunner.swift
FILE: ../../../flutter/shell/platform/common/windowing.h
FILE: ../../../flutter/shell/platform/darwin/common/availability_version_check.cc
FILE: ../../../flutter/shell/platform/darwin/common/availability_version_check.h
FILE: ../../../flutter/shell/platform/darwin/common/buffer_conversions.h
Expand Down Expand Up @@ -56142,6 +56155,9 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewE
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProviderTest.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewProvider.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewTest.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterWindowController.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterWindowController.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterWindowControllerTest.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap.g.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMapTest.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap_Internal.h
Expand Down Expand Up @@ -56606,6 +56622,10 @@ FILE: ../../../flutter/shell/platform/windows/external_texture_d3d.h
FILE: ../../../flutter/shell/platform/windows/external_texture_pixelbuffer.cc
FILE: ../../../flutter/shell/platform/windows/external_texture_pixelbuffer.h
FILE: ../../../flutter/shell/platform/windows/flutter_desktop_messenger.h
FILE: ../../../flutter/shell/platform/windows/flutter_host_window.cc
FILE: ../../../flutter/shell/platform/windows/flutter_host_window.h
FILE: ../../../flutter/shell/platform/windows/flutter_host_window_controller.cc
FILE: ../../../flutter/shell/platform/windows/flutter_host_window_controller.h
FILE: ../../../flutter/shell/platform/windows/flutter_key_map.g.cc
FILE: ../../../flutter/shell/platform/windows/flutter_platform_node_delegate_windows.cc
FILE: ../../../flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h
Expand Down
13 changes: 13 additions & 0 deletions engine/src/flutter/shell/platform/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ source_set("common_cpp_input") {
deps = [ "//flutter/fml:fml" ]
}

source_set("common_cpp_isolate_scope") {
public = [ "isolate_scope.h" ]
sources = [ "isolate_scope.cc" ]

deps = [
"$dart_src/runtime:dart_api",
"//flutter/fml:fml",
]
}

source_set("common_cpp_enums") {
public = [
"app_lifecycle_state.h",
Expand Down Expand Up @@ -142,11 +152,14 @@ source_set("common_cpp_core") {
public = [
"geometry.h",
"path_utils.h",
"windowing.h",
]

sources = [ "path_utils.cc" ]

public_configs = [ "//flutter:config" ]

deps = [ "//flutter/fml:fml" ]
}

if (enable_unittests) {
Expand Down
24 changes: 24 additions & 0 deletions engine/src/flutter/shell/platform/common/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define FLUTTER_SHELL_PLATFORM_COMMON_GEOMETRY_H_

#include <cmath>
#include <limits>
#include <optional>

namespace flutter {

Expand Down Expand Up @@ -45,6 +47,7 @@ class Size {
bool operator==(const Size& other) const {
return width_ == other.width_ && height_ == other.height_;
}
bool operator!=(const Size& other) const { return !(*this == other); }

private:
double width_ = 0.0;
Expand Down Expand Up @@ -78,6 +81,27 @@ class Rect {
Size size_;
};

// Encapsulates a min and max size that represents the constraints that some
// arbitrary box is able to take up.
class BoxConstraints {
public:
BoxConstraints() = default;
BoxConstraints(const std::optional<Size>& smallest,
const std::optional<Size>& biggest)
: smallest_(smallest.value_or(Size(0, 0))),
biggest_(
biggest.value_or(Size(std::numeric_limits<double>::infinity(),
std::numeric_limits<double>::infinity()))) {}
BoxConstraints(const BoxConstraints& other) = default;
Size biggest() const { return biggest_; }
Size smallest() const { return smallest_; }

private:
Size smallest_ = Size(0, 0);
Size biggest_ = Size(std::numeric_limits<double>::infinity(),
std::numeric_limits<double>::infinity());
};

} // namespace flutter

#endif // FLUTTER_SHELL_PLATFORM_COMMON_GEOMETRY_H_
40 changes: 40 additions & 0 deletions engine/src/flutter/shell/platform/common/isolate_scope.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/shell/platform/common/isolate_scope.h"

namespace flutter {

Isolate Isolate::Current() {
Dart_Isolate isolate = Dart_CurrentIsolate();
return Isolate(isolate);
}

IsolateScope::IsolateScope(const Isolate& isolate) {
isolate_ = isolate.isolate_;
previous_ = Dart_CurrentIsolate();
if (previous_ == isolate_) {
return;
}
if (previous_) {
Dart_ExitIsolate();
}
Dart_EnterIsolate(isolate_);
};

IsolateScope::~IsolateScope() {
Dart_Isolate current = Dart_CurrentIsolate();
FML_DCHECK(!current || current == isolate_);
if (previous_ == isolate_) {
return;
}
if (current) {
Dart_ExitIsolate();
}
if (previous_) {
Dart_EnterIsolate(previous_);
}
}

} // namespace flutter
47 changes: 47 additions & 0 deletions engine/src/flutter/shell/platform/common/isolate_scope.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/fml/logging.h"
#include "third_party/dart/runtime/include/dart_api.h"

#ifndef FLUTTER_SHELL_PLATFORM_COMMON_ISOLATE_SCOPE_H_
#define FLUTTER_SHELL_PLATFORM_COMMON_ISOLATE_SCOPE_H_

namespace flutter {

/// This class is a thin wrapper around dart isolate. It can be used
/// as argument to IsolateScope constructor to enter and exit the isolate.
class Isolate {
public:
/// Retrieve the current Dart Isolate. If no isolate is current, this
/// results in a crash.
static Isolate Current();

~Isolate() = default;

private:
explicit Isolate(Dart_Isolate isolate) : isolate_(isolate) {
FML_DCHECK(isolate_ != nullptr);
}

friend class IsolateScope;
Dart_Isolate isolate_;
};

// Enters provided isolate for as long as the scope is alive.
class IsolateScope {
public:
explicit IsolateScope(const Isolate& isolate);
~IsolateScope();

private:
Dart_Isolate isolate_;
Dart_Isolate previous_;
IsolateScope() = delete;
IsolateScope(IsolateScope const&) = delete;
};

} // namespace flutter

#endif // FLUTTER_SHELL_PLATFORM_COMMON_ISOLATE_SCOPE_H_
20 changes: 20 additions & 0 deletions engine/src/flutter/shell/platform/common/windowing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_SHELL_PLATFORM_COMMON_WINDOWING_H_
#define FLUTTER_SHELL_PLATFORM_COMMON_WINDOWING_H_

namespace flutter {

// Types of windows.
// The value must match value from WindowType in the Dart code
// in packages/flutter/lib/src/widgets/window.dart
enum class WindowArchetype {
// Regular top-level window.
kRegular,
};

} // namespace flutter

#endif // FLUTTER_SHELL_PLATFORM_COMMON_WINDOWING_H_
7 changes: 7 additions & 0 deletions engine/src/flutter/shell/platform/darwin/macos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ source_set("flutter_framework_source") {
"framework/Source/FlutterViewEngineProvider.h",
"framework/Source/FlutterViewEngineProvider.mm",
"framework/Source/FlutterViewProvider.h",
"framework/Source/FlutterWindowController.h",
"framework/Source/FlutterWindowController.mm",
"framework/Source/KeyCodeMap.g.mm",
]

Expand All @@ -143,8 +145,10 @@ source_set("flutter_framework_source") {
"//flutter/flow:flow",
"//flutter/fml",
"//flutter/shell/platform/common:common_cpp_accessibility",
"//flutter/shell/platform/common:common_cpp_core",
"//flutter/shell/platform/common:common_cpp_enums",
"//flutter/shell/platform/common:common_cpp_input",
"//flutter/shell/platform/common:common_cpp_isolate_scope",
"//flutter/shell/platform/common:common_cpp_switches",
"//flutter/shell/platform/darwin/common:availability_version_check",
"//flutter/shell/platform/darwin/common:framework_common",
Expand Down Expand Up @@ -238,14 +242,17 @@ executable("flutter_desktop_darwin_unittests") {
"framework/Source/KeyCodeMapTest.mm",
"framework/Source/TestFlutterPlatformView.h",
"framework/Source/TestFlutterPlatformView.mm",
"framework/source/FlutterWindowControllerTest.mm",
]

deps = [
":flutter_desktop_darwin_fixtures",
":flutter_framework_source",
"//flutter/fml",
"//flutter/shell/platform/common:common_cpp_accessibility",
"//flutter/shell/platform/common:common_cpp_core",
"//flutter/shell/platform/common:common_cpp_enums",
"//flutter/shell/platform/common:common_cpp_isolate_scope",
"//flutter/shell/platform/darwin/common:framework_common",
"//flutter/shell/platform/darwin/common:test_utils_swift",
"//flutter/shell/platform/darwin/graphics",
Expand Down
Loading