| Flutter Windows Embedder |

Namespaces | Functions
window_manager.cc File Reference
`#include "flutter/shell/platform/windows/window_manager.h"`
`#include <dwmapi.h>`
`#include <optional>`
`#include <vector>`
`#include "embedder.h"`
`#include "flutter/shell/platform/common/windowing.h"`
`#include "flutter/shell/platform/windows/flutter_windows_engine.h"`
`#include "flutter/shell/platform/windows/flutter_windows_view_controller.h"`
`#include "flutter/shell/platform/windows/host_window.h"`
`#include "fml/logging.h"`
`#include "shell/platform/windows/client_wrapper/include/flutter/flutter_view.h"`
`#include "shell/platform/windows/flutter_windows_view.h"`
`#include "shell/platform/windows/host_window_tooltip.h"`

Go to the source code of this file.

## Namespaces
| flutter

## Functions
void | InternalFlutterWindows_WindowManager_Initialize (int64_t engine_id, const flutter::WindowingInitRequest *request)
FlutterViewId | InternalFlutterWindows_WindowManager_CreateRegularWindow (int64_t engine_id, const flutter::RegularWindowCreationRequest *request)
FLUTTER_EXPORT FlutterViewId | InternalFlutterWindows_WindowManager_CreateDialogWindow (int64_t engine_id, const flutter::DialogWindowCreationRequest *request)
FLUTTER_EXPORT FlutterViewId | InternalFlutterWindows_WindowManager_CreateTooltipWindow (int64_t engine_id, const flutter::TooltipWindowCreationRequest *request)
HWND | InternalFlutterWindows_WindowManager_GetTopLevelWindowHandle (int64_t engine_id, FlutterViewId view_id)
flutter::ActualWindowSize | InternalFlutterWindows_WindowManager_GetWindowContentSize (HWND hwnd)
void | InternalFlutterWindows_WindowManager_SetWindowSize (HWND hwnd, const flutter::WindowSizeRequest *size)
void | InternalFlutterWindows_WindowManager_OnDestroyWindow (HWND hwnd)
void | InternalFlutterWindows_WindowManager_SetWindowConstraints (HWND hwnd, const flutter::WindowConstraints *constraints)
void | InternalFlutterWindows_WindowManager_SetFullscreen (HWND hwnd, const flutter::FullscreenRequest *request)
bool | InternalFlutterWindows_WindowManager_GetFullscreen (HWND hwnd)
FLUTTER_EXPORT void | InternalFlutterWindows_WindowManager_UpdateTooltipPosition (HWND hwnd)

## Function Documentation

## ◆ InternalFlutterWindows_WindowManager_CreateDialogWindow()

FLUTTER_EXPORT FlutterViewId InternalFlutterWindows_WindowManager_CreateDialogWindow | ( | int64_t | engine_id,
|  | const flutter::DialogWindowCreationRequest * | request
| ) |  |

Definition at line 149 of file window_manager.cc.

151 {
152 flutter::FlutterWindowsEngine* engine =
153 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
154 return engine->window_manager()->CreateDialogWindow(request);
155 }
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:92
flutter::FlutterWindowsEngine::GetEngineForId
static FlutterWindowsEngine * GetEngineForId(int64_t engine_id)
Definition: flutter_windows_engine.cc:259
flutter::FlutterWindowsEngine::window_manager
WindowManager * window_manager()
Definition: flutter_windows_engine.h:330
flutter::WindowManager::CreateDialogWindow
FlutterViewId CreateDialogWindow(const DialogWindowCreationRequest *request)
Definition: window_manager.cc:45

References flutter::WindowManager::CreateDialogWindow(), flutter::FlutterWindowsEngine::GetEngineForId(), and flutter::FlutterWindowsEngine::window_manager().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_CreateRegularWindow()

FlutterViewId InternalFlutterWindows_WindowManager_CreateRegularWindow | ( | int64_t | engine_id,
|  | const flutter::RegularWindowCreationRequest * | request
| ) |  |

Definition at line 140 of file window_manager.cc.

142 {
143 flutter::FlutterWindowsEngine* engine =
144 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
145 return engine->window_manager()->CreateRegularWindow(request);
146 }
flutter::WindowManager::CreateRegularWindow
FlutterViewId CreateRegularWindow(const RegularWindowCreationRequest *request)
Definition: window_manager.cc:31

References flutter::WindowManager::CreateRegularWindow(), flutter::FlutterWindowsEngine::GetEngineForId(), and flutter::FlutterWindowsEngine::window_manager().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_CreateTooltipWindow()

