| Flutter Windows Embedder |

flutter_windows.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "flutter/shell/platform/windows/public/flutter_windows.h"
6
7 #include <io.h>
8
9 #include <algorithm>
10 #include <chrono>
11 #include <cstdlib>
12 #include <filesystem>
13 #include <memory>
14 #include <vector>
15
16 #include "flutter/shell/platform/common/client_wrapper/include/flutter/plugin_registrar.h"
17 #include "flutter/shell/platform/common/incoming_message_dispatcher.h"
18 #include "flutter/shell/platform/common/path_utils.h"
19 #include "flutter/shell/platform/embedder/embedder.h"
20 #include "flutter/shell/platform/windows/dpi_utils.h"
21 #include "flutter/shell/platform/windows/flutter_project_bundle.h"
22 #include "flutter/shell/platform/windows/flutter_window.h"
23 #include "flutter/shell/platform/windows/flutter_windows_engine.h"
24 #include "flutter/shell/platform/windows/flutter_windows_view.h"
25 #include "flutter/shell/platform/windows/window_binding_handler.h"
26 #include "flutter/shell/platform/windows/window_state.h"
27
28 static_assert(FLUTTER_ENGINE_VERSION == 1, "");
29
30 // Returns the engine corresponding to the given opaque API handle.
31 static flutter::FlutterWindowsEngine* EngineFromHandle(
32 FlutterDesktopEngineRef ref) {
33 return reinterpret_cast<flutter::FlutterWindowsEngine*>(ref);
34 }
35
36 // Returns the opaque API handle for the given engine instance.
37 static FlutterDesktopEngineRef HandleForEngine(
38 flutter::FlutterWindowsEngine* engine) {
39 return reinterpret_cast<FlutterDesktopEngineRef>(engine);
40 }
41
42 // Returns the view corresponding to the given opaque API handle.
43 static flutter::FlutterWindowsView* ViewFromHandle(FlutterDesktopViewRef ref) {
44 return reinterpret_cast<flutter::FlutterWindowsView*>(ref);
45 }
46
47 // Returns the opaque API handle for the given view instance.
48 static FlutterDesktopViewRef HandleForView(flutter::FlutterWindowsView* view) {
49 return reinterpret_cast<FlutterDesktopViewRef>(view);
50 }
51
52 // Returns the texture registrar corresponding to the given opaque API handle.
53 static flutter::FlutterWindowsTextureRegistrar* TextureRegistrarFromHandle(
54 FlutterDesktopTextureRegistrarRef ref) {
55 return reinterpret_cast<flutter::FlutterWindowsTextureRegistrar*>(ref);
56 }
57
58 // Returns the opaque API handle for the given texture registrar instance.
59 static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar(
60 flutter::FlutterWindowsTextureRegistrar* registrar) {
61 return reinterpret_cast<FlutterDesktopTextureRegistrarRef>(registrar);
62 }
63
64 FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(
65 int width,
66 int height,
67 FlutterDesktopEngineRef engine) {
68 std::unique_ptr<flutter::WindowBindingHandler> window_wrapper =
69 std::make_unique<flutter::FlutterWindow>(width, height);
70
71 auto state = std::make_unique<FlutterDesktopViewControllerState>();
72 state->view =
73 std::make_unique<flutter::FlutterWindowsView>(std::move(window_wrapper));
74 // Take ownership of the engine, starting it if necessary.
75 state->view->SetEngine(
76 std::unique_ptr<flutter::FlutterWindowsEngine>(EngineFromHandle(engine)));
77 state->view->CreateRenderSurface();
78 if (!state->view->GetEngine()->running()) {
79 if (!state->view->GetEngine()->Run()) {
80 return nullptr;
81 }
82 }
83
84 // Must happen after engine is running.
85 state->view->SendInitialBounds();
86 state->view->SendInitialAccessibilityFeatures();
87 return state.release();
88 }
89
90 void FlutterDesktopViewControllerDestroy(
91 FlutterDesktopViewControllerRef controller) {
92 delete controller;
93 }
94
95 FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(
96 FlutterDesktopViewControllerRef controller) {
97 return HandleForEngine(controller->view->GetEngine());
98 }
99
100 FlutterDesktopViewRef FlutterDesktopViewControllerGetView(
101 FlutterDesktopViewControllerRef controller) {
102 return HandleForView(controller->view.get());
103 }
104
105 void FlutterDesktopViewControllerForceRedraw(
106 FlutterDesktopViewControllerRef controller) {
107 controller->view->ForceRedraw();
108 }
109
110 bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
111 FlutterDesktopViewControllerRef controller,
112 HWND hwnd,
113 UINT message,
114 WPARAM wparam,
115 LPARAM lparam,
116 LRESULT* result) {
117 std::optional<LRESULT> delegate_result =
118 controller->view->GetEngine()
119 ->window_proc_delegate_manager()
120 ->OnTopLevelWindowProc(hwnd, message, wparam, lparam);
121 if (delegate_result) {
122 *result = *delegate_result;
123 }
124 return delegate_result.has_value();
125 }
126
127 FlutterDesktopEngineRef FlutterDesktopEngineCreate(
128 const FlutterDesktopEngineProperties* engine_properties) {
129 flutter::FlutterProjectBundle project(*engine_properties);
130 auto engine = std::make_unique<flutter::FlutterWindowsEngine>(project);
131 return HandleForEngine(engine.release());
132 }
133
134 bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref) {
135 flutter::FlutterWindowsEngine* engine = EngineFromHandle(engine_ref);
136 bool result = true;
137 if (engine->running()) {
138 result = engine->Stop();
139 }
140 delete engine;
141 return result;
142 }
143
144 bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine,
145 const char* entry_point) {
146 std::string_view entry_point_view{""};
147 if (entry_point != nullptr) {
148 entry_point_view = entry_point;
149 }
150
151 return EngineFromHandle(engine)->Run(entry_point_view);
152 }
153
154 uint64_t FlutterDesktopEngineProcessMessages(FlutterDesktopEngineRef engine) {
155 return std::chrono::nanoseconds::max().count();
156 }
157
158 void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine) {
159 EngineFromHandle(engine)->ReloadSystemFonts();
160 }
161
162 FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(
163 FlutterDesktopEngineRef engine,
164 const char* plugin_name) {
165 // Currently, one registrar acts as the registrar for all plugins, so the
166 // name is ignored. It is part of the API to reduce churn in the future when
167 // aligning more closely with the Flutter registrar system.
168
169 return EngineFromHandle(engine)->GetRegistrar();
170 }
171
172 FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(
173 FlutterDesktopEngineRef engine) {
174 return EngineFromHandle(engine)->messenger();
175 }
176
177 FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(
178 FlutterDesktopEngineRef engine) {
179 return HandleForTextureRegistrar(
180 EngineFromHandle(engine)->texture_registrar());
181 }
182
183 void FlutterDesktopEngineSetNextFrameCallback(FlutterDesktopEngineRef engine,
184 VoidCallback callback,
185 void* user_data) {
186 EngineFromHandle(engine)->SetNextFrameCallback(
187 [callback, user_data]() { callback(user_data); });
188 }
189
190 HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef view) {
191 return ViewFromHandle(view)->GetPlatformWindow();
192 }
193
194 IDXGIAdapter* FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view) {
195 auto surface_manager = ViewFromHandle(view)->GetEngine()->surface_manager();
196 if (surface_manager) {
197 Microsoft::WRL::ComPtr<ID3D11Device> d3d_device;
198 Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device;
199 if (surface_manager->GetDevice(d3d_device.GetAddressOf()) &&
200 SUCCEEDED(d3d_device.As(&dxgi_device))) {
201 IDXGIAdapter* adapter;
202 if (SUCCEEDED(dxgi_device->GetAdapter(&adapter))) {
203 return adapter;
204 }
205 }
206 }
207 return nullptr;
208 }
209
210 bool FlutterDesktopEngineProcessExternalWindowMessage(
211 FlutterDesktopEngineRef engine,
212 HWND hwnd,
213 UINT message,
214 WPARAM wparam,
215 LPARAM lparam,
216 LRESULT* result) {
217 std::optional<LRESULT> lresult =
218 EngineFromHandle(engine)->ProcessExternalWindowMessage(hwnd, message,
219 wparam, lparam);
220 if (result && lresult.has_value()) {
221 *result = lresult.value();
222 }
223 return lresult.has_value();
224 }
225
226 FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(
227 FlutterDesktopPluginRegistrarRef registrar) {
228 return HandleForView(registrar->engine->view());
229 }
230
231 void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(
232 FlutterDesktopPluginRegistrarRef registrar,
233 FlutterDesktopWindowProcCallback delegate,
234 void* user_data) {
235 registrar->engine->window_proc_delegate_manager()
236 ->RegisterTopLevelWindowProcDelegate(delegate, user_data);
237 }
238
239 void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(
240 FlutterDesktopPluginRegistrarRef registrar,
241 FlutterDesktopWindowProcCallback delegate) {
242 registrar->engine->window_proc_delegate_manager()
243 ->UnregisterTopLevelWindowProcDelegate(delegate);
244 }
245
246 UINT FlutterDesktopGetDpiForHWND(HWND hwnd) {
247 return flutter::GetDpiForHWND(hwnd);
248 }
249
250 UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor) {
251 return flutter::GetDpiForMonitor(monitor);
252 }
253
254 void FlutterDesktopResyncOutputStreams() {
255 FILE* unused;
256 if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
257 _dup2(_fileno(stdout), 1);
258 }
259 if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
260 _dup2(_fileno(stdout), 2);
261 }
262 std::ios::sync_with_stdio();
263 }
264
265 // Implementations of common/ API methods.
266
267 FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(
268 FlutterDesktopPluginRegistrarRef registrar) {
269 return registrar->engine->messenger();
270 }
271
272 void FlutterDesktopPluginRegistrarSetDestructionHandler(
273 FlutterDesktopPluginRegistrarRef registrar,
274 FlutterDesktopOnPluginRegistrarDestroyed callback) {
275 registrar->engine->AddPluginRegistrarDestructionCallback(callback, registrar);
276 }
277
278 bool FlutterDesktopMessengerSendWithReply(FlutterDesktopMessengerRef messenger,
279 const char* channel,
280 const uint8_t* message,
281 const size_t message_size,
282 const FlutterDesktopBinaryReply reply,
283 void* user_data) {
284 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
285 << "Messenger must reference a running engine to send a message";
286
287 return flutter::FlutterDesktopMessenger::FromRef(messenger)
288 ->GetEngine()
289 ->SendPlatformMessage(channel, message, message_size, reply, user_data);
290 }
291
292 bool FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger,
293 const char* channel,
294 const uint8_t* message,
295 const size_t message_size) {
296 return FlutterDesktopMessengerSendWithReply(messenger, channel, message,
297 message_size, nullptr, nullptr);
298 }
299
300 void FlutterDesktopMessengerSendResponse(
301 FlutterDesktopMessengerRef messenger,
302 const FlutterDesktopMessageResponseHandle* handle,
303 const uint8_t* data,
304 size_t data_length) {
305 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
306 << "Messenger must reference a running engine to send a response";
307
308 flutter::FlutterDesktopMessenger::FromRef(messenger)
309 ->GetEngine()
310 ->SendPlatformMessageResponse(handle, data, data_length);
311 }
312
313 void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger,
314 const char* channel,
315 FlutterDesktopMessageCallback callback,
316 void* user_data) {
317 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
318 << "Messenger must reference a running engine to set a callback";
319
320 flutter::FlutterDesktopMessenger::FromRef(messenger)
321 ->GetEngine()
322 ->message_dispatcher()
323 ->SetMessageCallback(channel, callback, user_data);
324 }
325
326 FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(
327 FlutterDesktopMessengerRef messenger) {
328 return flutter::FlutterDesktopMessenger::FromRef(messenger)
329 ->AddRef()
330 ->ToRef();
331 }
332
333 void FlutterDesktopMessengerRelease(FlutterDesktopMessengerRef messenger) {
334 flutter::FlutterDesktopMessenger::FromRef(messenger)->Release();
335 }
336
337 bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger) {
338 return flutter::FlutterDesktopMessenger::FromRef(messenger)->GetEngine() !=
339 nullptr;
340 }
341
342 FlutterDesktopMessengerRef FlutterDesktopMessengerLock(
343 FlutterDesktopMessengerRef messenger) {
344 flutter::FlutterDesktopMessenger::FromRef(messenger)->GetMutex().lock();
345 return messenger;
346 }
347
348 void FlutterDesktopMessengerUnlock(FlutterDesktopMessengerRef messenger) {
349 flutter::FlutterDesktopMessenger::FromRef(messenger)->GetMutex().unlock();
350 }
351
352 FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar(
353 FlutterDesktopPluginRegistrarRef registrar) {
354 return HandleForTextureRegistrar(registrar->engine->texture_registrar());
355 }
356
357 int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(
358 FlutterDesktopTextureRegistrarRef texture_registrar,
359 const FlutterDesktopTextureInfo* texture_info) {
360 return TextureRegistrarFromHandle(texture_registrar)
361 ->RegisterTexture(texture_info);
362 }
363
364 void FlutterDesktopTextureRegistrarUnregisterExternalTexture(
365 FlutterDesktopTextureRegistrarRef texture_registrar,
366 int64_t texture_id,
367 void (*callback)(void* user_data),
368 void* user_data) {
369 auto registrar = TextureRegistrarFromHandle(texture_registrar);
370 if (callback) {
371 registrar->UnregisterTexture(
372 texture_id, [callback, user_data]() { callback(user_data); });
373 return;
374 }
375 registrar->UnregisterTexture(texture_id);
376 }
377
378 bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(
379 FlutterDesktopTextureRegistrarRef texture_registrar,
380 int64_t texture_id) {
381 return TextureRegistrarFromHandle(texture_registrar)
382 ->MarkTextureFrameAvailable(texture_id);
383 }
FlutterDesktopViewControllerGetView
FlutterDesktopViewRef FlutterDesktopViewControllerGetView(FlutterDesktopViewControllerRef controller)
Definition: flutter_windows.cc:100
flutter::FlutterWindowsEngine::GetRegistrar
FlutterDesktopPluginRegistrarRef GetRegistrar()
Definition: flutter_windows_engine.cc:489
TextureRegistrarFromHandle
static flutter::FlutterWindowsTextureRegistrar * TextureRegistrarFromHandle(FlutterDesktopTextureRegistrarRef ref)
Definition: flutter_windows.cc:53
flutter::FlutterProjectBundle
Definition: flutter_project_bundle.h:21
FlutterDesktopViewGetHWND
HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef view)
Definition: flutter_windows.cc:190
FlutterDesktopEngineGetTextureRegistrar
FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:177
FlutterDesktopPluginRegistrarGetView
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:226
FlutterDesktopEngineGetMessenger
FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:172
FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
Definition: flutter_windows.cc:231
flutter::FlutterWindowsView
Definition: flutter_windows_view.h:35
HandleForView
static FlutterDesktopViewRef HandleForView(flutter::FlutterWindowsView *view)
Definition: flutter_windows.cc:48
FlutterDesktopEngineProperties
Definition: flutter_windows.h:36
plugin_registrar.h
FlutterDesktopMessengerUnlock
void FlutterDesktopMessengerUnlock(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:348
FlutterDesktopMessengerSend
bool FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger, const char *channel, const uint8_t *message, const size_t message_size)
Definition: flutter_windows.cc:292
FlutterDesktopBinaryReply
void(* FlutterDesktopBinaryReply)(const uint8_t *data, size_t data_size, void *user_data)
Definition: flutter_messenger.h:26
HandleForTextureRegistrar
static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar(flutter::FlutterWindowsTextureRegistrar *registrar)
Definition: flutter_windows.cc:59
FlutterDesktopViewControllerGetEngine
FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(FlutterDesktopViewControllerRef controller)
Definition: flutter_windows.cc:95
flutter::FlutterWindowsEngine::SetNextFrameCallback
void SetNextFrameCallback(fml::closure callback)
Definition: flutter_windows_engine.cc:584
flutter::GetDpiForMonitor
UINT GetDpiForMonitor(HMONITOR monitor)
Definition: dpi_utils.cc:134
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:47
flutter::FlutterWindowsTextureRegistrar::MarkTextureFrameAvailable
bool MarkTextureFrameAvailable(int64_t texture_id)
Definition: flutter_windows_texture_registrar.cc:104
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:78
flutter::FlutterWindowsEngine::window_proc_delegate_manager
WindowProcDelegateManager * window_proc_delegate_manager()
Definition: flutter_windows_engine.h:144
flutter::WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate, void *user_data)
Definition: window_proc_delegate_manager.cc:14
FlutterDesktopMessageResponseHandle
struct _FlutterPlatformMessageResponseHandle FlutterDesktopMessageResponseHandle
Definition: flutter_messenger.h:22
FlutterDesktopEngineProcessExternalWindowMessage
bool FlutterDesktopEngineProcessExternalWindowMessage(FlutterDesktopEngineRef engine, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
Definition: flutter_windows.cc:210
FlutterDesktopPluginRegistrarSetDestructionHandler
void FlutterDesktopPluginRegistrarSetDestructionHandler(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopOnPluginRegistrarDestroyed callback)
Definition: flutter_windows.cc:272
FlutterDesktopEngineGetPluginRegistrar
FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(FlutterDesktopEngineRef engine, const char *plugin_name)
Definition: flutter_windows.cc:162
flutter::GetDpiForHWND
UINT GetDpiForHWND(HWND hwnd)
Definition: dpi_utils.cc:130
FlutterDesktopViewControllerHandleTopLevelWindowProc
bool FlutterDesktopViewControllerHandleTopLevelWindowProc(FlutterDesktopViewControllerRef controller, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
Definition: flutter_windows.cc:110
EngineFromHandle
static flutter::FlutterWindowsEngine * EngineFromHandle(FlutterDesktopEngineRef ref)
Definition: flutter_windows.cc:31
FlutterDesktopPluginRegistrarGetMessenger
FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:267
flutter::FlutterDesktopMessenger::ToRef
FlutterDesktopMessengerRef ToRef()
Convert to FlutterDesktopMessengerRef.
Definition: flutter_desktop_messenger.h:28
flutter::FlutterWindowsEngine::SendPlatformMessage
bool SendPlatformMessage(const char *channel, const uint8_t *message, const size_t message_size, const FlutterDesktopBinaryReply reply, void *user_data)
Definition: flutter_windows_engine.cc:520
FlutterDesktopResyncOutputStreams
void FlutterDesktopResyncOutputStreams()
Definition: flutter_windows.cc:254
flutter::FlutterWindowsEngine::Stop
virtual bool Stop()
Definition: flutter_windows_engine.cc:442
flutter::FlutterWindowsEngine::messenger
FlutterDesktopMessengerRef messenger()
Definition: flutter_windows_engine.h:128
flutter::FlutterWindowsEngine::ProcessExternalWindowMessage
std::optional< LRESULT > ProcessExternalWindowMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: flutter_windows_engine.cc:814
FlutterDesktopViewControllerForceRedraw
void FlutterDesktopViewControllerForceRedraw(FlutterDesktopViewControllerRef controller)
Definition: flutter_windows.cc:105
path_utils.h
FlutterDesktopMessengerLock
FlutterDesktopMessengerRef FlutterDesktopMessengerLock(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:342
flutter_windows_view.h
flutter::FlutterDesktopMessenger::GetMutex
std::mutex & GetMutex()
Definition: flutter_desktop_messenger.h:70
flutter::FlutterDesktopMessenger::Release
void Release()
Definition: flutter_desktop_messenger.h:59
FlutterDesktopViewRef
struct FlutterDesktopView * FlutterDesktopViewRef
Definition: flutter_windows.h:29
FlutterDesktopEngineRef
struct FlutterDesktopEngine * FlutterDesktopEngineRef
Definition: flutter_windows.h:33
flutter::WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate)
Definition: window_proc_delegate_manager.cc:20
flutter::FlutterWindowsTextureRegistrar
Definition: flutter_windows_texture_registrar.h:23
flutter_window.h
flutter::FlutterWindowsEngine::texture_registrar
FlutterWindowsTextureRegistrar * texture_registrar()
Definition: flutter_windows_engine.h:136
FlutterDesktopRegistrarGetTextureRegistrar
FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:352
flutter::FlutterWindowsEngine::AddPluginRegistrarDestructionCallback
void AddPluginRegistrarDestructionCallback(FlutterDesktopOnPluginRegistrarDestroyed callback, FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows_engine.cc:493
FlutterDesktopTextureRegistrarRef
struct FlutterDesktopTextureRegistrar * FlutterDesktopTextureRegistrarRef
Definition: flutter_texture_registrar.h:19
FlutterDesktopGetDpiForMonitor
UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor)
Definition: flutter_windows.cc:250
window_binding_handler.h
flutter_project_bundle.h
dpi_utils.h
FlutterDesktopTextureInfo
Definition: flutter_texture_registrar.h:151
FlutterDesktopEngineProcessMessages
uint64_t FlutterDesktopEngineProcessMessages(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:154
window_state.h
FlutterDesktopPluginRegistrar::engine
flutter::FlutterWindowsEngine * engine
Definition: window_state.h:33
FlutterDesktopTextureRegistrarUnregisterExternalTexture
void FlutterDesktopTextureRegistrarUnregisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id, void(*callback)(void *user_data), void *user_data)
Definition: flutter_windows.cc:364
flutter::FlutterWindowsEngine::SendPlatformMessageResponse
void SendPlatformMessageResponse(const FlutterDesktopMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
Definition: flutter_windows_engine.cc:554
FlutterDesktopViewControllerDestroy
void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef controller)
Definition: flutter_windows.cc:90
flutter::FlutterDesktopMessenger::GetEngine
flutter::FlutterWindowsEngine * GetEngine() const
Getter for the engine field.
Definition: flutter_desktop_messenger.h:38
FlutterDesktopViewControllerCreate
FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(int width, int height, FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:64
flutter::IncomingMessageDispatcher::SetMessageCallback
void SetMessageCallback(const std::string &channel, FlutterDesktopMessageCallback callback, void *user_data)
Definition: incoming_message_dispatcher.cc:43
FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate
void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate)
Definition: flutter_windows.cc:239
FlutterDesktopOnPluginRegistrarDestroyed
void(* FlutterDesktopOnPluginRegistrarDestroyed)(FlutterDesktopPluginRegistrarRef)
Definition: flutter_plugin_registrar.h:23
flutter::FlutterWindowsEngine::message_dispatcher
IncomingMessageDispatcher * message_dispatcher()
Definition: flutter_windows_engine.h:130
flutter::FlutterDesktopMessenger::AddRef
FlutterDesktopMessenger * AddRef()
Definition: flutter_desktop_messenger.h:50
FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable
bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id)
Definition: flutter_windows.cc:378
FlutterDesktopEngineDestroy
bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref)
Definition: flutter_windows.cc:134
flutter::FlutterWindowsEngine::surface_manager
AngleSurfaceManager * surface_manager()
Definition: flutter_windows_engine.h:142
flutter_windows_engine.h
FlutterDesktopEngineCreate
FlutterDesktopEngineRef FlutterDesktopEngineCreate(const FlutterDesktopEngineProperties *engine_properties)
Definition: flutter_windows.cc:127
FlutterDesktopMessengerRef
struct FlutterDesktopMessenger * FlutterDesktopMessengerRef
Definition: flutter_messenger.h:19
FlutterDesktopMessengerSendResponse
void FlutterDesktopMessengerSendResponse(FlutterDesktopMessengerRef messenger, const FlutterDesktopMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
Definition: flutter_windows.cc:300
FlutterDesktopMessengerIsAvailable
bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:337
HandleForEngine
static FlutterDesktopEngineRef HandleForEngine(flutter::FlutterWindowsEngine *engine)
Definition: flutter_windows.cc:37
ViewFromHandle
static flutter::FlutterWindowsView * ViewFromHandle(FlutterDesktopViewRef ref)
Definition: flutter_windows.cc:43
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view()
Definition: flutter_windows_engine.h:115
VoidCallback
void(* VoidCallback)(void *)
Definition: flutter_windows.h:21
flutter::FlutterWindowsEngine::running
bool running()
Definition: flutter_windows_engine.h:103
flutter_windows.h
message
Win32Message message
Definition: keyboard_unittests.cc:137
flutter::FlutterDesktopMessenger::FromRef
static FlutterDesktopMessenger * FromRef(FlutterDesktopMessengerRef ref)
Convert from FlutterDesktopMessengerRef.
Definition: flutter_desktop_messenger.h:33
FlutterDesktopEngineSetNextFrameCallback
void FlutterDesktopEngineSetNextFrameCallback(FlutterDesktopEngineRef engine, VoidCallback callback, void *user_data)
Definition: flutter_windows.cc:183
FlutterDesktopViewControllerState::view
std::unique_ptr< flutter::FlutterWindowsView > view
Definition: window_state.h:26
incoming_message_dispatcher.h
FlutterDesktopMessengerRelease
void FlutterDesktopMessengerRelease(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:333
flutter::FlutterWindowsView::GetPlatformWindow
virtual PlatformWindow GetPlatformWindow() const
Definition: flutter_windows_view.cc:626
FlutterDesktopTextureRegistrarRegisterExternalTexture
int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, const FlutterDesktopTextureInfo *texture_info)
Definition: flutter_windows.cc:357
FlutterDesktopMessengerSetCallback
void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger, const char *channel, FlutterDesktopMessageCallback callback, void *user_data)
Definition: flutter_windows.cc:313
FlutterDesktopViewGetGraphicsAdapter
IDXGIAdapter * FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view)
Definition: flutter_windows.cc:194
texture_id
int64_t texture_id
Definition: texture_registrar_unittests.cc:24
FlutterDesktopMessageCallback
void(* FlutterDesktopMessageCallback)(FlutterDesktopMessengerRef, const FlutterDesktopMessage *, void *)
Definition: flutter_messenger.h:49
FlutterDesktopGetDpiForHWND
UINT FlutterDesktopGetDpiForHWND(HWND hwnd)
Definition: flutter_windows.cc:246
FlutterDesktopPluginRegistrar
Definition: window_state.h:31
FlutterDesktopEngineRun
bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine, const char *entry_point)
Definition: flutter_windows.cc:144
flutter::FlutterWindowsEngine::Run
bool Run()
Definition: flutter_windows_engine.cc:246
flutter::FlutterWindowsView::GetEngine
FlutterWindowsEngine * GetEngine()
Definition: flutter_windows_view.cc:630
FlutterDesktopViewControllerState
Definition: window_state.h:24
FlutterDesktopWindowProcCallback
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
Definition: flutter_windows.h:238
flutter::FlutterWindowsTextureRegistrar::RegisterTexture
int64_t RegisterTexture(const FlutterDesktopTextureInfo *texture_info)
Definition: flutter_windows_texture_registrar.cc:26
FlutterDesktopMessengerSendWithReply
bool FlutterDesktopMessengerSendWithReply(FlutterDesktopMessengerRef messenger, const char *channel, const uint8_t *message, const size_t message_size, const FlutterDesktopBinaryReply reply, void *user_data)
Definition: flutter_windows.cc:278
flutter::FlutterWindowsEngine::ReloadSystemFonts
void ReloadSystemFonts()
Definition: flutter_windows_engine.cc:576
FlutterDesktopEngineReloadSystemFonts
void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:158
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:46
FlutterDesktopMessengerAddRef
FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:326