Flutter Engine
The Flutter Engine
Functions
flutter_windows.cc File Reference
#include "flutter/shell/platform/windows/public/flutter_windows.h"
#include <io.h>
#include <algorithm>
#include <chrono>
#include <cstdlib>
#include <filesystem>
#include <memory>
#include <vector>
#include "flutter/shell/platform/common/client_wrapper/include/flutter/plugin_registrar.h"
#include "flutter/shell/platform/common/incoming_message_dispatcher.h"
#include "flutter/shell/platform/common/path_utils.h"
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/windows/dpi_utils.h"
#include "flutter/shell/platform/windows/flutter_project_bundle.h"
#include "flutter/shell/platform/windows/flutter_window.h"
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
#include "flutter/shell/platform/windows/flutter_windows_view.h"
#include "flutter/shell/platform/windows/flutter_windows_view_controller.h"
#include "flutter/shell/platform/windows/window_binding_handler.h"
#include "flutter/shell/platform/windows/window_state.h"

Go to the source code of this file.

Functions

static flutter::FlutterWindowsEngineEngineFromHandle (FlutterDesktopEngineRef ref)
 
static FlutterDesktopEngineRef HandleForEngine (flutter::FlutterWindowsEngine *engine)
 
static flutter::FlutterWindowsViewControllerViewControllerFromHandle (FlutterDesktopViewControllerRef ref)
 
static FlutterDesktopViewControllerRef HandleForViewController (flutter::FlutterWindowsViewController *view_controller)
 
static flutter::FlutterWindowsViewViewFromHandle (FlutterDesktopViewRef ref)
 
static FlutterDesktopViewRef HandleForView (flutter::FlutterWindowsView *view)
 
static flutter::FlutterWindowsTextureRegistrarTextureRegistrarFromHandle (FlutterDesktopTextureRegistrarRef ref)
 
static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar (flutter::FlutterWindowsTextureRegistrar *registrar)
 
static FlutterDesktopViewControllerRef CreateViewController (FlutterDesktopEngineRef engine_ref, int width, int height, bool owns_engine)
 
FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate (int width, int height, FlutterDesktopEngineRef engine)
 
FlutterDesktopViewControllerRef FlutterDesktopEngineCreateViewController (FlutterDesktopEngineRef engine, const FlutterDesktopViewControllerProperties *properties)
 
void FlutterDesktopViewControllerDestroy (FlutterDesktopViewControllerRef ref)
 
FlutterDesktopViewId FlutterDesktopViewControllerGetViewId (FlutterDesktopViewControllerRef ref)
 
FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine (FlutterDesktopViewControllerRef ref)
 
FlutterDesktopViewRef FlutterDesktopViewControllerGetView (FlutterDesktopViewControllerRef ref)
 
void FlutterDesktopViewControllerForceRedraw (FlutterDesktopViewControllerRef ref)
 
bool FlutterDesktopViewControllerHandleTopLevelWindowProc (FlutterDesktopViewControllerRef ref, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
 
FlutterDesktopEngineRef FlutterDesktopEngineCreate (const FlutterDesktopEngineProperties *engine_properties)
 
bool FlutterDesktopEngineDestroy (FlutterDesktopEngineRef engine_ref)
 
bool FlutterDesktopEngineRun (FlutterDesktopEngineRef engine, const char *entry_point)
 
uint64_t FlutterDesktopEngineProcessMessages (FlutterDesktopEngineRef engine)
 
void FlutterDesktopEngineReloadSystemFonts (FlutterDesktopEngineRef engine)
 
FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar (FlutterDesktopEngineRef engine, const char *plugin_name)
 
FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger (FlutterDesktopEngineRef engine)
 
FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar (FlutterDesktopEngineRef engine)
 
void FlutterDesktopEngineSetNextFrameCallback (FlutterDesktopEngineRef engine, VoidCallback callback, void *user_data)
 
HWND FlutterDesktopViewGetHWND (FlutterDesktopViewRef view)
 
IDXGIAdapter * FlutterDesktopViewGetGraphicsAdapter (FlutterDesktopViewRef view)
 
bool FlutterDesktopEngineProcessExternalWindowMessage (FlutterDesktopEngineRef engine, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
 
void FlutterDesktopEngineRegisterPlatformViewType (FlutterDesktopEngineRef engine, const char *view_type_name, FlutterPlatformViewTypeEntry view_type)
 
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView (FlutterDesktopPluginRegistrarRef registrar)
 
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopViewId view_id)
 
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
 
void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate)
 
