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 
6 
8 
9 namespace flutter {
11  FlutterWindowsEngine* engine,
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 
32 Rect 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
std::shared_ptr< WindowsProcTable > windows_proc_table()
void InitializeFlutterView(HostWindowInitializationParams const &params)
Definition: host_window.cc:245
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:737
HostWindowRegular(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const BoxConstraints &constraints, LPCWSTR title)