| Flutter Windows Embedder |

host_window_regular.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "flutter/shell/platform/windows/host_window_regular.h"
6
7 #include "flutter/shell/platform/windows/flutter_windows_engine.h"
8
9 namespace flutter {
10 HostWindowRegular::HostWindowRegular(WindowManager* window_manager,
11 FlutterWindowsEngine* engine,
12 const WindowSizeRequest& preferred_size,
13 const BoxConstraints& constraints,
14 LPCWSTR title)
15
16 : HostWindow(window_manager,
17 engine,
18 WindowArchetype::kRegular,
19 WS_OVERLAPPEDWINDOW,
20 0,
21 constraints,
22 GetInitialRect(engine, preferred_size, constraints),
23 title,
24 std::nullopt) {
25 // TODO(knopp): Investigate sizing the window to its content with the help of
26 // https://github.com/flutter/flutter/pull/173610.
27 FML_CHECK(preferred_size.has_preferred_view_size);
28 }
29
30 Rect HostWindowRegular::GetInitialRect(FlutterWindowsEngine* engine,
31 const WindowSizeRequest& preferred_size,
32 const BoxConstraints& constraints) {
33 std::optional<Size> const window_size =
34 HostWindow::GetWindowSizeForClientSize(
35 *engine->windows_proc_table(),
36 Size(preferred_size.preferred_view_width,
37 preferred_size.preferred_view_height),
38 constraints.smallest(), constraints.biggest(), WS_OVERLAPPEDWINDOW, 0,
39 nullptr);
40 return {{CW_USEDEFAULT, CW_USEDEFAULT},
41 window_size ? *window_size : Size{CW_USEDEFAULT, CW_USEDEFAULT}};
42 }
43
44 } // namespace flutter
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:92
flutter::FlutterWindowsEngine::windows_proc_table
std::shared_ptr< WindowsProcTable > windows_proc_table()
Definition: flutter_windows_engine.h:316
flutter::HostWindow
Definition: host_window.h:27
flutter::HostWindow::GetWindowSizeForClientSize
static std::optional< Size > GetWindowSizeForClientSize(WindowsProcTable const &win32, Size const &client_size, std::optional< Size > smallest, std::optional< Size > biggest, DWORD window_style, DWORD extended_window_style, std::optional< HWND > const &owner_hwnd)
Definition: host_window.cc:725
flutter::HostWindowRegular::HostWindowRegular
HostWindowRegular(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const BoxConstraints &constraints, LPCWSTR title)
Definition: host_window_regular.cc:10
flutter::WindowManager
Definition: window_manager.h:84
flutter_windows_engine.h
host_window_regular.h
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::WindowArchetype
WindowArchetype
Definition: windowing.h:11
flutter::WindowArchetype::kRegular
@ kRegular
flutter::WindowSizeRequest
Definition: window_manager.h:26
flutter::WindowSizeRequest::preferred_view_height
double preferred_view_height
Definition: window_manager.h:29
flutter::WindowSizeRequest::preferred_view_width
double preferred_view_width
Definition: window_manager.h:28
flutter::WindowSizeRequest::has_preferred_view_size
bool has_preferred_view_size
Definition: window_manager.h:27