UINT FlutterDesktopGetDpiForHWND (HWND hwnd)
 
UINT FlutterDesktopGetDpiForMonitor (HMONITOR monitor)
 
void FlutterDesktopResyncOutputStreams ()
 
FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger (FlutterDesktopPluginRegistrarRef registrar)
 
void FlutterDesktopPluginRegistrarSetDestructionHandler (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopOnPluginRegistrarDestroyed callback)
 
bool FlutterDesktopMessengerSendWithReply (FlutterDesktopMessengerRef messenger, const char *channel, const uint8_t *message, const size_t message_size, const FlutterDesktopBinaryReply reply, void *user_data)
 
bool FlutterDesktopMessengerSend (FlutterDesktopMessengerRef messenger, const char *channel, const uint8_t *message, const size_t message_size)
 
void FlutterDesktopMessengerSendResponse (FlutterDesktopMessengerRef messenger, const FlutterDesktopMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
 
void FlutterDesktopMessengerSetCallback (FlutterDesktopMessengerRef messenger, const char *channel, FlutterDesktopMessageCallback callback, void *user_data)
 
FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef (FlutterDesktopMessengerRef messenger)
 
void FlutterDesktopMessengerRelease (FlutterDesktopMessengerRef messenger)
 
bool FlutterDesktopMessengerIsAvailable (FlutterDesktopMessengerRef messenger)
 
FlutterDesktopMessengerRef FlutterDesktopMessengerLock (FlutterDesktopMessengerRef messenger)
 
void FlutterDesktopMessengerUnlock (FlutterDesktopMessengerRef messenger)
 
FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar (FlutterDesktopPluginRegistrarRef registrar)
 
int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture (FlutterDesktopTextureRegistrarRef texture_registrar, const FlutterDesktopTextureInfo *texture_info)
 
void FlutterDesktopTextureRegistrarUnregisterExternalTexture (FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id, void(*callback)(void *user_data), void *user_data)
 
bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable (FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id)
 

Function Documentation

◆ CreateViewController()

static FlutterDesktopViewControllerRef CreateViewController ( FlutterDesktopEngineRef  engine_ref,
int  width,
int  height,
bool  owns_engine 
)
static

Definition at line 79 of file flutter_windows.cc.

83 {
84 flutter::FlutterWindowsEngine* engine_ptr = EngineFromHandle(engine_ref);
85 std::unique_ptr<flutter::WindowBindingHandler> window_wrapper =
86 std::make_unique<flutter::FlutterWindow>(
87 width, height, engine_ptr->windows_proc_table());
88
89 std::unique_ptr<flutter::FlutterWindowsEngine> engine;
90 if (owns_engine) {
91 engine = std::unique_ptr<flutter::FlutterWindowsEngine>(engine_ptr);
92 }
93
94 std::unique_ptr<flutter::FlutterWindowsView> view =
95 engine_ptr->CreateView(std::move(window_wrapper));
96 if (!view) {
97 return nullptr;
98 }
99
100 auto controller = std::make_unique<flutter::FlutterWindowsViewController>(
101 std::move(engine), std::move(view));
102
103 // Launch the engine if it is not running already.
104 if (!controller->engine()->running()) {
105 if (!controller->engine()->Run()) {
106 return nullptr;
107 }
108 }
109
110 // Must happen after engine is running.
111 controller->view()->SendInitialBounds();
112
113 // The Windows embedder listens to accessibility updates using the
114 // view's HWND. The embedder's accessibility features may be stale if
115 // the app was in headless mode.
116 controller->engine()->UpdateAccessibilityFeatures();
117
118 return HandleForViewController(controller.release());
119}
std::shared_ptr< WindowsProcTable > windows_proc_table()
std::unique_ptr< FlutterWindowsView > CreateView(std::unique_ptr< WindowBindingHandler > window)
FlutterEngine engine
Definition: main.cc:68
static flutter::FlutterWindowsEngine * EngineFromHandle(FlutterDesktopEngineRef ref)
static FlutterDesktopViewControllerRef HandleForViewController(flutter::FlutterWindowsViewController *view_controller)
int32_t height
int32_t width

◆ EngineFromHandle()

static flutter::FlutterWindowsEngine * EngineFromHandle ( FlutterDesktopEngineRef  ref)
static

Definition at line 32 of file flutter_windows.cc.

33 {
34 return reinterpret_cast<flutter::FlutterWindowsEngine*>(ref);
35}

◆ FlutterDesktopEngineCreate()

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}
static FlutterDesktopEngineRef HandleForEngine(flutter::FlutterWindowsEngine *engine)

