| Flutter Windows Embedder |

Classes | Typedefs | Enumerations | Functions
flutter_windows.h File Reference
`#include <dxgi.h>`
`#include <stddef.h>`
`#include <stdint.h>`
`#include <windows.h>`
`#include "flutter_export.h"`
`#include "flutter_messenger.h"`
`#include "flutter_plugin_registrar.h"`

Go to the source code of this file.

## Classes
struct | FlutterDesktopEngineProperties

## Typedefs
typedef void(* | VoidCallback) (void *)
typedef struct FlutterDesktopViewController * | FlutterDesktopViewControllerRef
typedef struct FlutterDesktopView * | FlutterDesktopViewRef
typedef struct FlutterDesktopEngine * | FlutterDesktopEngineRef
typedef int64_t | FlutterDesktopViewId
typedef bool(* | FlutterDesktopWindowProcCallback) (HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)

## Enumerations
enum | FlutterDesktopGpuPreference { NoPreference , LowPowerPreference , HighPerformancePreference }
enum | FlutterDesktopUIThreadPolicy { Default , RunOnPlatformThread , RunOnSeparateThread }

## Functions
FLUTTER_EXPORT FlutterDesktopViewControllerRef | FlutterDesktopViewControllerCreate (int width, int height, FlutterDesktopEngineRef engine)
FLUTTER_EXPORT void | FlutterDesktopViewControllerDestroy (FlutterDesktopViewControllerRef controller)
FLUTTER_EXPORT FlutterDesktopViewId | FlutterDesktopViewControllerGetViewId (FlutterDesktopViewControllerRef view_controller)
FLUTTER_EXPORT FlutterDesktopEngineRef | FlutterDesktopViewControllerGetEngine (FlutterDesktopViewControllerRef controller)
FLUTTER_EXPORT FlutterDesktopViewRef | FlutterDesktopViewControllerGetView (FlutterDesktopViewControllerRef controller)
FLUTTER_EXPORT void | FlutterDesktopViewControllerForceRedraw (FlutterDesktopViewControllerRef controller)
FLUTTER_EXPORT bool | FlutterDesktopViewControllerHandleTopLevelWindowProc (FlutterDesktopViewControllerRef controller, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
FLUTTER_EXPORT FlutterDesktopEngineRef | FlutterDesktopEngineCreate (const FlutterDesktopEngineProperties *engine_properties)
FLUTTER_EXPORT bool | FlutterDesktopEngineDestroy (FlutterDesktopEngineRef engine)
FLUTTER_EXPORT bool | FlutterDesktopEngineRun (FlutterDesktopEngineRef engine, const char *entry_point)
FLUTTER_EXPORT uint64_t | FlutterDesktopEngineProcessMessages (FlutterDesktopEngineRef engine)
FLUTTER_EXPORT void | FlutterDesktopEngineReloadSystemFonts (FlutterDesktopEngineRef engine)
FLUTTER_EXPORT FlutterDesktopPluginRegistrarRef | FlutterDesktopEngineGetPluginRegistrar (FlutterDesktopEngineRef engine, const char *plugin_name)
FLUTTER_EXPORT FlutterDesktopMessengerRef | FlutterDesktopEngineGetMessenger (FlutterDesktopEngineRef engine)
FLUTTER_EXPORT FlutterDesktopTextureRegistrarRef | FlutterDesktopEngineGetTextureRegistrar (FlutterDesktopEngineRef engine)
FLUTTER_EXPORT void | FlutterDesktopEngineSetNextFrameCallback (FlutterDesktopEngineRef engine, VoidCallback callback, void *user_data)
FLUTTER_EXPORT HWND | FlutterDesktopViewGetHWND (FlutterDesktopViewRef view)
FLUTTER_EXPORT IDXGIAdapter * | FlutterDesktopViewGetGraphicsAdapter (FlutterDesktopViewRef view)
FLUTTER_EXPORT bool | FlutterDesktopEngineProcessExternalWindowMessage (FlutterDesktopEngineRef engine, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
FLUTTER_EXPORT FlutterDesktopViewRef | FlutterDesktopPluginRegistrarGetView (FlutterDesktopPluginRegistrarRef registrar)
FLUTTER_EXPORT FlutterDesktopViewRef | FlutterDesktopPluginRegistrarGetViewById (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopViewId view_id)
FLUTTER_EXPORT void | FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
FLUTTER_EXPORT void | FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate)
FLUTTER_EXPORT UINT | FlutterDesktopGetDpiForHWND (HWND hwnd)
FLUTTER_EXPORT UINT | FlutterDesktopGetDpiForMonitor (HMONITOR monitor)
FLUTTER_EXPORT void | FlutterDesktopResyncOutputStreams ()

## Typedef Documentation

## ◆ FlutterDesktopEngineRef

typedef struct FlutterDesktopEngine* FlutterDesktopEngineRef

Definition at line 33 of file flutter_windows.h.

## ◆ FlutterDesktopViewControllerRef

typedef struct FlutterDesktopViewController* FlutterDesktopViewControllerRef

Definition at line 25 of file flutter_windows.h.

## ◆ FlutterDesktopViewId

typedef int64_t FlutterDesktopViewId

Definition at line 36 of file flutter_windows.h.

## ◆ FlutterDesktopViewRef

typedef struct FlutterDesktopView* FlutterDesktopViewRef

Definition at line 29 of file flutter_windows.h.

## ◆ FlutterDesktopWindowProcCallback

typedef bool(* FlutterDesktopWindowProcCallback) (HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)

Definition at line 275 of file flutter_windows.h.

## ◆ VoidCallback

typedef void(* VoidCallback) (void *)

Definition at line 21 of file flutter_windows.h.

## Enumeration Type Documentation

## ◆ FlutterDesktopGpuPreference

enum FlutterDesktopGpuPreference

Enumerator
NoPreference |
LowPowerPreference |
HighPerformancePreference |

Definition at line 39 of file flutter_windows.h.

39 {
40 // No preference.
41 NoPreference,
42 // Prefer energy efficiency over performance, such as an integrated GPU.
43 // This falls back to a high performance GPU if no low power GPU is
44 // available.
45 LowPowerPreference,
46 // Prefer performance over energy efficiency, such as a discrete GPU or
47 // dedicated GPU.
48 // This falls back to a low power GPU if no high performance GPU is available.
49 HighPerformancePreference,
50 } FlutterDesktopGpuPreference;
FlutterDesktopGpuPreference
FlutterDesktopGpuPreference
Definition: flutter_windows.h:39
LowPowerPreference
@ LowPowerPreference
Definition: flutter_windows.h:45
HighPerformancePreference
@ HighPerformancePreference
Definition: flutter_windows.h:49
NoPreference
@ NoPreference
Definition: flutter_windows.h:41

## ◆ FlutterDesktopUIThreadPolicy

enum FlutterDesktopUIThreadPolicy

Enumerator
Default |
RunOnPlatformThread |
RunOnSeparateThread |

Definition at line 53 of file flutter_windows.h.

53 {
54 // Default value. Currently will run the UI isolate on separate thread,
55 // later will be changed to running the UI isolate on platform thread.
56 Default,
57 // Run the UI isolate on platform thread.
58 RunOnPlatformThread,
59 // Run the UI isolate on a separate thread.
60 RunOnSeparateThread,
61 } FlutterDesktopUIThreadPolicy;
FlutterDesktopUIThreadPolicy
FlutterDesktopUIThreadPolicy
Definition: flutter_windows.h:53
RunOnPlatformThread
@ RunOnPlatformThread
Definition: flutter_windows.h:58
RunOnSeparateThread
@ RunOnSeparateThread
Definition: flutter_windows.h:60
Default
@ Default
Definition: flutter_windows.h:56

## Function Documentation

## ◆ FlutterDesktopEngineCreate()

FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopEngineCreate | ( | const FlutterDesktopEngineProperties * | engine_properties | ) |

Definition at line 184 of file flutter_windows.cc.

185 {
186 flutter::FlutterProjectBundle project(*engine_properties);
187 auto engine = std::make_unique<flutter::FlutterWindowsEngine>(project);
188 return HandleForEngine(engine.release());
189 }
flutter::FlutterProjectBundle
Definition: flutter_project_bundle.h:33
HandleForEngine
static FlutterDesktopEngineRef HandleForEngine(flutter::FlutterWindowsEngine *engine)
Definition: flutter_windows.cc:38

References HandleForEngine().

Referenced by flutter::FlutterEngine::FlutterEngine(), and flutter::testing::TEST().

## ◆ FlutterDesktopEngineDestroy()

FLUTTER_EXPORT bool FlutterDesktopEngineDestroy | ( | FlutterDesktopEngineRef | engine | ) |

Definition at line 191 of file flutter_windows.cc.

191 {
192 flutter::FlutterWindowsEngine* engine = EngineFromHandle(engine_ref);
193 bool result = true;
194 if (engine->running()) {
195 result = engine->Stop();
196 }
197 delete engine;
198 return result;
199 }
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:92
flutter::FlutterWindowsEngine::running
virtual bool running() const
Definition: flutter_windows_engine.h:125
flutter::FlutterWindowsEngine::Stop
virtual bool Stop()
Definition: flutter_windows_engine.cc:512
EngineFromHandle
static flutter::FlutterWindowsEngine * EngineFromHandle(FlutterDesktopEngineRef ref)
Definition: flutter_windows.cc:32

References EngineFromHandle(), flutter::FlutterWindowsEngine::running(), and flutter::FlutterWindowsEngine::Stop().

Referenced by flutter::FlutterEngine::ShutDown(), and flutter::testing::TEST().

## ◆ FlutterDesktopEngineGetMessenger()

FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger | ( | FlutterDesktopEngineRef | engine | ) |

Definition at line 235 of file flutter_windows.cc.

236 {
237 return EngineFromHandle(engine)->messenger();
238 }
flutter::FlutterWindowsEngine::messenger
FlutterDesktopMessengerRef messenger()
Definition: flutter_windows_engine.h:160

References EngineFromHandle(), and flutter::FlutterWindowsEngine::messenger().

Referenced by flutter::FlutterEngine::FlutterEngine().

## ◆ FlutterDesktopEngineGetPluginRegistrar()

FLUTTER_EXPORT FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar | ( | FlutterDesktopEngineRef | engine,
|  | const char * | plugin_name
| ) |  |

Definition at line 225 of file flutter_windows.cc.

227 {
228 // Currently, one registrar acts as the registrar for all plugins, so the
229 // name is ignored. It is part of the API to reduce churn in the future when
230 // aligning more closely with the Flutter registrar system.
231
232 return EngineFromHandle(engine)->GetRegistrar();
233 }
flutter::FlutterWindowsEngine::GetRegistrar
FlutterDesktopPluginRegistrarRef GetRegistrar()
Definition: flutter_windows_engine.cc:704

References EngineFromHandle(), and flutter::FlutterWindowsEngine::GetRegistrar().

Referenced by flutter::FlutterEngine::GetRegistrarForPlugin(), and flutter::testing::TEST_F().

## ◆ FlutterDesktopEngineGetTextureRegistrar()

FLUTTER_EXPORT FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar | ( | FlutterDesktopEngineRef | engine | ) |

Definition at line 240 of file flutter_windows.cc.

241 {
242 return HandleForTextureRegistrar(
243 EngineFromHandle(engine)->texture_registrar());
244 }
HandleForTextureRegistrar
static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar(flutter::FlutterWindowsTextureRegistrar *registrar)
Definition: flutter_windows.cc:70

References EngineFromHandle(), and HandleForTextureRegistrar().

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

## ◆ FlutterDesktopEngineProcessExternalWindowMessage()

FLUTTER_EXPORT bool FlutterDesktopEngineProcessExternalWindowMessage | ( | FlutterDesktopEngineRef | engine,
|  | HWND | hwnd,
|  | UINT | message,
|  | WPARAM | wparam,
|  | LPARAM | lparam,
|  | LRESULT * | result
| ) |  |

Definition at line 273 of file flutter_windows.cc.

279 {
280 std::optional<LRESULT> lresult =
281 EngineFromHandle(engine)->ProcessExternalWindowMessage(hwnd, message,
282 wparam, lparam);
283 if (result && lresult.has_value()) {
284 *result = lresult.value();
285 }
286 return lresult.has_value();
287 }
flutter::FlutterWindowsEngine::ProcessExternalWindowMessage
std::optional< LRESULT > ProcessExternalWindowMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: flutter_windows_engine.cc:1074
message
Win32Message message
Definition: keyboard_unittests.cc:137

References EngineFromHandle(), message, and flutter::FlutterWindowsEngine::ProcessExternalWindowMessage().

Referenced by flutter::FlutterEngine::ProcessExternalWindowMessage().

## ◆ FlutterDesktopEngineProcessMessages()

FLUTTER_EXPORT uint64_t FlutterDesktopEngineProcessMessages | ( | FlutterDesktopEngineRef | engine | ) |

Definition at line 217 of file flutter_windows.cc.

217 {
218 return std::chrono::nanoseconds::max().count();
219 }

Referenced by flutter::FlutterEngine::ProcessMessages().

## ◆ FlutterDesktopEngineReloadSystemFonts()

FLUTTER_EXPORT void FlutterDesktopEngineReloadSystemFonts | ( | FlutterDesktopEngineRef | engine | ) |

Definition at line 221 of file flutter_windows.cc.

221 {
222 EngineFromHandle(engine)->ReloadSystemFonts();
223 }
flutter::FlutterWindowsEngine::ReloadSystemFonts
void ReloadSystemFonts()
Definition: flutter_windows_engine.cc:806

References EngineFromHandle(), and flutter::FlutterWindowsEngine::ReloadSystemFonts().

Referenced by flutter::FlutterEngine::ReloadSystemFonts().

## ◆ FlutterDesktopEngineRun()

FLUTTER_EXPORT bool FlutterDesktopEngineRun | ( | FlutterDesktopEngineRef | engine,
|  | const char * | entry_point
| ) |  |

Definition at line 207 of file flutter_windows.cc.

208 {
209 std::string_view entry_point_view{""};
210 if (entry_point != nullptr) {
211 entry_point_view = entry_point;
212 }
213
214 return EngineFromHandle(engine)->Run(entry_point_view);
215 }
flutter::FlutterWindowsEngine::Run
bool Run()
Definition: flutter_windows_engine.cc:268

References EngineFromHandle(), and flutter::FlutterWindowsEngine::Run().

Referenced by flutter::FlutterEngine::Run(), and flutter::testing::TEST_F().

## ◆ FlutterDesktopEngineSetNextFrameCallback()

FLUTTER_EXPORT void FlutterDesktopEngineSetNextFrameCallback | ( | FlutterDesktopEngineRef | engine,
|  | VoidCallback | callback,
|  | void * | user_data
| ) |  |

Definition at line 246 of file flutter_windows.cc.

248 {
249 EngineFromHandle(engine)->SetNextFrameCallback(
250 [callback, user_data]() { callback(user_data); });
251 }
flutter::FlutterWindowsEngine::SetNextFrameCallback
void SetNextFrameCallback(fml::closure callback)
Definition: flutter_windows_engine.cc:814
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:53
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:52

References callback, EngineFromHandle(), flutter::FlutterWindowsEngine::SetNextFrameCallback(), and user_data.

Referenced by flutter::FlutterEngine::SetNextFrameCallback(), and flutter::testing::TEST_F().

## ◆ FlutterDesktopGetDpiForHWND()

FLUTTER_EXPORT UINT FlutterDesktopGetDpiForHWND | ( | HWND | hwnd | ) |

Definition at line 323 of file flutter_windows.cc.

323 {
324 return flutter::GetDpiForHWND(hwnd);
325 }
flutter::GetDpiForHWND
UINT GetDpiForHWND(HWND hwnd)
Definition: dpi_utils.cc:128

References flutter::GetDpiForHWND().

Referenced by flutter::HostWindow::GetWindowContentSize().

## ◆ FlutterDesktopGetDpiForMonitor()

FLUTTER_EXPORT UINT FlutterDesktopGetDpiForMonitor | ( | HMONITOR | monitor | ) |

Definition at line 327 of file flutter_windows.cc.

327 {
328 return flutter::GetDpiForMonitor(monitor);
329 }
flutter::GetDpiForMonitor
UINT GetDpiForMonitor(HMONITOR monitor)
Definition: dpi_utils.cc:132

References flutter::GetDpiForMonitor().

## ◆ FlutterDesktopPluginRegistrarGetView()

FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView | ( | FlutterDesktopPluginRegistrarRef | registrar | ) |

Definition at line 297 of file flutter_windows.cc.

298 {
299 return HandleForView(registrar->engine->view(flutter::kImplicitViewId));
300 }
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view(FlutterViewId view_id) const
Definition: flutter_windows_engine.cc:692
HandleForView
static FlutterDesktopViewRef HandleForView(flutter::FlutterWindowsView *view)
Definition: flutter_windows.cc:59
flutter::kImplicitViewId
constexpr FlutterViewId kImplicitViewId
Definition: flutter_windows_engine.h:56
FlutterDesktopPluginRegistrar::engine
flutter::FlutterWindowsEngine * engine
Definition: window_state.h:25

References FlutterDesktopPluginRegistrar::engine, HandleForView(), flutter::kImplicitViewId, and flutter::FlutterWindowsEngine::view().

Referenced by flutter::PluginRegistrarWindows::PluginRegistrarWindows(), and flutter::testing::TEST_F().

## ◆ FlutterDesktopPluginRegistrarGetViewById()

FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById | ( | FlutterDesktopPluginRegistrarRef | registrar,
|  | FlutterDesktopViewId | view_id
| ) |  |

Definition at line 302 of file flutter_windows.cc.

304 {
305 return HandleForView(registrar->engine->view(view_id));
306 }

References FlutterDesktopPluginRegistrar::engine, HandleForView(), and flutter::FlutterWindowsEngine::view().

Referenced by flutter::PluginRegistrarWindows::GetViewById(), and flutter::testing::TEST_F().

## ◆ FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate()

FLUTTER_EXPORT void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate | ( | FlutterDesktopPluginRegistrarRef | registrar,
|  | FlutterDesktopWindowProcCallback | delegate,
|  | void * | user_data
| ) |  |

Definition at line 308 of file flutter_windows.cc.

311 {
312 registrar->engine->window_proc_delegate_manager()
313 ->RegisterTopLevelWindowProcDelegate(delegate, user_data);
314 }
flutter::FlutterWindowsEngine::window_proc_delegate_manager
WindowProcDelegateManager * window_proc_delegate_manager()
Definition: flutter_windows_engine.h:185
flutter::WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback, void *user_data)
Definition: window_proc_delegate_manager.cc:16