FLUTTER_EXPORT FlutterViewId InternalFlutterWindows_WindowManager_CreateTooltipWindow | ( | int64_t | engine_id,
|  | const flutter::TooltipWindowCreationRequest * | request
| ) |  |

Definition at line 158 of file window_manager.cc.

160 {
161 flutter::FlutterWindowsEngine* engine =
162 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
163 return engine->window_manager()->CreateTooltipWindow(request);
164 }
flutter::WindowManager::CreateTooltipWindow
FlutterViewId CreateTooltipWindow(const TooltipWindowCreationRequest *request)
Definition: window_manager.cc:59

References flutter::WindowManager::CreateTooltipWindow(), flutter::FlutterWindowsEngine::GetEngineForId(), and flutter::FlutterWindowsEngine::window_manager().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_GetFullscreen()

bool InternalFlutterWindows_WindowManager_GetFullscreen | ( | HWND | hwnd | ) |

Definition at line 235 of file window_manager.cc.

235 {
236 flutter::HostWindow* window = flutter::HostWindow::GetThisFromHandle(hwnd);
237 if (window) {
238 return window->GetFullscreen();
239 }
240
241 return false;
242 }
flutter::HostWindow
Definition: host_window.h:29
flutter::HostWindow::GetThisFromHandle
static HostWindow * GetThisFromHandle(HWND hwnd)
Definition: host_window.cc:335
flutter::HostWindow::GetFullscreen
virtual bool GetFullscreen() const
Definition: host_window.cc:720

References flutter::HostWindow::GetFullscreen(), and flutter::HostWindow::GetThisFromHandle().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_GetTopLevelWindowHandle()

HWND InternalFlutterWindows_WindowManager_GetTopLevelWindowHandle | ( | int64_t | engine_id,
|  | FlutterViewId | view_id
| ) |  |

Definition at line 166 of file window_manager.cc.

168 {
169 flutter::FlutterWindowsEngine* engine =
170 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
171 flutter::FlutterWindowsView* view = engine->view(view_id);
172 if (view == nullptr) {
173 return nullptr;
174 } else {
175 return GetAncestor(view->GetWindowHandle(), GA_ROOT);
176 }
177 }
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view(FlutterViewId view_id) const
Definition: flutter_windows_engine.cc:692
flutter::FlutterWindowsView
Definition: flutter_windows_view.h:46
flutter::FlutterWindowsView::GetWindowHandle
virtual HWND GetWindowHandle() const
Definition: flutter_windows_view.cc:822

References flutter::FlutterWindowsEngine::GetEngineForId(), flutter::FlutterWindowsView::GetWindowHandle(), and flutter::FlutterWindowsEngine::view().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_GetWindowContentSize()

flutter::ActualWindowSize InternalFlutterWindows_WindowManager_GetWindowContentSize | ( | HWND | hwnd | ) |

Definition at line 180 of file window_manager.cc.

180 {
181 return flutter::HostWindow::GetWindowContentSize(hwnd);
182 }
flutter::HostWindow::GetWindowContentSize
static ActualWindowSize GetWindowContentSize(HWND hwnd)
Definition: host_window.cc:724

References flutter::HostWindow::GetWindowContentSize().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_Initialize()

void InternalFlutterWindows_WindowManager_Initialize | ( | int64_t | engine_id,
|  | const flutter::WindowingInitRequest * | request
| ) |  |

Definition at line 132 of file window_manager.cc.

134 {
135 flutter::FlutterWindowsEngine* engine =
136 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
137 engine->window_manager()->Initialize(request);
138 }
flutter::WindowManager::Initialize
void Initialize(const WindowingInitRequest *request)
Definition: window_manager.cc:26

References flutter::FlutterWindowsEngine::GetEngineForId(), flutter::WindowManager::Initialize(), and flutter::FlutterWindowsEngine::window_manager().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_OnDestroyWindow()

void InternalFlutterWindows_WindowManager_OnDestroyWindow | ( | HWND | hwnd | ) |

Definition at line 193 of file window_manager.cc.