◆ FlutterDesktopEngineCreateViewController()

FlutterDesktopViewControllerRef FlutterDesktopEngineCreateViewController ( FlutterDesktopEngineRef  engine,
const FlutterDesktopViewControllerProperties properties 
)

Definition at line 128 of file flutter_windows.cc.

130 {
131 return CreateViewController(engine, properties->width, properties->height,
132 /*owns_engine=*/false);
133}
static FlutterDesktopViewControllerRef CreateViewController(FlutterDesktopEngineRef engine_ref, int width, int height, bool owns_engine)

◆ FlutterDesktopEngineDestroy()

bool FlutterDesktopEngineDestroy ( FlutterDesktopEngineRef  engine_ref)

Definition at line 190 of file flutter_windows.cc.

190 {
192 bool result = true;
193 if (engine->running()) {
194 result = engine->Stop();
195 }
196 delete engine;
197 return result;
198}
GAsyncResult * result

◆ FlutterDesktopEngineGetMessenger()

FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger ( FlutterDesktopEngineRef  engine)

Definition at line 228 of file flutter_windows.cc.

229 {
231}
FlutterDesktopMessengerRef messenger()

◆ FlutterDesktopEngineGetPluginRegistrar()

FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar ( FlutterDesktopEngineRef  engine,
const char *  plugin_name 
)

Definition at line 218 of file flutter_windows.cc.

220 {
221 // Currently, one registrar acts as the registrar for all plugins, so the
222 // name is ignored. It is part of the API to reduce churn in the future when
223 // aligning more closely with the Flutter registrar system.
224
226}
FlutterDesktopPluginRegistrarRef GetRegistrar()

◆ FlutterDesktopEngineGetTextureRegistrar()

FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar ( FlutterDesktopEngineRef  engine)

Definition at line 233 of file flutter_windows.cc.

234 {
237}
static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar(flutter::FlutterWindowsTextureRegistrar *registrar)
G_BEGIN_DECLS FlTextureRegistrar * texture_registrar

◆ FlutterDesktopEngineProcessExternalWindowMessage()

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

Definition at line 266 of file flutter_windows.cc.

272 {
273 std::optional<LRESULT> lresult =
275 wparam, lparam);
276 if (result && lresult.has_value()) {
277 *result = lresult.value();
278 }
279 return lresult.has_value();
280}
std::optional< LRESULT > ProcessExternalWindowMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Win32Message message

◆ FlutterDesktopEngineProcessMessages()

