| 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/flutter_windows_view_controller.h"
26 #include "flutter/shell/platform/windows/window_binding_handler.h"
27 #include "flutter/shell/platform/windows/window_state.h"
28
29 static_assert(FLUTTER_ENGINE_VERSION == 1, "");
30
31 // Returns the engine corresponding to the given opaque API handle.
32 static flutter::FlutterWindowsEngine* EngineFromHandle(
33 FlutterDesktopEngineRef ref) {
34 return reinterpret_cast<flutter::FlutterWindowsEngine*>(ref);
35 }
36
37 // Returns the opaque API handle for the given engine instance.
38 static FlutterDesktopEngineRef HandleForEngine(
39 flutter::FlutterWindowsEngine* engine) {
40 return reinterpret_cast<FlutterDesktopEngineRef>(engine);
41 }
42
43 static flutter::FlutterWindowsViewController* ViewControllerFromHandle(
44 FlutterDesktopViewControllerRef ref) {
45 return reinterpret_cast<flutter::FlutterWindowsViewController*>(ref);
46 }
47
48 static FlutterDesktopViewControllerRef HandleForViewController(
49 flutter::FlutterWindowsViewController* view_controller) {
50 return reinterpret_cast<FlutterDesktopViewControllerRef>(view_controller);
51 }
52
53 // Returns the view corresponding to the given opaque API handle.
54 static flutter::FlutterWindowsView* ViewFromHandle(FlutterDesktopViewRef ref) {
55 return reinterpret_cast<flutter::FlutterWindowsView*>(ref);
56 }
57
58 // Returns the opaque API handle for the given view instance.
59 static FlutterDesktopViewRef HandleForView(flutter::FlutterWindowsView* view) {
60 return reinterpret_cast<FlutterDesktopViewRef>(view);
61 }
62
63 // Returns the texture registrar corresponding to the given opaque API handle.
64 static flutter::FlutterWindowsTextureRegistrar* TextureRegistrarFromHandle(
65 FlutterDesktopTextureRegistrarRef ref) {
66 return reinterpret_cast<flutter::FlutterWindowsTextureRegistrar*>(ref);
67 }
68
69 // Returns the opaque API handle for the given texture registrar instance.
70 static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar(
71 flutter::FlutterWindowsTextureRegistrar* registrar) {
72 return reinterpret_cast<FlutterDesktopTextureRegistrarRef>(registrar);
73 }
74
75 // Creates a view controller that might own the engine.
76 //
77 // If `owns_engine` is true, then the returned `FlutterDesktopViewControllerRef`
78 // owns `engine_ref` and will deallocate `engine_ref` upon its own destruction.
79 static FlutterDesktopViewControllerRef CreateViewController(
80 FlutterDesktopEngineRef engine_ref,
81 int width,
82 int height,
83 bool owns_engine) {
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 }
120
121 FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(
122 int width,
123 int height,
124 FlutterDesktopEngineRef engine) {
125 return CreateViewController(engine, width, height, /*owns_engine=*/true);
126 }
127
128 FlutterDesktopViewControllerRef FlutterDesktopEngineCreateViewController(
129 FlutterDesktopEngineRef engine,
130 const FlutterDesktopViewControllerProperties* properties) {
131 return CreateViewController(engine, properties->width, properties->height,
132 /*owns_engine=*/false);
133 }
134
135 void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef ref) {
136 auto controller = ViewControllerFromHandle(ref);
137 controller->Destroy();
138 delete controller;
139 }
140
141 FlutterDesktopViewId FlutterDesktopViewControllerGetViewId(
142 FlutterDesktopViewControllerRef ref) {
143 auto controller = ViewControllerFromHandle(ref);
144 return static_cast<FlutterDesktopViewId>(controller->view()->view_id());
145 }
146
147 FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(
148 FlutterDesktopViewControllerRef ref) {
149 auto controller = ViewControllerFromHandle(ref);
150 return HandleForEngine(controller->engine());
151 }
152
153 FlutterDesktopViewRef FlutterDesktopViewControllerGetView(
154 FlutterDesktopViewControllerRef ref) {
155 auto controller = ViewControllerFromHandle(ref);
156 return HandleForView(controller->view());
157 }
158
159 void FlutterDesktopViewControllerForceRedraw(
160 FlutterDesktopViewControllerRef ref) {
161 auto controller = ViewControllerFromHandle(ref);
162 controller->view()->ForceRedraw();
163 }
164
165 bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
166 FlutterDesktopViewControllerRef ref,
167 HWND hwnd,
168 UINT message,
169 WPARAM wparam,
170 LPARAM lparam,
171 LRESULT* result) {
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 }
182
183 FlutterDesktopEngineRef FlutterDesktopEngineCreate(
184 const FlutterDesktopEngineProperties* engine_properties) {
185 flutter::FlutterProjectBundle project(*engine_properties);
186 auto engine = std::make_unique<flutter::FlutterWindowsEngine>(project);
187 return HandleForEngine(engine.release());
188 }
189
190 bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref) {
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 }
199
200 bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine,
201 const char* entry_point) {
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 }
209
210 uint64_t FlutterDesktopEngineProcessMessages(FlutterDesktopEngineRef engine) {
211 return std::chrono::nanoseconds::max().count();
212 }
213
214 void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine) {
215 EngineFromHandle(engine)->ReloadSystemFonts();
216 }
217
218 FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(
219 FlutterDesktopEngineRef engine,
220 const char* plugin_name) {
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
225 return EngineFromHandle(engine)->GetRegistrar();
226 }
227
228 FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(
229 FlutterDesktopEngineRef engine) {
230 return EngineFromHandle(engine)->messenger();
231 }
232
233 FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(
234 FlutterDesktopEngineRef engine) {
235 return HandleForTextureRegistrar(
236 EngineFromHandle(engine)->texture_registrar());
237 }
238
239 void FlutterDesktopEngineSetNextFrameCallback(FlutterDesktopEngineRef engine,
240 VoidCallback callback,
241 void* user_data) {
242 EngineFromHandle(engine)->SetNextFrameCallback(
243 [callback, user_data]() { callback(user_data); });
244 }
245
246 HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef view) {
247 return ViewFromHandle(view)->GetWindowHandle();
248 }
249
250 IDXGIAdapter* FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view) {
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 }
265
266 bool FlutterDesktopEngineProcessExternalWindowMessage(
267 FlutterDesktopEngineRef engine,
268 HWND hwnd,
269 UINT message,
270 WPARAM wparam,
271 LPARAM lparam,
272 LRESULT* result) {
273 std::optional<LRESULT> lresult =
274 EngineFromHandle(engine)->ProcessExternalWindowMessage(hwnd, message,
275 wparam, lparam);
276 if (result && lresult.has_value()) {
277 *result = lresult.value();
278 }
279 return lresult.has_value();
280 }
281
282 void FlutterDesktopEngineRegisterPlatformViewType(
283 FlutterDesktopEngineRef engine,
284 const char* view_type_name,
285 FlutterPlatformViewTypeEntry view_type) {
286 // TODO(schectman): forward to platform view manager.
287 // https://github.com/flutter/flutter/issues/143375
288 }
289
290 FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(
291 FlutterDesktopPluginRegistrarRef registrar) {
292 return HandleForView(registrar->engine->view(flutter::kImplicitViewId));
293 }
294
295 FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById(
296 FlutterDesktopPluginRegistrarRef registrar,
297 FlutterDesktopViewId view_id) {
298 return HandleForView(registrar->engine->view(view_id));
299 }
300
301 void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(
302 FlutterDesktopPluginRegistrarRef registrar,
303 FlutterDesktopWindowProcCallback delegate,
304 void* user_data) {
305 registrar->engine->window_proc_delegate_manager()
306 ->RegisterTopLevelWindowProcDelegate(delegate, user_data);
307 }
308
309 void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(
310 FlutterDesktopPluginRegistrarRef registrar,
311 FlutterDesktopWindowProcCallback delegate) {
312 registrar->engine->window_proc_delegate_manager()
313 ->UnregisterTopLevelWindowProcDelegate(delegate);
314 }
315
316 UINT FlutterDesktopGetDpiForHWND(HWND hwnd) {
317 return flutter::GetDpiForHWND(hwnd);
318 }
319
320 UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor) {
321 return flutter::GetDpiForMonitor(monitor);
322 }
323
324 void FlutterDesktopResyncOutputStreams() {
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 }
334
335 // Implementations of common/ API methods.
336
337 FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(
338 FlutterDesktopPluginRegistrarRef registrar) {
339 return registrar->engine->messenger();
340 }
341
342 void FlutterDesktopPluginRegistrarSetDestructionHandler(
343 FlutterDesktopPluginRegistrarRef registrar,
344 FlutterDesktopOnPluginRegistrarDestroyed callback) {
345 registrar->engine->AddPluginRegistrarDestructionCallback(callback, registrar);
346 }
347
348 bool FlutterDesktopMessengerSendWithReply(FlutterDesktopMessengerRef messenger,
349 const char* channel,
350 const uint8_t* message,
351 const size_t message_size,
352 const FlutterDesktopBinaryReply reply,
353 void* user_data) {
354 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
355 << "Messenger must reference a running engine to send a message";
356
357 return flutter::FlutterDesktopMessenger::FromRef(messenger)
358 ->GetEngine()
359 ->SendPlatformMessage(channel, message, message_size, reply, user_data);
360 }
361
362 bool FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger,
363 const char* channel,
364 const uint8_t* message,
365 const size_t message_size) {
366 return FlutterDesktopMessengerSendWithReply(messenger, channel, message,
367 message_size, nullptr, nullptr);
368 }
369
370 void FlutterDesktopMessengerSendResponse(
371 FlutterDesktopMessengerRef messenger,
372 const FlutterDesktopMessageResponseHandle* handle,
373 const uint8_t* data,
374 size_t data_length) {
375 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
376 << "Messenger must reference a running engine to send a response";
377
378 flutter::FlutterDesktopMessenger::FromRef(messenger)
379 ->GetEngine()
380 ->SendPlatformMessageResponse(handle, data, data_length);
381 }
382
383 void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger,
384 const char* channel,
385 FlutterDesktopMessageCallback callback,
386 void* user_data) {
387 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
388 << "Messenger must reference a running engine to set a callback";
389
390 flutter::FlutterDesktopMessenger::FromRef(messenger)
391 ->GetEngine()
392 ->message_dispatcher()
393 ->SetMessageCallback(channel, callback, user_data);
394 }
395
396 FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(
397 FlutterDesktopMessengerRef messenger) {
398 return flutter::FlutterDesktopMessenger::FromRef(messenger)
399 ->AddRef()
400 ->ToRef();
401 }
402
403 void FlutterDesktopMessengerRelease(FlutterDesktopMessengerRef messenger) {
404 flutter::FlutterDesktopMessenger::FromRef(messenger)->Release();
405 }
406
407 bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger) {
408 return flutter::FlutterDesktopMessenger::FromRef(messenger)->GetEngine() !=
409 nullptr;
410 }
411
412 FlutterDesktopMessengerRef FlutterDesktopMessengerLock(
413 FlutterDesktopMessengerRef messenger) {
414 flutter::FlutterDesktopMessenger::FromRef(messenger)->GetMutex().lock();
415 return messenger;
416 }
417
418 void FlutterDesktopMessengerUnlock(FlutterDesktopMessengerRef messenger) {
419 flutter::FlutterDesktopMessenger::FromRef(messenger)->GetMutex().unlock();
420 }
421
422 FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar(
423 FlutterDesktopPluginRegistrarRef registrar) {
424 return HandleForTextureRegistrar(registrar->engine->texture_registrar());
425 }
426
427 int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(
428 FlutterDesktopTextureRegistrarRef texture_registrar,
429 const FlutterDesktopTextureInfo* texture_info) {
430 return TextureRegistrarFromHandle(texture_registrar)
431 ->RegisterTexture(texture_info);
432 }
433
434 void FlutterDesktopTextureRegistrarUnregisterExternalTexture(
435 FlutterDesktopTextureRegistrarRef texture_registrar,
436 int64_t texture_id,
437 void (*callback)(void* user_data),
438 void* user_data) {
439 auto registrar = TextureRegistrarFromHandle(texture_registrar);
440 if (callback) {
441 registrar->UnregisterTexture(
442 texture_id, [callback, user_data]() { callback(user_data); });
443 return;
444 }
445 registrar->UnregisterTexture(texture_id);
446 }
447
448 bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(
449 FlutterDesktopTextureRegistrarRef texture_registrar,
450 int64_t texture_id) {
451 return TextureRegistrarFromHandle(texture_registrar)
452 ->MarkTextureFrameAvailable(texture_id);
453 }
FlutterDesktopViewControllerProperties::height
int height
Definition: flutter_windows_internal.h:23
flutter::kImplicitViewId
constexpr FlutterViewId kImplicitViewId
Definition: flutter_windows_engine.h:55
FlutterDesktopViewControllerHandleTopLevelWindowProc
bool FlutterDesktopViewControllerHandleTopLevelWindowProc(FlutterDesktopViewControllerRef ref, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
Definition: flutter_windows.cc:165
flutter::FlutterWindowsEngine::GetRegistrar
FlutterDesktopPluginRegistrarRef GetRegistrar()
Definition: flutter_windows_engine.cc:668
TextureRegistrarFromHandle
static flutter::FlutterWindowsTextureRegistrar * TextureRegistrarFromHandle(FlutterDesktopTextureRegistrarRef ref)
Definition: flutter_windows.cc:64
flutter::FlutterProjectBundle
Definition: flutter_project_bundle.h:21
FlutterDesktopViewGetHWND
HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef view)
Definition: flutter_windows.cc:246
FlutterDesktopViewControllerGetView
FlutterDesktopViewRef FlutterDesktopViewControllerGetView(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:153
FlutterDesktopEngineGetTextureRegistrar
FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:233
FlutterDesktopPluginRegistrarGetView
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:290
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view(FlutterViewId view_id) const
Definition: flutter_windows_engine.cc:656
FlutterDesktopEngineGetMessenger
FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:228
FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
Definition: flutter_windows.cc:301
flutter::FlutterWindowsView
Definition: flutter_windows_view.h:34
HandleForView
static FlutterDesktopViewRef HandleForView(flutter::FlutterWindowsView *view)
Definition: flutter_windows.cc:59
FlutterDesktopEngineProperties
Definition: flutter_windows.h:39
plugin_registrar.h
FlutterDesktopMessengerUnlock
void FlutterDesktopMessengerUnlock(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:418
CreateViewController
static FlutterDesktopViewControllerRef CreateViewController(FlutterDesktopEngineRef engine_ref, int width, int height, bool owns_engine)
Definition: flutter_windows.cc:79
FlutterDesktopMessengerSend
bool FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger, const char *channel, const uint8_t *message, const size_t message_size)
Definition: flutter_windows.cc:362
FlutterDesktopBinaryReply
void(* FlutterDesktopBinaryReply)(const uint8_t *data, size_t data_size, void *user_data)
Definition: flutter_messenger.h:26
FlutterDesktopViewId
int64_t FlutterDesktopViewId
Definition: flutter_windows.h:36
HandleForTextureRegistrar
static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar(flutter::FlutterWindowsTextureRegistrar *registrar)
Definition: flutter_windows.cc:70
flutter::FlutterWindowsEngine::SetNextFrameCallback
void SetNextFrameCallback(fml::closure callback)
Definition: flutter_windows_engine.cc:762
flutter::GetDpiForMonitor
UINT GetDpiForMonitor(HMONITOR monitor)
Definition: dpi_utils.cc:134
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:53
flutter::FlutterWindowsTextureRegistrar::MarkTextureFrameAvailable
bool MarkTextureFrameAvailable(int64_t texture_id)
Definition: flutter_windows_texture_registrar.cc:103
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:90
flutter::FlutterWindowsEngine::window_proc_delegate_manager
WindowProcDelegateManager * window_proc_delegate_manager()
Definition: flutter_windows_engine.h:167
flutter::FlutterWindowsEngine::running
virtual bool running() const
Definition: flutter_windows_engine.h:117
FlutterDesktopEngineRegisterPlatformViewType
void FlutterDesktopEngineRegisterPlatformViewType(FlutterDesktopEngineRef engine, const char *view_type_name, FlutterPlatformViewTypeEntry view_type)
Definition: flutter_windows.cc:282
FlutterDesktopViewControllerProperties
Definition: flutter_windows_internal.h:18
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:266
FlutterDesktopPluginRegistrarSetDestructionHandler
void FlutterDesktopPluginRegistrarSetDestructionHandler(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopOnPluginRegistrarDestroyed callback)
Definition: flutter_windows.cc:342
FlutterDesktopEngineGetPluginRegistrar
FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(FlutterDesktopEngineRef engine, const char *plugin_name)
Definition: flutter_windows.cc:218
flutter::GetDpiForHWND
UINT GetDpiForHWND(HWND hwnd)
Definition: dpi_utils.cc:130
flutter::FlutterWindowsEngine::windows_proc_table
std::shared_ptr< WindowsProcTable > windows_proc_table()
Definition: flutter_windows_engine.h:297
EngineFromHandle
static flutter::FlutterWindowsEngine * EngineFromHandle(FlutterDesktopEngineRef ref)
Definition: flutter_windows.cc:32
FlutterDesktopPluginRegistrarGetMessenger
FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:337
flutter::FlutterDesktopMessenger::ToRef
FlutterDesktopMessengerRef ToRef()
Convert to FlutterDesktopMessengerRef.
Definition: flutter_desktop_messenger.h:28
flutter::FlutterWindowsView::GetWindowHandle
virtual HWND GetWindowHandle() const
Definition: flutter_windows_view.cc:758
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:699
FlutterDesktopResyncOutputStreams
void FlutterDesktopResyncOutputStreams()
Definition: flutter_windows.cc:324
FlutterDesktopViewControllerGetViewId
FlutterDesktopViewId FlutterDesktopViewControllerGetViewId(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:141
flutter::FlutterWindowsEngine::Stop
virtual bool Stop()
Definition: flutter_windows_engine.cc:482
flutter::FlutterWindowsEngine::messenger
FlutterDesktopMessengerRef messenger()
Definition: flutter_windows_engine.h:149
HandleForViewController
static FlutterDesktopViewControllerRef HandleForViewController(flutter::FlutterWindowsViewController *view_controller)
Definition: flutter_windows.cc:48
flutter::FlutterWindowsEngine::ProcessExternalWindowMessage
std::optional< LRESULT > ProcessExternalWindowMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: flutter_windows_engine.cc:966
FlutterPlatformViewTypeEntry
Definition: flutter_windows_internal.h:57
path_utils.h
FlutterDesktopMessengerLock
FlutterDesktopMessengerRef FlutterDesktopMessengerLock(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:412
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::FlutterWindowsTextureRegistrar
Definition: flutter_windows_texture_registrar.h:24
flutter_window.h
flutter::FlutterWindowsEngine::CreateView
std::unique_ptr< FlutterWindowsView > CreateView(std::unique_ptr< WindowBindingHandler > window)
Definition: flutter_windows_engine.cc:495
flutter::FlutterWindowsEngine::texture_registrar
FlutterWindowsTextureRegistrar * texture_registrar()
Definition: flutter_windows_engine.h:159
flutter::FlutterWindowsViewController
Controls a view that displays Flutter content.
Definition: flutter_windows_view_controller.h:17
FlutterDesktopRegistrarGetTextureRegistrar
FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:422
flutter::FlutterWindowsEngine::AddPluginRegistrarDestructionCallback
void AddPluginRegistrarDestructionCallback(FlutterDesktopOnPluginRegistrarDestroyed callback, FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows_engine.cc:672
FlutterDesktopTextureRegistrarRef
struct FlutterDesktopTextureRegistrar * FlutterDesktopTextureRegistrarRef
Definition: flutter_texture_registrar.h:19
FlutterDesktopGetDpiForMonitor
UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor)
Definition: flutter_windows.cc:320
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:210
window_state.h
FlutterDesktopViewControllerRef
struct FlutterDesktopViewController * FlutterDesktopViewControllerRef
Definition: flutter_windows.h:25
FlutterDesktopPluginRegistrar::engine
flutter::FlutterWindowsEngine * engine
Definition: window_state.h:25
FlutterDesktopTextureRegistrarUnregisterExternalTexture
void FlutterDesktopTextureRegistrarUnregisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id, void(*callback)(void *user_data), void *user_data)
Definition: flutter_windows.cc:434
flutter::FlutterWindowsEngine::SendPlatformMessageResponse
void SendPlatformMessageResponse(const FlutterDesktopMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
Definition: flutter_windows_engine.cc:733
flutter_windows_view_controller.h
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:121
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:309
FlutterDesktopOnPluginRegistrarDestroyed
void(* FlutterDesktopOnPluginRegistrarDestroyed)(FlutterDesktopPluginRegistrarRef)
Definition: flutter_plugin_registrar.h:23
FlutterDesktopViewControllerForceRedraw
void FlutterDesktopViewControllerForceRedraw(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:159
flutter::WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback)
Definition: window_proc_delegate_manager.cc:27
flutter::FlutterWindowsEngine::message_dispatcher
IncomingMessageDispatcher * message_dispatcher()
Definition: flutter_windows_engine.h:151
flutter::FlutterDesktopMessenger::AddRef
FlutterDesktopMessenger * AddRef()
Definition: flutter_desktop_messenger.h:50
flutter::FlutterWindowsView::GetEngine
FlutterWindowsEngine * GetEngine() const
Definition: flutter_windows_view.cc:762
FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable
bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id)
Definition: flutter_windows.cc:448
FlutterDesktopEngineDestroy
bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref)
Definition: flutter_windows.cc:190
flutter_windows_engine.h
FlutterDesktopEngineCreate
FlutterDesktopEngineRef FlutterDesktopEngineCreate(const FlutterDesktopEngineProperties *engine_properties)
Definition: flutter_windows.cc:183
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:370
FlutterDesktopMessengerIsAvailable
bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:407
FlutterDesktopViewControllerGetEngine
FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:147
HandleForEngine
static FlutterDesktopEngineRef HandleForEngine(flutter::FlutterWindowsEngine *engine)
Definition: flutter_windows.cc:38
ViewFromHandle
static flutter::FlutterWindowsView * ViewFromHandle(FlutterDesktopViewRef ref)
Definition: flutter_windows.cc:54
ViewControllerFromHandle
static flutter::FlutterWindowsViewController * ViewControllerFromHandle(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:43
VoidCallback
void(* VoidCallback)(void *)
Definition: flutter_windows.h:21
flutter_windows.h
message
Win32Message message
Definition: keyboard_unittests.cc:137
FlutterDesktopViewControllerDestroy
void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:135
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:239
FlutterDesktopEngineCreateViewController
FlutterDesktopViewControllerRef FlutterDesktopEngineCreateViewController(FlutterDesktopEngineRef engine, const FlutterDesktopViewControllerProperties *properties)
Definition: flutter_windows.cc:128
FlutterDesktopViewControllerProperties::width
int width
Definition: flutter_windows_internal.h:20
incoming_message_dispatcher.h
FlutterDesktopMessengerRelease
void FlutterDesktopMessengerRelease(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:403
FlutterDesktopTextureRegistrarRegisterExternalTexture
int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, const FlutterDesktopTextureInfo *texture_info)
Definition: flutter_windows.cc:427
FlutterDesktopMessengerSetCallback
void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger, const char *channel, FlutterDesktopMessageCallback callback, void *user_data)
Definition: flutter_windows.cc:383
FlutterDesktopViewGetGraphicsAdapter
IDXGIAdapter * FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view)
Definition: flutter_windows.cc:250
flutter::FlutterWindowsEngine::egl_manager
egl::Manager * egl_manager() const
Definition: flutter_windows_engine.h:165
FlutterDesktopMessageCallback
void(* FlutterDesktopMessageCallback)(FlutterDesktopMessengerRef, const FlutterDesktopMessage *, void *)
Definition: flutter_messenger.h:49
FlutterDesktopGetDpiForHWND
UINT FlutterDesktopGetDpiForHWND(HWND hwnd)
Definition: flutter_windows.cc:316
FlutterDesktopPluginRegistrar
Definition: window_state.h:23
FlutterDesktopEngineRun
bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine, const char *entry_point)
Definition: flutter_windows.cc:200
flutter::FlutterWindowsEngine::Run
bool Run()
Definition: flutter_windows_engine.cc:239
texture_id
uint32_t texture_id
Definition: compositor_opengl.cc:20
FlutterDesktopPluginRegistrarGetViewById
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopViewId view_id)
Definition: flutter_windows.cc:295
FlutterDesktopWindowProcCallback
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
Definition: flutter_windows.h:245
flutter::WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback, void *user_data)
Definition: window_proc_delegate_manager.cc:16
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:348
flutter::FlutterWindowsEngine::ReloadSystemFonts
void ReloadSystemFonts()
Definition: flutter_windows_engine.cc:754
FlutterDesktopEngineReloadSystemFonts
void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:214
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:52
FlutterDesktopMessengerAddRef
FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:396