| Flutter Windows Embedder |

Classes | Namespaces | Typedefs | Functions
window_manager.h File Reference
`#include <windows.h>`
`#include <functional>`
`#include <optional>`
`#include <unordered_map>`
`#include <vector>`
`#include "flutter/shell/platform/common/public/flutter_export.h"`
`#include "flutter/fml/macros.h"`
`#include "flutter/shell/platform/common/isolate_scope.h"`
`#include "flutter/shell/platform/embedder/embedder.h"`

Go to the source code of this file.

## Classes
struct | flutter::WindowSizeRequest
struct | flutter::WindowConstraints
struct | flutter::WindowRect
struct | flutter::WindowSize
struct | flutter::RegularWindowCreationRequest
struct | flutter::DialogWindowCreationRequest
struct | flutter::TooltipWindowCreationRequest
struct | flutter::WindowsMessage
struct | flutter::WindowingInitRequest
struct | flutter::ActualWindowSize
struct | flutter::FullscreenRequest
class | flutter::WindowManager

## Namespaces
| flutter

## Typedefs
typedef WindowRect *(* | flutter::GetWindowPositionCallback) (const WindowSize &child_size, const WindowRect &parent_rect, const WindowRect &output_rect)

## Functions
FLUTTER_EXPORT void | InternalFlutterWindows_WindowManager_Initialize (int64_t engine_id, const flutter::WindowingInitRequest *request)
FLUTTER_EXPORT 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)
FLUTTER_EXPORT HWND | InternalFlutterWindows_WindowManager_GetTopLevelWindowHandle (int64_t engine_id, FlutterViewId view_id)
FLUTTER_EXPORT flutter::ActualWindowSize | InternalFlutterWindows_WindowManager_GetWindowContentSize (HWND hwnd)
FLUTTER_EXPORT void | InternalFlutterWindows_WindowManager_SetWindowSize (HWND hwnd, const flutter::WindowSizeRequest *size)
FLUTTER_EXPORT void | InternalFlutterWindows_WindowManager_SetWindowConstraints (HWND hwnd, const flutter::WindowConstraints *constraints)
FLUTTER_EXPORT void | InternalFlutterWindows_WindowManager_SetFullscreen (HWND hwnd, const flutter::FullscreenRequest *request)
FLUTTER_EXPORT void | InternalFlutterWindows_WindowManager_OnDestroyWindow (HWND hwnd)
FLUTTER_EXPORT 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 148 of file window_manager.cc.

150 {
151 flutter::FlutterWindowsEngine* engine =
152 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
153 return engine->window_manager()->CreateDialogWindow(request);
154 }
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:335
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()

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

Definition at line 139 of file window_manager.cc.

141 {
142 flutter::FlutterWindowsEngine* engine =
143 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
144 return engine->window_manager()->CreateRegularWindow(request);
145 }
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 157 of file window_manager.cc.

159 {
160 flutter::FlutterWindowsEngine* engine =
161 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
162 return engine->window_manager()->CreateTooltipWindow(request);
163 }
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()

FLUTTER_EXPORT bool InternalFlutterWindows_WindowManager_GetFullscreen | ( | HWND | hwnd | ) |

Definition at line 234 of file window_manager.cc.

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

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

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

## ◆ InternalFlutterWindows_WindowManager_GetTopLevelWindowHandle()

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

Definition at line 165 of file window_manager.cc.

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

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

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

## ◆ InternalFlutterWindows_WindowManager_GetWindowContentSize()

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

Definition at line 179 of file window_manager.cc.

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

References flutter::HostWindow::GetWindowContentSize().

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

## ◆ InternalFlutterWindows_WindowManager_Initialize()

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

Definition at line 131 of file window_manager.cc.

133 {
134 flutter::FlutterWindowsEngine* engine =
135 flutter::FlutterWindowsEngine::GetEngineForId(engine_id);
136 engine->window_manager()->Initialize(request);
137 }
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()

FLUTTER_EXPORT void InternalFlutterWindows_WindowManager_OnDestroyWindow | ( | HWND | hwnd | ) |

Definition at line 192 of file window_manager.cc.

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

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

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

## ◆ InternalFlutterWindows_WindowManager_SetFullscreen()

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

Definition at line 221 of file window_manager.cc.

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

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()

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

Definition at line 212 of file window_manager.cc.

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

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

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

## ◆ InternalFlutterWindows_WindowManager_SetWindowSize()

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

Definition at line 183 of file window_manager.cc.

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

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 244 of file window_manager.cc.

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

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