uint64_t FlutterDesktopEngineProcessMessages ( FlutterDesktopEngineRef  engine)

Definition at line 210 of file flutter_windows.cc.

210 {
211 return std::chrono::nanoseconds::max().count();
212}
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ FlutterDesktopEngineRegisterPlatformViewType()

void FlutterDesktopEngineRegisterPlatformViewType ( FlutterDesktopEngineRef  engine,
const char *  view_type_name,
FlutterPlatformViewTypeEntry  view_type 
)

Definition at line 282 of file flutter_windows.cc.

285 {
286 // TODO(schectman): forward to platform view manager.
287 // https://github.com/flutter/flutter/issues/143375
288}

◆ FlutterDesktopEngineReloadSystemFonts()

void FlutterDesktopEngineReloadSystemFonts ( FlutterDesktopEngineRef  engine)

◆ FlutterDesktopEngineRun()

bool FlutterDesktopEngineRun ( FlutterDesktopEngineRef  engine,
const char *  entry_point 
)

Definition at line 200 of file flutter_windows.cc.

201 {
202 std::string_view entry_point_view{""};
203 if (entry_point != nullptr) {
204 entry_point_view = entry_point;
205 }
206
207 return EngineFromHandle(engine)->Run(entry_point_view);
208}

◆ FlutterDesktopEngineSetNextFrameCallback()

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

Definition at line 239 of file flutter_windows.cc.

241 {
244}
void SetNextFrameCallback(fml::closure callback)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
void * user_data

◆ FlutterDesktopGetDpiForHWND()

UINT FlutterDesktopGetDpiForHWND ( HWND  hwnd)

Definition at line 316 of file flutter_windows.cc.

316 {
317 return flutter::GetDpiForHWND(hwnd);
318}
UINT GetDpiForHWND(HWND hwnd)
Definition: dpi_utils.cc:130

◆ FlutterDesktopGetDpiForMonitor()

UINT FlutterDesktopGetDpiForMonitor ( HMONITOR  monitor)

Definition at line 320 of file flutter_windows.cc.

320 {
321 return flutter::GetDpiForMonitor(monitor);
322}
UINT GetDpiForMonitor(HMONITOR monitor)
Definition: dpi_utils.cc:134

◆ FlutterDesktopMessengerAddRef()

FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef ( FlutterDesktopMessengerRef  messenger)

Definition at line 396 of file flutter_windows.cc.

397 {
399 ->AddRef()
400 ->ToRef();
401}
FlutterDesktopMessengerRef ToRef()
Convert to FlutterDesktopMessengerRef.
static FlutterDesktopMessenger * FromRef(FlutterDesktopMessengerRef ref)
Convert from FlutterDesktopMessengerRef.

◆ FlutterDesktopMessengerIsAvailable()

bool FlutterDesktopMessengerIsAvailable ( FlutterDesktopMessengerRef  messenger)

Definition at line 407 of file flutter_windows.cc.

407 {
409 nullptr;
410}
flutter::FlutterWindowsEngine * GetEngine() const
Getter for the engine field.

◆ FlutterDesktopMessengerLock()

FlutterDesktopMessengerRef FlutterDesktopMessengerLock ( FlutterDesktopMessengerRef  messenger)

Definition at line 412 of file flutter_windows.cc.

413 {
415 return messenger;
416}

◆ FlutterDesktopMessengerRelease()

void FlutterDesktopMessengerRelease ( FlutterDesktopMessengerRef  messenger)

◆ FlutterDesktopMessengerSend()

bool FlutterDesktopMessengerSend ( FlutterDesktopMessengerRef  messenger,
const char *  channel,
const uint8_t *  message,
const size_t  message_size 
)

Definition at line 362 of file flutter_windows.cc.

365 {
366 return FlutterDesktopMessengerSendWithReply(messenger, channel, message,
367 message_size, nullptr, nullptr);
368}
bool FlutterDesktopMessengerSendWithReply(FlutterDesktopMessengerRef messenger, const char *channel, const uint8_t *message, const size_t message_size, const FlutterDesktopBinaryReply reply, void *user_data)