193 {
194 flutter::HostWindow* window = flutter::HostWindow::GetThisFromHandle(hwnd);
195 HWND flutter_view_handle = nullptr;
196 if (window) {
197 // First reparent the FlutterView to null parent. Otherwise destroying
198 // the window HWND will immediately destroy the FlutterView HWND as well,
199 // which will cause crash when raster thread tries to reallocate surface.
200 // The FlutterView may only be destroyed safely when
201 // FlutterWindowsEngine::RemoveView finishes.
202 flutter_view_handle = window->GetFlutterViewWindowHandle();
203 ShowWindow(flutter_view_handle, SW_HIDE);
204 SetParent(flutter_view_handle, nullptr);
205 }
206 DestroyWindow(hwnd);
207 if (flutter_view_handle) {
208 // Now the flutter view HWND can be destroyed safely.
209 DestroyWindow(flutter_view_handle);
210 }
211 }
flutter::HostWindow::GetFlutterViewWindowHandle
HWND GetFlutterViewWindowHandle() const
Definition: host_window.cc:354

References flutter::HostWindow::GetFlutterViewWindowHandle(), and flutter::HostWindow::GetThisFromHandle().

Referenced by flutter::WindowManager::OnEngineShutdown().

## ◆ InternalFlutterWindows_WindowManager_SetFullscreen()

void InternalFlutterWindows_WindowManager_SetFullscreen | ( | HWND | hwnd,
|  | const flutter::FullscreenRequest * | request
| ) |  |

Definition at line 222 of file window_manager.cc.

224 {
225 flutter::HostWindow* window = flutter::HostWindow::GetThisFromHandle(hwnd);
226 const std::optional<FlutterEngineDisplayId> display_id =
227 request->has_display_id
228 ? std::optional<FlutterEngineDisplayId>(request->display_id)
229 : std::nullopt;
230 if (window) {
231 window->SetFullscreen(request->fullscreen, display_id);
232 }
233 }
flutter::HostWindow::SetFullscreen
virtual void SetFullscreen(bool fullscreen, std::optional< FlutterEngineDisplayId > display_id)
Definition: host_window.cc:574
flutter::FullscreenRequest::has_display_id
bool has_display_id
Definition: window_manager.h:103
flutter::FullscreenRequest::fullscreen
bool fullscreen
Definition: window_manager.h:102
flutter::FullscreenRequest::display_id
FlutterEngineDisplayId display_id
Definition: window_manager.h:104

References flutter::FullscreenRequest::display_id, flutter::FullscreenRequest::fullscreen, flutter::HostWindow::GetThisFromHandle(), flutter::FullscreenRequest::has_display_id, and flutter::HostWindow::SetFullscreen().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_SetWindowConstraints()

void InternalFlutterWindows_WindowManager_SetWindowConstraints | ( | HWND | hwnd,
|  | const flutter::WindowConstraints * | constraints
| ) |  |

Definition at line 213 of file window_manager.cc.

215 {
216 flutter::HostWindow* window = flutter::HostWindow::GetThisFromHandle(hwnd);
217 if (window) {
218 window->SetConstraints(*constraints);
219 }
220 }
flutter::HostWindow::SetConstraints
void SetConstraints(const WindowConstraints &constraints)
Definition: host_window.cc:533

References flutter::HostWindow::GetThisFromHandle(), and flutter::HostWindow::SetConstraints().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_SetWindowSize()

void InternalFlutterWindows_WindowManager_SetWindowSize | ( | HWND | hwnd,
|  | const flutter::WindowSizeRequest * | size
| ) |  |

Definition at line 184 of file window_manager.cc.

186 {
187 flutter::HostWindow* window = flutter::HostWindow::GetThisFromHandle(hwnd);
188 if (window) {
189 window->SetContentSize(*size);
190 }
191 }
flutter::HostWindow::SetContentSize
void SetContentSize(const WindowSizeRequest &size)
Definition: host_window.cc:491

References flutter::HostWindow::GetThisFromHandle(), and flutter::HostWindow::SetContentSize().

Referenced by flutter::testing::TEST_F().

## ◆ InternalFlutterWindows_WindowManager_UpdateTooltipPosition()

FLUTTER_EXPORT void InternalFlutterWindows_WindowManager_UpdateTooltipPosition | ( | HWND | hwnd | ) |

Definition at line 245 of file window_manager.cc.

245 {
246 flutter::HostWindow* window = flutter::HostWindow::GetThisFromHandle(hwnd);
247 flutter::HostWindowTooltip* tooltip_window =
248 reinterpret_cast<flutter::HostWindowTooltip*>(window);
249 tooltip_window->UpdatePosition();
250 }
flutter::HostWindowTooltip
Definition: host_window_tooltip.h:15
flutter::HostWindowTooltip::UpdatePosition
void UpdatePosition()
Definition: host_window_tooltip.cc:85

References flutter::HostWindow::GetThisFromHandle(), and flutter::HostWindowTooltip::UpdatePosition().