24 constexpr
wchar_t kWindowClassName[] = L
"FLUTTER_HOST_WINDOW";
28 flutter::Size ClampToVirtualScreen(flutter::Size size) {
29 double const virtual_screen_width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
30 double const virtual_screen_height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
32 return flutter::Size(std::clamp(size.width(), 0.0, virtual_screen_width),
33 std::clamp(size.height(), 0.0, virtual_screen_height));
38 std::string GetLastErrorAsString() {
39 LPWSTR message_buffer =
nullptr;
41 if (DWORD
const size = FormatMessage(
42 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
43 FORMAT_MESSAGE_IGNORE_INSERTS,
44 nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
45 reinterpret_cast<LPTSTR
>(&message_buffer), 0,
nullptr)) {
46 std::wstring
const wide_message(message_buffer, size);
47 LocalFree(message_buffer);
48 message_buffer =
nullptr;
50 if (
int const buffer_size =
51 WideCharToMultiByte(CP_UTF8, 0, wide_message.c_str(), -1,
nullptr,
52 0,
nullptr,
nullptr)) {
53 std::string
message(buffer_size, 0);
54 WideCharToMultiByte(CP_UTF8, 0, wide_message.c_str(), -1, &
message[0],
55 buffer_size,
nullptr,
nullptr);
61 LocalFree(message_buffer);
63 std::ostringstream oss;
64 oss <<
"Format message failed with 0x" << std::hex << std::setfill(
'0')
65 << std::setw(8) << GetLastError();
71 bool IsClassRegistered(LPCWSTR class_name) {
72 WNDCLASSEX window_class = {};
73 return GetClassInfoEx(GetModuleHandle(
nullptr), class_name, &window_class) !=
83 #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
84 #define DWMWA_USE_IMMERSIVE_DARK_MODE 20
88 void UpdateTheme(HWND window) {
90 const wchar_t kGetPreferredBrightnessRegKey[] =
91 L
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
92 const wchar_t kGetPreferredBrightnessRegValue[] = L
"AppsUseLightTheme";
97 DWORD light_mode_size =
sizeof(light_mode);
98 LSTATUS
const result =
99 RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey,
100 kGetPreferredBrightnessRegValue, RRF_RT_REG_DWORD,
nullptr,
101 &light_mode, &light_mode_size);
103 if (result == ERROR_SUCCESS) {
104 BOOL enable_dark_mode = light_mode == 0;
106 &enable_dark_mode,
sizeof(enable_dark_mode));
111 void SetChildContent(HWND
content, HWND window) {
114 GetClientRect(window, &client_rect);
115 MoveWindow(
content, client_rect.left, client_rect.top,
116 client_rect.right - client_rect.left,
117 client_rect.bottom - client_rect.top,
true);
135 void AdjustAlongAxis(LONG dst_origin, LONG dst_size, LONG* origin, LONG* size) {
136 *size = std::min(dst_size, *size);
137 if (*origin < dst_origin)
138 *origin = dst_origin;
140 *origin = std::min(dst_origin + dst_size, *origin + *size) - *size;
143 RECT AdjustToFit(
const RECT& parent,
const RECT& child) {
144 auto new_x = child.left;
145 auto new_y = child.top;
152 result.right = new_x + new_width;
154 result.bottom = new_y + new_height;
158 flutter::BoxConstraints FromWindowConstraints(
160 std::optional<flutter::Size> smallest, biggest;
171 return flutter::BoxConstraints(smallest, biggest);
184 bool sized_to_content,
186 return std::unique_ptr<HostWindow>(
188 FromWindowConstraints(preferred_constraints), title,
189 sized_to_content, resizable));
199 bool sized_to_content,
202 window_manager, engine, preferred_size,
203 FromWindowConstraints(preferred_constraints), title,
204 parent ? parent : std::optional<HWND>(), sized_to_content, resizable));
214 window_manager, engine, FromWindowConstraints(preferred_constraints),
215 get_position_callback, parent));
225 window_manager, engine, FromWindowConstraints(preferred_constraints),
226 get_position_callback, parent));
237 bool sized_to_content,
240 window_manager, engine, preferred_size,
241 FromWindowConstraints(preferred_constraints), get_position_callback,
242 parent, title, sized_to_content, resizable));
247 : window_manager_(window_manager), engine_(engine) {}
252 auto view_window = std::make_unique<FlutterWindow>(
256 std::unique_ptr<FlutterWindowsView> view =
260 FML_CHECK(view !=
nullptr);
263 std::make_unique<FlutterWindowsViewController>(
nullptr, std::move(view));
271 if (!IsClassRegistered(kWindowClassName)) {
272 auto const idi_app_icon = 101;
273 WNDCLASSEX window_class = {};
274 window_class.cbSize =
sizeof(WNDCLASSEX);
275 window_class.style = CS_HREDRAW | CS_VREDRAW;
277 window_class.hInstance = GetModuleHandle(
nullptr);
279 LoadIcon(window_class.hInstance, MAKEINTRESOURCE(idi_app_icon));
280 if (!window_class.hIcon) {
281 window_class.hIcon = LoadIcon(
nullptr, IDI_APPLICATION);
283 window_class.hCursor = LoadCursor(
nullptr, IDC_ARROW);
284 window_class.lpszClassName = kWindowClassName;
286 FML_CHECK(RegisterClassEx(&window_class));
315 if (weak_alive.expired() || !::IsWindow(hwnd)) {
319 ShowWindow(hwnd, cmd_show);
321 archetype_ = params.archetype;
322 SetWindowLongPtr(window_handle_, GWLP_USERDATA,
323 reinterpret_cast<LONG_PTR
>(
this));
326 void HostWindow::OnFirstFrame() {}
328 void HostWindow::AlignOriginWithFrame() {
330 if (FAILED(DwmGetWindowAttribute(window_handle_, DWMWA_EXTENDED_FRAME_BOUNDS,
331 &frame_rect,
sizeof(frame_rect)))) {
335 if (!GetWindowRect(window_handle_, &window_rect)) {
339 LONG
const left_dropshadow_width = frame_rect.left - window_rect.left;
340 LONG
const top_dropshadow_height = window_rect.top - frame_rect.top;
341 if (left_dropshadow_width == 0 && top_dropshadow_height == 0) {
345 SetWindowPos(window_handle_,
nullptr,
346 window_rect.left - left_dropshadow_width,
347 window_rect.top - top_dropshadow_height, 0, 0,
348 SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE);
351 HostWindow::~HostWindow() {
352 if (view_controller_) {
355 if (!UnregisterClass(kWindowClassName, GetModuleHandle(
nullptr))) {
357 SetLastError(ERROR_SUCCESS);
363 wchar_t class_name[256];
364 if (!GetClassName(hwnd, class_name,
sizeof(class_name) /
sizeof(
wchar_t))) {
365 FML_LOG(ERROR) <<
"Failed to get class name for window handle " << hwnd
366 <<
": " << GetLastErrorAsString();
370 if (wcscmp(class_name, kWindowClassName) != 0) {
374 return reinterpret_cast<HostWindow*
>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
377 HWND HostWindow::GetWindowHandle()
const {
378 return window_handle_;
381 HWND HostWindow::GetFlutterViewWindowHandle()
const {
387 if (window !=
nullptr && child_content !=
nullptr) {
388 SetFocus(child_content);
392 void HostWindow::HandleWindowActivation(HWND hwnd, WPARAM wparam) {
393 if (LOWORD(wparam) == WA_INACTIVE) {
402 if (!IsWindowEnabled(hwnd)) {
406 if (
HostWindow*
const enabled_descendant = FindFirstEnabledDescendant()) {
407 SetActiveWindow(enabled_descendant->GetWindowHandle());
408 FocusRootViewOf(
this);
413 FocusRootViewOf(
this);
416 LRESULT HostWindow::WndProc(HWND hwnd,
421 auto*
const create_struct =
reinterpret_cast<CREATESTRUCT*
>(lparam);
422 auto*
const windows_proc_table =
425 }
else if (
HostWindow*
const window = GetThisFromHandle(hwnd)) {
426 return window->HandleMessage(hwnd,
message, wparam, lparam);
429 return DefWindowProc(hwnd,
message, wparam, lparam);
432 LRESULT HostWindow::HandleMessage(HWND hwnd,
436 auto result = engine_->window_proc_delegate_manager()->OnTopLevelWindowProc(
437 window_handle_,
message, wparam, lparam);
444 is_being_destroyed_ =
true;
447 case WM_NCLBUTTONDOWN: {
451 if (SendMessage(window_handle_, WM_NCHITTEST, wparam, lparam) ==
457 GetCursorPos(&cursorPos);
458 ScreenToClient(window_handle_, &cursorPos);
459 PostMessage(window_handle_, WM_MOUSEMOVE, 0,
460 MAKELPARAM(cursorPos.x, cursorPos.y));
465 case WM_DPICHANGED: {
466 auto*
const new_scaled_window_rect =
reinterpret_cast<RECT*
>(lparam);
468 new_scaled_window_rect->right - new_scaled_window_rect->left;
470 new_scaled_window_rect->bottom - new_scaled_window_rect->top;
471 SetWindowPos(hwnd,
nullptr, new_scaled_window_rect->left,
472 new_scaled_window_rect->top, width, height,
473 SWP_NOZORDER | SWP_NOACTIVATE);
477 case WM_GETMINMAXINFO: {
479 GetWindowRect(hwnd, &window_rect);
481 GetClientRect(hwnd, &client_rect);
482 LONG
const non_client_width = (window_rect.right - window_rect.left) -
483 (client_rect.right - client_rect.left);
484 LONG
const non_client_height = (window_rect.bottom - window_rect.top) -
485 (client_rect.bottom - client_rect.top);
488 double const scale_factor =
489 static_cast<double>(dpi) / USER_DEFAULT_SCREEN_DPI;
491 MINMAXINFO* info =
reinterpret_cast<MINMAXINFO*
>(lparam);
492 Size
const min_physical_size = ClampToVirtualScreen(Size(
493 box_constraints_.smallest().width() * scale_factor + non_client_width,
494 box_constraints_.smallest().height() * scale_factor +
497 info->ptMinTrackSize.x = min_physical_size.width();
498 info->ptMinTrackSize.y = min_physical_size.height();
499 Size
const max_physical_size = ClampToVirtualScreen(Size(
500 box_constraints_.biggest().width() * scale_factor + non_client_width,
501 box_constraints_.biggest().height() * scale_factor +
504 info->ptMaxTrackSize.x = max_physical_size.width();
505 info->ptMaxTrackSize.y = max_physical_size.height();
510 auto child_content = view_controller_->view()->GetWindowHandle();
511 if (child_content !=
nullptr) {
514 GetClientRect(hwnd, &client_rect);
515 MoveWindow(child_content, client_rect.left, client_rect.top,
516 client_rect.right - client_rect.left,
517 client_rect.bottom - client_rect.top, TRUE);
523 HandleWindowActivation(hwnd, wparam);
526 case WM_WINDOWPOSCHANGED: {
530 auto const*
const window_pos =
reinterpret_cast<WINDOWPOS*
>(lparam);
531 UINT
const kNoClientChange = SWP_NOMOVE | SWP_NOSIZE;
533 ((window_pos->flags & kNoClientChange) != kNoClientChange ||
534 (window_pos->flags & SWP_FRAMECHANGED))) {
535 for (
HostWindow*
const owned : GetOwnedWindows()) {
536 if (owned->GetArchetype() == WindowArchetype::kSatellite) {
544 case WM_DWMCOLORIZATIONCOLORCHANGED:
552 if (!view_controller_) {
556 return DefWindowProc(hwnd,
message, wparam, lparam);
564 if (GetFullscreen()) {
565 std::optional<Size>
const window_size = GetWindowSizeForClientSize(
566 *engine_->windows_proc_table(),
568 box_constraints_.smallest(), box_constraints_.biggest(),
569 saved_window_info_.style, saved_window_info_.ex_style,
nullptr);
574 saved_window_info_.client_size =
577 saved_window_info_.rect.right =
578 saved_window_info_.rect.left +
static_cast<LONG
>(window_size->width());
579 saved_window_info_.rect.bottom =
580 saved_window_info_.rect.top +
static_cast<LONG
>(window_size->height());
582 WINDOWINFO window_info = {.cbSize =
sizeof(WINDOWINFO)};
583 GetWindowInfo(window_handle_, &window_info);
585 std::optional<Size>
const window_size = GetWindowSizeForClientSize(
586 *engine_->windows_proc_table(),
588 box_constraints_.smallest(), box_constraints_.biggest(),
589 window_info.dwStyle, window_info.dwExStyle,
nullptr);
595 SetWindowPos(window_handle_, NULL, 0, 0, window_size->width(),
596 window_size->height(),
597 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
602 box_constraints_ = FromWindowConstraints(constraints);
604 if (GetFullscreen()) {
605 std::optional<Size>
const window_size = GetWindowSizeForClientSize(
606 *engine_->windows_proc_table(),
607 Size(saved_window_info_.client_size.width,
608 saved_window_info_.client_size.height),
609 box_constraints_.smallest(), box_constraints_.biggest(),
610 saved_window_info_.style, saved_window_info_.ex_style,
nullptr);
615 saved_window_info_.rect.right =
616 saved_window_info_.rect.left +
static_cast<LONG
>(window_size->width());
617 saved_window_info_.rect.bottom =
618 saved_window_info_.rect.top +
static_cast<LONG
>(window_size->height());
620 auto const client_size = GetWindowContentSize(window_handle_);
621 auto const current_size = Size(client_size.width, client_size.height);
622 WINDOWINFO window_info = {.cbSize =
sizeof(WINDOWINFO)};
623 GetWindowInfo(window_handle_, &window_info);
624 std::optional<Size>
const window_size = GetWindowSizeForClientSize(
625 *engine_->windows_proc_table(), current_size,
626 box_constraints_.smallest(), box_constraints_.biggest(),
627 window_info.dwStyle, window_info.dwExStyle,
nullptr);
629 if (window_size && current_size != window_size) {
630 SetWindowPos(window_handle_, NULL, 0, 0, window_size->width(),
631 window_size->height(),
632 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
642 void HostWindow::SetFullscreen(
644 std::optional<FlutterEngineDisplayId> display_id) {
645 if (fullscreen == GetFullscreen()) {
650 WINDOWINFO window_info = {.cbSize =
sizeof(WINDOWINFO)};
651 GetWindowInfo(window_handle_, &window_info);
652 saved_window_info_.style = window_info.dwStyle;
653 saved_window_info_.ex_style = window_info.dwExStyle;
656 ::GetWindowRect(window_handle_, &saved_window_info_.rect);
657 saved_window_info_.client_size = GetWindowContentSize(window_handle_);
659 saved_window_info_.monitor =
660 MonitorFromWindow(window_handle_, MONITOR_DEFAULTTONEAREST);
661 saved_window_info_.monitor_info.cbSize =
662 sizeof(saved_window_info_.monitor_info);
663 GetMonitorInfo(saved_window_info_.monitor,
664 &saved_window_info_.monitor_info);
670 MonitorFromWindow(window_handle_, MONITOR_DEFAULTTONEAREST);
672 if (
auto const display =
673 engine_->display_manager()->FindById(display_id.value())) {
674 monitor =
reinterpret_cast<HMONITOR
>(display->display_id);
678 MONITORINFO monitor_info;
679 monitor_info.cbSize =
sizeof(monitor_info);
680 if (!GetMonitorInfo(monitor, &monitor_info)) {
681 FML_LOG(ERROR) <<
"Cannot set window fullscreen because the monitor info "
685 auto const width =
RectWidth(monitor_info.rcMonitor);
686 auto const height =
RectHeight(monitor_info.rcMonitor);
687 WINDOWINFO window_info = {.cbSize =
sizeof(WINDOWINFO)};
688 GetWindowInfo(window_handle_, &window_info);
691 SetWindowLong(window_handle_, GWL_STYLE,
692 saved_window_info_.style & ~(WS_CAPTION | WS_THICKFRAME));
694 window_handle_, GWL_EXSTYLE,
695 saved_window_info_.ex_style & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE |
696 WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
701 SetWindowPos(window_handle_, NULL, 0, 0, 0, 0,
702 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
704 SetWindowPos(window_handle_,
nullptr, monitor_info.rcMonitor.left,
705 monitor_info.rcMonitor.top, width, height,
706 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
712 SetWindowLong(window_handle_, GWL_STYLE,
713 saved_window_info_.style | WS_VISIBLE);
714 SetWindowLong(window_handle_, GWL_EXSTYLE, saved_window_info_.ex_style);
719 SetWindowPos(window_handle_, NULL, 0, 0, 0, 0,
720 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
723 MonitorFromRect(&saved_window_info_.rect, MONITOR_DEFAULTTONEAREST);
724 MONITORINFO monitor_info;
725 monitor_info.cbSize =
sizeof(monitor_info);
726 GetMonitorInfo(monitor, &monitor_info);
728 auto window_rect = saved_window_info_.rect;
732 if (monitor != saved_window_info_.monitor ||
734 monitor_info.rcWork)) {
735 window_rect = AdjustToFit(monitor_info.rcWork, window_rect);
739 SetWindowPos(window_handle_,
nullptr, window_rect.left, window_rect.top,
741 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
743 if (final_dpi != saved_window_info_.dpi || final_dpi != fullscreen_dpi) {
751 if (final_dpi != saved_window_info_.dpi) {
753 final_dpi /
static_cast<float>(saved_window_info_.dpi);
754 auto const width =
static_cast<LONG
>(scale *
RectWidth(window_rect));
755 auto const height =
static_cast<LONG
>(scale *
RectHeight(window_rect));
756 window_rect.right = window_rect.left + width;
757 window_rect.bottom = window_rect.top + height;
758 window_rect = AdjustToFit(monitor_info.rcWork, window_rect);
761 SetWindowPos(window_handle_,
nullptr, window_rect.left, window_rect.top,
763 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
767 if (!task_bar_list_) {
769 ::CoCreateInstance(CLSID_TaskbarList,
nullptr, CLSCTX_INPROC_SERVER,
770 IID_PPV_ARGS(&task_bar_list_));
771 if (SUCCEEDED(hr) && FAILED(task_bar_list_->HrInit())) {
772 task_bar_list_ =
nullptr;
781 if (task_bar_list_) {
782 task_bar_list_->MarkFullscreenWindow(window_handle_, !!fullscreen);
785 is_fullscreen_ = fullscreen;
788 bool HostWindow::GetFullscreen()
const {
789 return is_fullscreen_;
794 GetClientRect(hwnd, &rect);
796 static_cast<double>(USER_DEFAULT_SCREEN_DPI);
797 double const width = rect.right / dpr;
798 double const height = rect.bottom / dpr;
800 .width = rect.right / dpr,
801 .height = rect.bottom / dpr,
805 std::optional<Size> HostWindow::GetWindowSizeForClientSize(
807 Size
const& client_size,
808 std::optional<Size> smallest,
809 std::optional<Size> biggest,
811 DWORD extended_window_style,
812 std::optional<HWND>
const& owner_hwnd) {
813 UINT
const dpi =
GetDpiForHWND(owner_hwnd ? *owner_hwnd :
nullptr);
814 double const scale_factor =
815 static_cast<double>(dpi) / USER_DEFAULT_SCREEN_DPI;
817 .right =
static_cast<LONG
>(client_size.width() * scale_factor),
818 .bottom =
static_cast<LONG
>(client_size.height() * scale_factor)};
821 extended_window_style, dpi)) {
822 FML_LOG(ERROR) <<
"Failed to run AdjustWindowRectExForDpi: "
823 << GetLastErrorAsString();
827 double width =
static_cast<double>(rect.right - rect.left);
828 double height =
static_cast<double>(rect.bottom - rect.top);
831 double const non_client_width = width - (client_size.width() * scale_factor);
832 double const non_client_height =
833 height - (client_size.height() * scale_factor);
835 flutter::Size min_physical_size = ClampToVirtualScreen(
836 flutter::Size(smallest->width() * scale_factor + non_client_width,
837 smallest->height() * scale_factor + non_client_height));
838 width = std::max(width, min_physical_size.width());
839 height = std::max(height, min_physical_size.height());
842 flutter::Size max_physical_size = ClampToVirtualScreen(
843 flutter::Size(biggest->width() * scale_factor + non_client_width,
844 biggest->height() * scale_factor + non_client_height));
845 width = std::min(width, max_physical_size.width());
846 height = std::min(height, max_physical_size.height());
849 return flutter::Size{width, height};
852 std::optional<Size> HostWindow::GetInitialWindowSize(
855 const BoxConstraints& constraints,
857 DWORD extended_window_style,
858 std::optional<HWND>
const& owner_window,
859 bool sized_to_content) {
861 double client_height;
862 if (sized_to_content) {
865 client_width = std::max(1.0, constraints.smallest().width());
866 client_height = std::max(1.0, constraints.smallest().height());
872 return GetWindowSizeForClientSize(
874 constraints.smallest(), constraints.biggest(), window_style,
875 extended_window_style, owner_window);
878 void HostWindow::EnableRecursively(
bool enable) {
879 EnableWindow(window_handle_, enable);
881 for (
HostWindow*
const owned : GetOwnedWindows()) {
882 owned->EnableRecursively(enable);
887 if (IsWindowEnabled(window_handle_)) {
891 for (
HostWindow*
const owned : GetOwnedWindows()) {
900 std::vector<HostWindow*> HostWindow::GetOwnedWindows()
const {
901 std::vector<HostWindow*> owned_windows;
903 HWND owner_window_handle;
904 std::vector<HostWindow*>* owned_windows;
905 } data{window_handle_, &owned_windows};
908 [](HWND hwnd, LPARAM lparam) -> BOOL {
909 auto*
const data =
reinterpret_cast<EnumData*
>(lparam);
910 if (GetWindow(hwnd, GW_OWNER) == data->owner_window_handle) {
911 HostWindow*
const window = GetThisFromHandle(hwnd);
913 data->owned_windows->push_back(window);
918 reinterpret_cast<LPARAM
>(&data));
920 return owned_windows;
924 if (HWND
const owner_window_handle = GetWindow(GetWindowHandle(), GW_OWNER)) {
925 return GetThisFromHandle(owner_window_handle);
930 void HostWindow::DisableRecursively() {
932 EnableWindow(window_handle_,
false);
934 for (
HostWindow*
const owned : GetOwnedWindows()) {
935 owned->DisableRecursively();
939 void HostWindow::UpdateModalStateLayer() {
940 auto children = GetOwnedWindows();
942 if (children.empty()) {
944 EnableWindow(window_handle_,
true);
947 EnableWindow(window_handle_,
false);
951 auto latest_child = *std::max_element(
953 return a->view_controller_->view()->view_id() <
954 b->view_controller_->view()->view_id();
958 if (child == latest_child) {
959 child->UpdateModalStateLayer();
961 child->DisableRecursively();
std::shared_ptr< WindowsProcTable > windows_proc_table()
void UpdateAccessibilityFeatures()
std::shared_ptr< DisplayManagerWin32 > display_manager()
virtual bool running() const
std::unique_ptr< FlutterWindowsView > CreateView(std::unique_ptr< WindowBindingHandler > window, bool is_sized_to_content, const BoxConstraints &box_constraints, bool allow_implicit_view, FlutterWindowsViewSizingDelegate *sizing_delegate=nullptr)
HWND GetWindowHandle() const
static std::unique_ptr< HostWindow > CreatePopupWindow(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowConstraints &preferred_constraints, GetWindowPositionCallback get_position_callback, HWND parent)
static std::unique_ptr< HostWindow > CreateDialogWindow(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const WindowConstraints &preferred_constraints, LPCWSTR title, HWND parent, bool sized_to_content, bool resizable)
virtual void OnFirstFrame()
void InitializeFlutterView(HostWindowInitializationParams const ¶ms)
std::unique_ptr< FlutterWindowsViewController > view_controller_
void AlignOriginWithFrame()
static LRESULT WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
static std::unique_ptr< HostWindow > CreateTooltipWindow(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowConstraints &preferred_constraints, GetWindowPositionCallback get_position_callback, HWND parent)
static std::unique_ptr< HostWindow > CreateSatelliteWindow(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const WindowConstraints &preferred_constraints, GetWindowPositionCallback get_position_callback, HWND parent, LPCWSTR title, bool sized_to_content, bool resizable)
static std::unique_ptr< HostWindow > CreateRegularWindow(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const WindowConstraints &preferred_constraints, LPCWSTR title, bool sized_to_content, bool resizable)
FlutterWindowsEngine * engine_
HostWindow(WindowManager *window_manager, FlutterWindowsEngine *engine)
std::shared_ptr< int > alive_
HostWindow * FindFirstEnabledDescendant() const
virtual BOOL AdjustWindowRectExForDpi(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi) const
virtual BOOL EnableNonClientDpiScaling(HWND hwnd) const
UINT FlutterDesktopGetDpiForHWND(HWND hwnd)
#define DWMWA_USE_IMMERSIVE_DARK_MODE
union flutter::testing::@108::KeyboardChange::@0 content
UINT GetDpiForHWND(HWND hwnd)
void(* GetWindowPositionCallback)(const WindowSize &child_size, const WindowRect &parent_rect, const WindowRect &display_rect, WindowRect &output_rect)
LONG RectWidth(const RECT &r)
bool AreRectsEqual(const RECT &a, const RECT &b)
LONG RectHeight(const RECT &r)
DWORD extended_window_style
std::optional< HWND > const & owner_window
Rect const initial_window_rect
FlutterWindowsViewSizingDelegate * sizing_delegate
const BoxConstraints & box_constraints
bool has_view_constraints
double preferred_view_height
double preferred_view_width
bool has_preferred_view_size