| 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 }
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 271 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 |

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 } FlutterDesktopGpuPreference;
FlutterDesktopGpuPreference
FlutterDesktopGpuPreference
Definition: flutter_windows.h:39
LowPowerPreference
@ LowPowerPreference
Definition: flutter_windows.h:45
NoPreference
@ NoPreference
Definition: flutter_windows.h:41

## ◆ FlutterDesktopUIThreadPolicy

enum FlutterDesktopUIThreadPolicy

Enumerator
Default |
RunOnPlatformThread |
RunOnSeparateThread |

Definition at line 49 of file flutter_windows.h.

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

## Function Documentation

## ◆ FlutterDesktopEngineCreate()

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

Definition at line 183 of file flutter_windows.cc.

184 {
185 flutter::FlutterProjectBundle project(*engine_properties);
186 auto engine = std::make_unique<flutter::FlutterWindowsEngine>(project);
187 return HandleForEngine(engine.release());
188 }
flutter::FlutterProjectBundle
Definition: flutter_project_bundle.h:32
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 190 of file flutter_windows.cc.

190 {
191 flutter::FlutterWindowsEngine* engine = EngineFromHandle(engine_ref);
192 bool result = true;
193 if (engine->running()) {
194 result = engine->Stop();
195 }
196 delete engine;
197 return result;
198 }
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 234 of file flutter_windows.cc.

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

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 224 of file flutter_windows.cc.

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

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 239 of file flutter_windows.cc.

240 {
241 return HandleForTextureRegistrar(
242 EngineFromHandle(engine)->texture_registrar());
243 }
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 272 of file flutter_windows.cc.

278 {
279 std::optional<LRESULT> lresult =
280 EngineFromHandle(engine)->ProcessExternalWindowMessage(hwnd, message,
281 wparam, lparam);
282 if (result && lresult.has_value()) {
283 *result = lresult.value();
284 }
285 return lresult.has_value();
286 }
flutter::FlutterWindowsEngine::ProcessExternalWindowMessage
std::optional< LRESULT > ProcessExternalWindowMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: flutter_windows_engine.cc:1070
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 216 of file flutter_windows.cc.

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

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

## ◆ FlutterDesktopEngineReloadSystemFonts()

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

Definition at line 220 of file flutter_windows.cc.

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

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 206 of file flutter_windows.cc.

207 {
208 std::string_view entry_point_view{""};
209 if (entry_point != nullptr) {
210 entry_point_view = entry_point;
211 }
212
213 return EngineFromHandle(engine)->Run(entry_point_view);
214 }
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 245 of file flutter_windows.cc.

247 {
248 EngineFromHandle(engine)->SetNextFrameCallback(
249 [callback, user_data]() { callback(user_data); });
250 }
flutter::FlutterWindowsEngine::SetNextFrameCallback
void SetNextFrameCallback(fml::closure callback)
Definition: flutter_windows_engine.cc:810
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 322 of file flutter_windows.cc.

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

References flutter::GetDpiForHWND().

Referenced by InternalFlutterWindows_WindowManager_GetWindowContentSize().

## ◆ FlutterDesktopGetDpiForMonitor()

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

Definition at line 326 of file flutter_windows.cc.

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

References flutter::GetDpiForMonitor().

## ◆ FlutterDesktopPluginRegistrarGetView()

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

Definition at line 296 of file flutter_windows.cc.

297 {
298 return HandleForView(registrar->engine->view(flutter::kImplicitViewId));
299 }
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view(FlutterViewId view_id) const
Definition: flutter_windows_engine.cc:688
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 301 of file flutter_windows.cc.

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

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 307 of file flutter_windows.cc.

310 {
311 registrar->engine->window_proc_delegate_manager()
312 ->RegisterTopLevelWindowProcDelegate(delegate, user_data);
313 }
flutter::FlutterWindowsEngine::window_proc_delegate_manager
WindowProcDelegateManager * window_proc_delegate_manager()
Definition: flutter_windows_engine.h:180
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 315 of file flutter_windows.cc.

317 {
318 registrar->engine->window_proc_delegate_manager()
319 ->UnregisterTopLevelWindowProcDelegate(delegate);
320 }
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 330 of file flutter_windows.cc.

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

## ◆ FlutterDesktopViewControllerCreate()

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

Definition at line 121 of file flutter_windows.cc.

124 {
125 return CreateViewController(engine, width, height, /*owns_engine=*/true);
126 }
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 135 of file flutter_windows.cc.

135 {
136 auto controller = ViewControllerFromHandle(ref);
137 controller->Destroy();
138 delete controller;
139 }
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 159 of file flutter_windows.cc.

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

References ViewControllerFromHandle().

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

## ◆ FlutterDesktopViewControllerGetEngine()

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

Definition at line 147 of file flutter_windows.cc.

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

References HandleForEngine(), and ViewControllerFromHandle().

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

## ◆ FlutterDesktopViewControllerGetView()

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

Definition at line 153 of file flutter_windows.cc.

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

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 141 of file flutter_windows.cc.

142 {
143 auto controller = ViewControllerFromHandle(ref);
144 return static_cast<FlutterDesktopViewId>(controller->view()->view_id());
145 }
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 165 of file flutter_windows.cc.

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

References message, and ViewControllerFromHandle().

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

## ◆ FlutterDesktopViewGetGraphicsAdapter()

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

Definition at line 256 of file flutter_windows.cc.

256 {
257 auto egl_manager = ViewFromHandle(view)->GetEngine()->egl_manager();
258 if (egl_manager) {
259 Microsoft::WRL::ComPtr<ID3D11Device> d3d_device;
260 Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device;
261 if (egl_manager->GetDevice(d3d_device.GetAddressOf()) &&
262 SUCCEEDED(d3d_device.As(&dxgi_device))) {
263 IDXGIAdapter* adapter;
264 if (SUCCEEDED(dxgi_device->GetAdapter(&adapter))) {
265 return adapter;
266 }
267 }
268 }
269 return nullptr;
270 }
flutter::FlutterWindowsEngine::egl_manager
egl::Manager * egl_manager() const
Definition: flutter_windows_engine.h:178
flutter::FlutterWindowsView::GetEngine
FlutterWindowsEngine * GetEngine() const
Definition: flutter_windows_view.cc:782
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 252 of file flutter_windows.cc.

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

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

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