Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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
6
8
9namespace flutter {
12 const WindowSizeRequest& preferred_size,
13 const BoxConstraints& constraints,
14 LPCWSTR title)
15
16 : HostWindow(window_manager, engine) {
17 // TODO(knopp): Investigate sizing the window to its content with the help of
18 // https://github.com/flutter/flutter/pull/173610.
19 FML_CHECK(preferred_size.has_preferred_view_size);
22 .window_style = WS_OVERLAPPEDWINDOW,
23 .extended_window_style = 0,
24 .box_constraints = constraints,
25 .initial_window_rect =
26 GetInitialRect(engine, preferred_size, constraints),
27 .title = title,
28 .owner_window = std::optional<HWND>(),
29 });
30}
31
32Rect HostWindowRegular::GetInitialRect(FlutterWindowsEngine* engine,
33 const WindowSizeRequest& preferred_size,
34 const BoxConstraints& constraints) {
35 std::optional<Size> const window_size =
37 *engine->windows_proc_table(),
38 Size(preferred_size.preferred_view_width,
39 preferred_size.preferred_view_height),
40 constraints.smallest(), constraints.biggest(), WS_OVERLAPPEDWINDOW, 0,
41 nullptr);
42 return {{CW_USEDEFAULT, CW_USEDEFAULT},
43 window_size ? *window_size : Size{CW_USEDEFAULT, CW_USEDEFAULT}};
44}
45
46} // namespace flutter
Size smallest() const
Definition geometry.h:94
Size biggest() const
Definition geometry.h:93
void InitializeFlutterView(HostWindowInitializationParams const &params)
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)
HostWindowRegular(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const BoxConstraints &constraints, LPCWSTR title)
FlutterEngine engine
Definition main.cc:84
#define FML_CHECK(condition)
Definition logging.h:104