◆ FlutterDesktopMessengerSendResponse()

void FlutterDesktopMessengerSendResponse ( FlutterDesktopMessengerRef  messenger,
const FlutterDesktopMessageResponseHandle handle,
const uint8_t *  data,
size_t  data_length 
)

Definition at line 370 of file flutter_windows.cc.

374 {
376 << "Messenger must reference a running engine to send a response";
377
379 ->GetEngine()
380 ->SendPlatformMessageResponse(handle, data, data_length);
381}
void SendPlatformMessageResponse(const FlutterDesktopMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger)
#define FML_DCHECK(condition)
Definition: logging.h:103
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ FlutterDesktopMessengerSendWithReply()

bool FlutterDesktopMessengerSendWithReply ( FlutterDesktopMessengerRef  messenger,
const char *  channel,
const uint8_t *  message,
const size_t  message_size,
const FlutterDesktopBinaryReply  reply,
void *  user_data 
)

Definition at line 348 of file flutter_windows.cc.

353 {
355 << "Messenger must reference a running engine to send a message";
356
358 ->GetEngine()
359 ->SendPlatformMessage(channel, message, message_size, reply, user_data);
360}
bool SendPlatformMessage(const char *channel, const uint8_t *message, const size_t message_size, const FlutterDesktopBinaryReply reply, void *user_data)

◆ FlutterDesktopMessengerSetCallback()

void FlutterDesktopMessengerSetCallback ( FlutterDesktopMessengerRef  messenger,
const char *  channel,
FlutterDesktopMessageCallback  callback,
void *  user_data 
)

Definition at line 383 of file flutter_windows.cc.

386 {
388 << "Messenger must reference a running engine to set a callback";
389
391 ->GetEngine()
394}
IncomingMessageDispatcher * message_dispatcher()
void SetMessageCallback(const std::string &channel, FlutterDesktopMessageCallback callback, void *user_data)

◆ FlutterDesktopMessengerUnlock()

void FlutterDesktopMessengerUnlock ( FlutterDesktopMessengerRef  messenger)

Definition at line 418 of file flutter_windows.cc.

418 {
420}

◆ FlutterDesktopPluginRegistrarGetMessenger()

FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger ( FlutterDesktopPluginRegistrarRef  registrar)

Definition at line 337 of file flutter_windows.cc.

338 {
339 return registrar->engine->messenger();
340}
FlutterDesktopMessengerReferenceOwner messenger
FlutterDesktopEngineState * engine

◆ FlutterDesktopPluginRegistrarGetView()

FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView ( FlutterDesktopPluginRegistrarRef  registrar)

Definition at line 290 of file flutter_windows.cc.

291 {
292 return HandleForView(registrar->engine->view(flutter::kImplicitViewId));
293}
static FlutterDesktopViewRef HandleForView(flutter::FlutterWindowsView *view)
constexpr FlutterViewId kImplicitViewId

◆ FlutterDesktopPluginRegistrarGetViewById()

FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById ( FlutterDesktopPluginRegistrarRef  registrar,
FlutterDesktopViewId  view_id 
)

Definition at line 295 of file flutter_windows.cc.

297 {
298 return HandleForView(registrar->engine->view(view_id));
299}

◆ FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate()

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

Definition at line 301 of file flutter_windows.cc.

304 {
305 registrar->engine->window_proc_delegate_manager()
306 ->RegisterTopLevelWindowProcDelegate(delegate, user_data);
307}

◆ FlutterDesktopPluginRegistrarSetDestructionHandler()

void FlutterDesktopPluginRegistrarSetDestructionHandler ( FlutterDesktopPluginRegistrarRef  registrar,
FlutterDesktopOnPluginRegistrarDestroyed  callback 
)