References FlutterDesktopPluginRegistrar::engine, flutter::WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate(), user_data, and flutter::FlutterWindowsEngine::window_proc_delegate_manager().

Referenced by flutter::PluginRegistrarWindows::RegisterTopLevelWindowProcDelegate().

## ◆ FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate()

FLUTTER_EXPORT void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate | ( | FlutterDesktopPluginRegistrarRef | registrar,
|  | FlutterDesktopWindowProcCallback | delegate
| ) |  |

Definition at line 316 of file flutter_windows.cc.

318 {
319 registrar->engine->window_proc_delegate_manager()
320 ->UnregisterTopLevelWindowProcDelegate(delegate);
321 }
flutter::WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback)
Definition: window_proc_delegate_manager.cc:27

References FlutterDesktopPluginRegistrar::engine, flutter::WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate(), and flutter::FlutterWindowsEngine::window_proc_delegate_manager().

Referenced by flutter::PluginRegistrarWindows::UnregisterTopLevelWindowProcDelegate().

## ◆ FlutterDesktopResyncOutputStreams()

FLUTTER_EXPORT void FlutterDesktopResyncOutputStreams | ( |  | ) |

Definition at line 331 of file flutter_windows.cc.

331 {
332 FILE* unused;
333 if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
334 _dup2(_fileno(stdout), 1);
335 }
336 if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
337 _dup2(_fileno(stdout), 2);
338 }
339 std::ios::sync_with_stdio();
340 }