Definition at line 342 of file flutter_windows.cc.

344 {
345 registrar->engine->AddPluginRegistrarDestructionCallback(callback, registrar);
346}

◆ FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate()

void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate ( FlutterDesktopPluginRegistrarRef  registrar,
FlutterDesktopWindowProcCallback  delegate 
)

Definition at line 309 of file flutter_windows.cc.

311 {
312 registrar->engine->window_proc_delegate_manager()
313 ->UnregisterTopLevelWindowProcDelegate(delegate);
314}

◆ FlutterDesktopRegistrarGetTextureRegistrar()

FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar ( FlutterDesktopPluginRegistrarRef  registrar)

Definition at line 422 of file flutter_windows.cc.

423 {
424 return HandleForTextureRegistrar(registrar->engine->texture_registrar());
425}

◆ FlutterDesktopResyncOutputStreams()

void FlutterDesktopResyncOutputStreams ( )

Definition at line 324 of file flutter_windows.cc.

324 {
325 FILE* unused;
326 if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
327 _dup2(_fileno(stdout), 1);
328 }
329 if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
330 _dup2(_fileno(stdout), 2);
331 }
332 std::ios::sync_with_stdio();
333}
static bool unused

◆ FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable()

bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable ( FlutterDesktopTextureRegistrarRef  texture_registrar,
int64_t  texture_id 
)

Definition at line 448 of file flutter_windows.cc.

450 {
453}
static flutter::FlutterWindowsTextureRegistrar * TextureRegistrarFromHandle(FlutterDesktopTextureRegistrarRef ref)
int64_t texture_id

◆ FlutterDesktopTextureRegistrarRegisterExternalTexture()

int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture ( FlutterDesktopTextureRegistrarRef  texture_registrar,
const FlutterDesktopTextureInfo texture_info 
)

Definition at line 427 of file flutter_windows.cc.

429 {
431 ->RegisterTexture(texture_info);
432}
int64_t RegisterTexture(const FlutterDesktopTextureInfo *texture_info)

◆ FlutterDesktopTextureRegistrarUnregisterExternalTexture()

void FlutterDesktopTextureRegistrarUnregisterExternalTexture ( FlutterDesktopTextureRegistrarRef  texture_registrar,
int64_t  texture_id,
void(*)(void *user_data callback,
void *  user_data 
)

Definition at line 434 of file flutter_windows.cc.

438 {
440 if (callback) {
441 registrar->UnregisterTexture(
443 return;
444 }
445 registrar->UnregisterTexture(texture_id);
446}

◆ FlutterDesktopViewControllerCreate()

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}

◆ FlutterDesktopViewControllerDestroy()

void FlutterDesktopViewControllerDestroy ( FlutterDesktopViewControllerRef  ref)

Definition at line 135 of file flutter_windows.cc.

135 {
136 auto controller = ViewControllerFromHandle(ref);
137 controller->Destroy();
138 delete controller;
139}
static flutter::FlutterWindowsViewController * ViewControllerFromHandle(FlutterDesktopViewControllerRef ref)

◆ FlutterDesktopViewControllerForceRedraw()

void FlutterDesktopViewControllerForceRedraw ( FlutterDesktopViewControllerRef  ref)

Definition at line 159 of file flutter_windows.cc.

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

◆ FlutterDesktopViewControllerGetEngine()

FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine ( FlutterDesktopViewControllerRef  ref)

Definition at line 147 of file flutter_windows.cc.

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

◆ FlutterDesktopViewControllerGetView()

FlutterDesktopViewRef FlutterDesktopViewControllerGetView ( FlutterDesktopViewControllerRef  ref)

Definition at line 153 of file flutter_windows.cc.

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

◆ FlutterDesktopViewControllerGetViewId()

FlutterDesktopViewId FlutterDesktopViewControllerGetViewId ( FlutterDesktopViewControllerRef  ref)

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}
int64_t FlutterDesktopViewId

◆ FlutterDesktopViewControllerHandleTopLevelWindowProc()

bool FlutterDesktopViewControllerHandleTopLevelWindowProc ( FlutterDesktopViewControllerRef  ref,
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}

◆ FlutterDesktopViewGetGraphicsAdapter()

IDXGIAdapter * FlutterDesktopViewGetGraphicsAdapter ( FlutterDesktopViewRef  view)

Definition at line 250 of file flutter_windows.cc.

250 {
251 auto egl_manager = ViewFromHandle(view)->GetEngine()->egl_manager();
252 if (egl_manager) {
253 Microsoft::WRL::ComPtr<ID3D11Device> d3d_device;
254 Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device;
255 if (egl_manager->GetDevice(d3d_device.GetAddressOf()) &&
256 SUCCEEDED(d3d_device.As(&dxgi_device))) {
257 IDXGIAdapter* adapter;
258 if (SUCCEEDED(dxgi_device->GetAdapter(&adapter))) {
259 return adapter;
260 }
261 }
262 }
263 return nullptr;
264}
FlutterWindowsEngine * GetEngine() const
static flutter::FlutterWindowsView * ViewFromHandle(FlutterDesktopViewRef ref)
#define SUCCEEDED(hr)

◆ FlutterDesktopViewGetHWND()

HWND FlutterDesktopViewGetHWND ( FlutterDesktopViewRef  view)

Definition at line 246 of file flutter_windows.cc.

246 {
247 return ViewFromHandle(view)->GetWindowHandle();
248}
virtual HWND GetWindowHandle() const

◆ HandleForEngine()

static FlutterDesktopEngineRef HandleForEngine ( flutter::FlutterWindowsEngine engine)
static

Definition at line 38 of file flutter_windows.cc.

39 {
40 return reinterpret_cast<FlutterDesktopEngineRef>(engine);
41}

◆ HandleForTextureRegistrar()

static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar ( flutter::FlutterWindowsTextureRegistrar registrar)
static

Definition at line 70 of file flutter_windows.cc.

71 {
72 return reinterpret_cast<FlutterDesktopTextureRegistrarRef>(registrar);
73}
struct FlutterDesktopTextureRegistrar * FlutterDesktopTextureRegistrarRef

◆ HandleForView()

static FlutterDesktopViewRef HandleForView ( flutter::FlutterWindowsView view)
static

Definition at line 59 of file flutter_windows.cc.

59 {
60 return reinterpret_cast<FlutterDesktopViewRef>(view);
61}
struct FlutterDesktopView * FlutterDesktopViewRef

◆ HandleForViewController()

static FlutterDesktopViewControllerRef HandleForViewController ( flutter::FlutterWindowsViewController view_controller)
static

Definition at line 48 of file flutter_windows.cc.

49 {
50 return reinterpret_cast<FlutterDesktopViewControllerRef>(view_controller);
51}
struct FlutterDesktopViewController * FlutterDesktopViewControllerRef

◆ TextureRegistrarFromHandle()

static flutter::FlutterWindowsTextureRegistrar * TextureRegistrarFromHandle ( FlutterDesktopTextureRegistrarRef  ref)
static

◆ ViewControllerFromHandle()

static flutter::FlutterWindowsViewController * ViewControllerFromHandle ( FlutterDesktopViewControllerRef  ref)
static

Definition at line 43 of file flutter_windows.cc.

44 {
45 return reinterpret_cast<flutter::FlutterWindowsViewController*>(ref);
46}
Controls a view that displays Flutter content.

◆ ViewFromHandle()

static flutter::FlutterWindowsView * ViewFromHandle ( FlutterDesktopViewRef  ref)
static

Definition at line 54 of file flutter_windows.cc.

54 {
55 return reinterpret_cast<flutter::FlutterWindowsView*>(ref);
56}