## ◆ FlutterDesktopViewControllerCreate()

FLUTTER_EXPORT FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate | ( | int | width,
|  | int | height,
|  | FlutterDesktopEngineRef | engine
| ) |  |

Definition at line 122 of file flutter_windows.cc.

125 {
126 return CreateViewController(engine, width, height, /*owns_engine=*/true);
127 }
CreateViewController
static FlutterDesktopViewControllerRef CreateViewController(FlutterDesktopEngineRef engine_ref, int width, int height, bool owns_engine)
Definition: flutter_windows.cc:79

References CreateViewController().

Referenced by flutter::FlutterViewController::FlutterViewController(), and flutter::testing::TEST_F().

## ◆ FlutterDesktopViewControllerDestroy()

FLUTTER_EXPORT void FlutterDesktopViewControllerDestroy | ( | FlutterDesktopViewControllerRef | controller | ) |

Definition at line 136 of file flutter_windows.cc.

136 {
137 auto controller = ViewControllerFromHandle(ref);
138 controller->Destroy();
139 delete controller;
140 }
ViewControllerFromHandle
static flutter::FlutterWindowsViewController * ViewControllerFromHandle(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:43

References ViewControllerFromHandle().

Referenced by flutter::FlutterViewController::~FlutterViewController().

## ◆ FlutterDesktopViewControllerForceRedraw()

FLUTTER_EXPORT void FlutterDesktopViewControllerForceRedraw | ( | FlutterDesktopViewControllerRef | controller | ) |

Definition at line 160 of file flutter_windows.cc.

161 {
162 auto controller = ViewControllerFromHandle(ref);
163 controller->view()->ForceRedraw();
164 }

References ViewControllerFromHandle().

Referenced by flutter::FlutterViewController::ForceRedraw().

## ◆ FlutterDesktopViewControllerGetEngine()

FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine | ( | FlutterDesktopViewControllerRef | controller | ) |

Definition at line 148 of file flutter_windows.cc.

149 {
150 auto controller = ViewControllerFromHandle(ref);
151 return HandleForEngine(controller->engine());
152 }

References HandleForEngine(), and ViewControllerFromHandle().

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

## ◆ FlutterDesktopViewControllerGetView()

FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopViewControllerGetView | ( | FlutterDesktopViewControllerRef | controller | ) |

Definition at line 154 of file flutter_windows.cc.

155 {
156 auto controller = ViewControllerFromHandle(ref);
157 return HandleForView(controller->view());
158 }

References HandleForView(), and ViewControllerFromHandle().

Referenced by flutter::FlutterViewController::FlutterViewController(), and flutter::testing::TEST_F().

## ◆ FlutterDesktopViewControllerGetViewId()

FLUTTER_EXPORT FlutterDesktopViewId FlutterDesktopViewControllerGetViewId | ( | FlutterDesktopViewControllerRef | view_controller | ) |

Definition at line 142 of file flutter_windows.cc.

143 {
144 auto controller = ViewControllerFromHandle(ref);
145 return static_cast<FlutterDesktopViewId>(controller->view()->view_id());
146 }
FlutterDesktopViewId
int64_t FlutterDesktopViewId
Definition: flutter_windows.h:36

References ViewControllerFromHandle().

Referenced by flutter::testing::TEST_F(), and flutter::FlutterViewController::view_id().

## ◆ FlutterDesktopViewControllerHandleTopLevelWindowProc()

FLUTTER_EXPORT bool FlutterDesktopViewControllerHandleTopLevelWindowProc | ( | FlutterDesktopViewControllerRef | controller,
|  | HWND | hwnd,
|  | UINT | message,
|  | WPARAM | wparam,
|  | LPARAM | lparam,
|  | LRESULT * | result
| ) |  |

Definition at line 166 of file flutter_windows.cc.

172 {
173 auto controller = ViewControllerFromHandle(ref);
174 std::optional<LRESULT> delegate_result =
175 controller->engine()
176 ->window_proc_delegate_manager()
177 ->OnTopLevelWindowProc(hwnd, message, wparam, lparam);
178 if (delegate_result) {
179 *result = *delegate_result;
180 }
181 return delegate_result.has_value();
182 }

References message, and ViewControllerFromHandle().

Referenced by flutter::FlutterViewController::HandleTopLevelWindowProc().

## ◆ FlutterDesktopViewGetGraphicsAdapter()

FLUTTER_EXPORT IDXGIAdapter* FlutterDesktopViewGetGraphicsAdapter | ( | FlutterDesktopViewRef | view | ) |

Definition at line 257 of file flutter_windows.cc.

257 {
258 auto egl_manager = ViewFromHandle(view)->GetEngine()->egl_manager();
259 if (egl_manager) {
260 Microsoft::WRL::ComPtr<ID3D11Device> d3d_device;
261 Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device;
262 if (egl_manager->GetDevice(d3d_device.GetAddressOf()) &&
263 SUCCEEDED(d3d_device.As(&dxgi_device))) {
264 IDXGIAdapter* adapter;
265 if (SUCCEEDED(dxgi_device->GetAdapter(&adapter))) {
266 return adapter;
267 }
268 }
269 }
270 return nullptr;
271 }
flutter::FlutterWindowsEngine::egl_manager
egl::Manager * egl_manager() const
Definition: flutter_windows_engine.h:183
flutter::FlutterWindowsView::GetEngine
FlutterWindowsEngine * GetEngine() const
Definition: flutter_windows_view.cc:826
ViewFromHandle
static flutter::FlutterWindowsView * ViewFromHandle(FlutterDesktopViewRef ref)
Definition: flutter_windows.cc:54

References flutter::FlutterWindowsEngine::egl_manager(), flutter::FlutterWindowsView::GetEngine(), and ViewFromHandle().

Referenced by flutter::FlutterView::GetGraphicsAdapter(), and flutter::testing::TEST_F().

## ◆ FlutterDesktopViewGetHWND()

FLUTTER_EXPORT HWND FlutterDesktopViewGetHWND | ( | FlutterDesktopViewRef | view | ) |

Definition at line 253 of file flutter_windows.cc.

253 {
254 return ViewFromHandle(view)->GetWindowHandle();
255 }
flutter::FlutterWindowsView::GetWindowHandle
virtual HWND GetWindowHandle() const
Definition: flutter_windows_view.cc:822

References flutter::FlutterWindowsView::GetWindowHandle(), and ViewFromHandle().

Referenced by flutter::FlutterView::GetNativeWindow(), and flutter::testing::TEST_F().