| 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 FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(
76 int width,
77 int height,
78 FlutterDesktopEngineRef engine_ref) {
79 flutter::FlutterWindowsEngine* engine_ptr = EngineFromHandle(engine_ref);
80 std::unique_ptr<flutter::WindowBindingHandler> window_wrapper =
81 std::make_unique<flutter::FlutterWindow>(
82 width, height, engine_ptr->windows_proc_table());
83
84 auto engine = std::unique_ptr<flutter::FlutterWindowsEngine>(engine_ptr);
85 auto view = std::make_unique<flutter::FlutterWindowsView>(
86 std::move(window_wrapper), engine_ptr->windows_proc_table());
87 auto controller = std::make_unique<flutter::FlutterWindowsViewController>(
88 std::move(engine), std::move(view));
89
90 controller->view()->SetEngine(controller->engine());
91 controller->view()->CreateRenderSurface();
92 if (!controller->engine()->running()) {
93 if (!controller->engine()->Run()) {
94 return nullptr;
95 }
96 }
97
98 // Must happen after engine is running.
99 controller->view()->SendInitialBounds();
100
101 // The Windows embedder listens to accessibility updates using the
102 // view's HWND. The embedder's accessibility features may be stale if
103 // the app was in headless mode.
104 controller->engine()->UpdateAccessibilityFeatures();
105
106 return HandleForViewController(controller.release());
107 }
108
109 void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef ref) {
110 auto controller = ViewControllerFromHandle(ref);
111 delete controller;
112 }
113
114 FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(
115 FlutterDesktopViewControllerRef ref) {
116 auto controller = ViewControllerFromHandle(ref);
117 return HandleForEngine(controller->engine());
118 }
119
120 FlutterDesktopViewRef FlutterDesktopViewControllerGetView(
121 FlutterDesktopViewControllerRef ref) {
122 auto controller = ViewControllerFromHandle(ref);
123 return HandleForView(controller->view());
124 }
125
126 void FlutterDesktopViewControllerForceRedraw(
127 FlutterDesktopViewControllerRef ref) {
128 auto controller = ViewControllerFromHandle(ref);
129 controller->view()->ForceRedraw();
130 }
131
132 bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
133 FlutterDesktopViewControllerRef ref,
134 HWND hwnd,
135 UINT message,
136 WPARAM wparam,
137 LPARAM lparam,
138 LRESULT* result) {
139 auto controller = ViewControllerFromHandle(ref);
140 std::optional<LRESULT> delegate_result =
141 controller->engine()
142 ->window_proc_delegate_manager()
143 ->OnTopLevelWindowProc(hwnd, message, wparam, lparam);
144 if (delegate_result) {
145 *result = *delegate_result;
146 }
147 return delegate_result.has_value();
148 }
149
150 FlutterDesktopEngineRef FlutterDesktopEngineCreate(
151 const FlutterDesktopEngineProperties* engine_properties) {
152 flutter::FlutterProjectBundle project(*engine_properties);
153 auto engine = std::make_unique<flutter::FlutterWindowsEngine>(project);
154 return HandleForEngine(engine.release());
155 }
156
157 bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref) {
158 flutter::FlutterWindowsEngine* engine = EngineFromHandle(engine_ref);
159 bool result = true;
160 if (engine->running()) {
161 result = engine->Stop();
162 }
163 delete engine;
164 return result;
165 }
166
167 bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine,
168 const char* entry_point) {
169 std::string_view entry_point_view{""};
170 if (entry_point != nullptr) {
171 entry_point_view = entry_point;
172 }
173
174 return EngineFromHandle(engine)->Run(entry_point_view);
175 }
176
177 uint64_t FlutterDesktopEngineProcessMessages(FlutterDesktopEngineRef engine) {
178 return std::chrono::nanoseconds::max().count();
179 }
180
181 void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine) {
182 EngineFromHandle(engine)->ReloadSystemFonts();
183 }
184
185 FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(
186 FlutterDesktopEngineRef engine,
187 const char* plugin_name) {
188 // Currently, one registrar acts as the registrar for all plugins, so the
189 // name is ignored. It is part of the API to reduce churn in the future when
190 // aligning more closely with the Flutter registrar system.
191
192 return EngineFromHandle(engine)->GetRegistrar();
193 }
194
195 FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(
196 FlutterDesktopEngineRef engine) {
197 return EngineFromHandle(engine)->messenger();
198 }
199
200 FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(
201 FlutterDesktopEngineRef engine) {
202 return HandleForTextureRegistrar(
203 EngineFromHandle(engine)->texture_registrar());
204 }
205
206 void FlutterDesktopEngineSetNextFrameCallback(FlutterDesktopEngineRef engine,
207 VoidCallback callback,
208 void* user_data) {
209 EngineFromHandle(engine)->SetNextFrameCallback(
210 [callback, user_data]() { callback(user_data); });
211 }
212
213 HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef view) {
214 return ViewFromHandle(view)->GetWindowHandle();
215 }
216
217 IDXGIAdapter* FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view) {
218 auto surface_manager = ViewFromHandle(view)->GetEngine()->surface_manager();
219 if (surface_manager) {
220 Microsoft::WRL::ComPtr<ID3D11Device> d3d_device;
221 Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device;
222 if (surface_manager->GetDevice(d3d_device.GetAddressOf()) &&
223 SUCCEEDED(d3d_device.As(&dxgi_device))) {
224 IDXGIAdapter* adapter;
225 if (SUCCEEDED(dxgi_device->GetAdapter(&adapter))) {
226 return adapter;
227 }
228 }
229 }
230 return nullptr;
231 }
232
233 bool FlutterDesktopEngineProcessExternalWindowMessage(
234 FlutterDesktopEngineRef engine,
235 HWND hwnd,
236 UINT message,
237 WPARAM wparam,
238 LPARAM lparam,
239 LRESULT* result) {
240 std::optional<LRESULT> lresult =
241 EngineFromHandle(engine)->ProcessExternalWindowMessage(hwnd, message,
242 wparam, lparam);
243 if (result && lresult.has_value()) {
244 *result = lresult.value();
245 }
246 return lresult.has_value();
247 }
248
249 FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(
250 FlutterDesktopPluginRegistrarRef registrar) {
251 return HandleForView(registrar->engine->view());
252 }
253
254 void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(
255 FlutterDesktopPluginRegistrarRef registrar,
256 FlutterDesktopWindowProcCallback delegate,
257 void* user_data) {
258 registrar->engine->window_proc_delegate_manager()
259 ->RegisterTopLevelWindowProcDelegate(delegate, user_data);
260 }
261
262 void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(
263 FlutterDesktopPluginRegistrarRef registrar,
264 FlutterDesktopWindowProcCallback delegate) {
265 registrar->engine->window_proc_delegate_manager()
266 ->UnregisterTopLevelWindowProcDelegate(delegate);
267 }
268
269 UINT FlutterDesktopGetDpiForHWND(HWND hwnd) {
270 return flutter::GetDpiForHWND(hwnd);
271 }
272
273 UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor) {
274 return flutter::GetDpiForMonitor(monitor);
275 }
276
277 void FlutterDesktopResyncOutputStreams() {
278 FILE* unused;
279 if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
280 _dup2(_fileno(stdout), 1);
281 }
282 if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
283 _dup2(_fileno(stdout), 2);
284 }
285 std::ios::sync_with_stdio();
286 }
287
288 // Implementations of common/ API methods.
289
290 FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(
291 FlutterDesktopPluginRegistrarRef registrar) {
292 return registrar->engine->messenger();
293 }
294
295 void FlutterDesktopPluginRegistrarSetDestructionHandler(
296 FlutterDesktopPluginRegistrarRef registrar,
297 FlutterDesktopOnPluginRegistrarDestroyed callback) {
298 registrar->engine->AddPluginRegistrarDestructionCallback(callback, registrar);
299 }
300
301 bool FlutterDesktopMessengerSendWithReply(FlutterDesktopMessengerRef messenger,
302 const char* channel,
303 const uint8_t* message,
304 const size_t message_size,
305 const FlutterDesktopBinaryReply reply,
306 void* user_data) {
307 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
308 << "Messenger must reference a running engine to send a message";
309
310 return flutter::FlutterDesktopMessenger::FromRef(messenger)
311 ->GetEngine()
312 ->SendPlatformMessage(channel, message, message_size, reply, user_data);
313 }
314
315 bool FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger,
316 const char* channel,
317 const uint8_t* message,
318 const size_t message_size) {
319 return FlutterDesktopMessengerSendWithReply(messenger, channel, message,
320 message_size, nullptr, nullptr);
321 }
322
323 void FlutterDesktopMessengerSendResponse(
324 FlutterDesktopMessengerRef messenger,
325 const FlutterDesktopMessageResponseHandle* handle,
326 const uint8_t* data,
327 size_t data_length) {
328 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
329 << "Messenger must reference a running engine to send a response";
330
331 flutter::FlutterDesktopMessenger::FromRef(messenger)
332 ->GetEngine()
333 ->SendPlatformMessageResponse(handle, data, data_length);
334 }
335
336 void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger,
337 const char* channel,
338 FlutterDesktopMessageCallback callback,
339 void* user_data) {
340 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
341 << "Messenger must reference a running engine to set a callback";
342
343 flutter::FlutterDesktopMessenger::FromRef(messenger)
344 ->GetEngine()
345 ->message_dispatcher()
346 ->SetMessageCallback(channel, callback, user_data);
347 }
348
349 FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(
350 FlutterDesktopMessengerRef messenger) {
351 return flutter::FlutterDesktopMessenger::FromRef(messenger)
352 ->AddRef()
353 ->ToRef();
354 }
355
356 void FlutterDesktopMessengerRelease(FlutterDesktopMessengerRef messenger) {
357 flutter::FlutterDesktopMessenger::FromRef(messenger)->Release();
358 }
359
360 bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger) {
361 return flutter::FlutterDesktopMessenger::FromRef(messenger)->GetEngine() !=
362 nullptr;
363 }
364
365 FlutterDesktopMessengerRef FlutterDesktopMessengerLock(
366 FlutterDesktopMessengerRef messenger) {
367 flutter::FlutterDesktopMessenger::FromRef(messenger)->GetMutex().lock();
368 return messenger;
369 }
370
371 void FlutterDesktopMessengerUnlock(FlutterDesktopMessengerRef messenger) {
372 flutter::FlutterDesktopMessenger::FromRef(messenger)->GetMutex().unlock();
373 }
374
375 FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar(
376 FlutterDesktopPluginRegistrarRef registrar) {
377 return HandleForTextureRegistrar(registrar->engine->texture_registrar());
378 }
379
380 int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(
381 FlutterDesktopTextureRegistrarRef texture_registrar,
382 const FlutterDesktopTextureInfo* texture_info) {
383 return TextureRegistrarFromHandle(texture_registrar)
384 ->RegisterTexture(texture_info);
385 }
386
387 void FlutterDesktopTextureRegistrarUnregisterExternalTexture(
388 FlutterDesktopTextureRegistrarRef texture_registrar,
389 int64_t texture_id,
390 void (*callback)(void* user_data),
391 void* user_data) {
392 auto registrar = TextureRegistrarFromHandle(texture_registrar);
393 if (callback) {
394 registrar->UnregisterTexture(
395 texture_id, [callback, user_data]() { callback(user_data); });
396 return;
397 }
398 registrar->UnregisterTexture(texture_id);
399 }
400
401 bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(
402 FlutterDesktopTextureRegistrarRef texture_registrar,
403 int64_t texture_id) {
404 return TextureRegistrarFromHandle(texture_registrar)
405 ->MarkTextureFrameAvailable(texture_id);
406 }
FlutterDesktopViewControllerHandleTopLevelWindowProc
bool FlutterDesktopViewControllerHandleTopLevelWindowProc(FlutterDesktopViewControllerRef ref, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
Definition: flutter_windows.cc:132
flutter::FlutterWindowsEngine::GetRegistrar
FlutterDesktopPluginRegistrarRef GetRegistrar()
Definition: flutter_windows_engine.cc:497
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:213
FlutterDesktopViewControllerGetView
FlutterDesktopViewRef FlutterDesktopViewControllerGetView(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:120
FlutterDesktopEngineGetTextureRegistrar
FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:200
FlutterDesktopPluginRegistrarGetView
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:249
FlutterDesktopEngineGetMessenger
FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:195
FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
Definition: flutter_windows.cc:254
flutter::FlutterWindowsView
Definition: flutter_windows_view.h:35
HandleForView
static FlutterDesktopViewRef HandleForView(flutter::FlutterWindowsView *view)
Definition: flutter_windows.cc:59
FlutterDesktopEngineProperties
Definition: flutter_windows.h:36
plugin_registrar.h
FlutterDesktopMessengerUnlock
void FlutterDesktopMessengerUnlock(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:371
FlutterDesktopMessengerSend
bool FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger, const char *channel, const uint8_t *message, const size_t message_size)
Definition: flutter_windows.cc:315
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:70
flutter::FlutterWindowsEngine::SetNextFrameCallback
void SetNextFrameCallback(fml::closure callback)
Definition: flutter_windows_engine.cc:591
flutter::GetDpiForMonitor
UINT GetDpiForMonitor(HMONITOR monitor)
Definition: dpi_utils.cc:134
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:49
flutter::FlutterWindowsTextureRegistrar::MarkTextureFrameAvailable
bool MarkTextureFrameAvailable(int64_t texture_id)
Definition: flutter_windows_texture_registrar.cc:103
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:78
flutter::FlutterWindowsEngine::window_proc_delegate_manager
WindowProcDelegateManager * window_proc_delegate_manager()
Definition: flutter_windows_engine.h:148
flutter::FlutterWindowsEngine::running
virtual bool running() const
Definition: flutter_windows_engine.h:105
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:233
FlutterDesktopPluginRegistrarSetDestructionHandler
void FlutterDesktopPluginRegistrarSetDestructionHandler(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopOnPluginRegistrarDestroyed callback)
Definition: flutter_windows.cc:295
FlutterDesktopEngineGetPluginRegistrar
FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(FlutterDesktopEngineRef engine, const char *plugin_name)
Definition: flutter_windows.cc:185
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:278
EngineFromHandle
static flutter::FlutterWindowsEngine * EngineFromHandle(FlutterDesktopEngineRef ref)
Definition: flutter_windows.cc:32
FlutterDesktopPluginRegistrarGetMessenger
FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:290
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:645
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:528
FlutterDesktopResyncOutputStreams
void FlutterDesktopResyncOutputStreams()
Definition: flutter_windows.cc:277
flutter::FlutterWindowsEngine::Stop
virtual bool Stop()
Definition: flutter_windows_engine.cc:450
flutter::FlutterWindowsEngine::messenger
FlutterDesktopMessengerRef messenger()
Definition: flutter_windows_engine.h:130
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:814
path_utils.h
FlutterDesktopMessengerLock
FlutterDesktopMessengerRef FlutterDesktopMessengerLock(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:365
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:24
flutter_window.h
flutter::FlutterWindowsEngine::texture_registrar
FlutterWindowsTextureRegistrar * texture_registrar()
Definition: flutter_windows_engine.h:138
flutter::FlutterWindowsViewController
Controls a view that displays Flutter content.
Definition: flutter_windows_view_controller.h:16
FlutterDesktopRegistrarGetTextureRegistrar
FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:375
flutter::FlutterWindowsEngine::AddPluginRegistrarDestructionCallback
void AddPluginRegistrarDestructionCallback(FlutterDesktopOnPluginRegistrarDestroyed callback, FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows_engine.cc:501
FlutterDesktopTextureRegistrarRef
struct FlutterDesktopTextureRegistrar * FlutterDesktopTextureRegistrarRef
Definition: flutter_texture_registrar.h:19
FlutterDesktopGetDpiForMonitor
UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor)
Definition: flutter_windows.cc:273
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:177
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:387
flutter::FlutterWindowsEngine::SendPlatformMessageResponse
void SendPlatformMessageResponse(const FlutterDesktopMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
Definition: flutter_windows_engine.cc:562
flutter_windows_view_controller.h
flutter::FlutterDesktopMessenger::GetEngine
flutter::FlutterWindowsEngine * GetEngine() const
Getter for the engine field.
Definition: flutter_desktop_messenger.h:38
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:262
FlutterDesktopOnPluginRegistrarDestroyed
void(* FlutterDesktopOnPluginRegistrarDestroyed)(FlutterDesktopPluginRegistrarRef)
Definition: flutter_plugin_registrar.h:23
FlutterDesktopViewControllerForceRedraw
void FlutterDesktopViewControllerForceRedraw(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:126
flutter::FlutterWindowsEngine::surface_manager
AngleSurfaceManager * surface_manager() const
Definition: flutter_windows_engine.h:144
flutter::FlutterWindowsEngine::message_dispatcher
IncomingMessageDispatcher * message_dispatcher()
Definition: flutter_windows_engine.h:132
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:401
FlutterDesktopEngineDestroy
bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref)
Definition: flutter_windows.cc:157
flutter_windows_engine.h
FlutterDesktopEngineCreate
FlutterDesktopEngineRef FlutterDesktopEngineCreate(const FlutterDesktopEngineProperties *engine_properties)
Definition: flutter_windows.cc:150
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:323
FlutterDesktopMessengerIsAvailable
bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:360
FlutterDesktopViewControllerGetEngine
FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:114
HandleForEngine
static FlutterDesktopEngineRef HandleForEngine(flutter::FlutterWindowsEngine *engine)
Definition: flutter_windows.cc:38
ViewFromHandle
static flutter::FlutterWindowsView * ViewFromHandle(FlutterDesktopViewRef ref)
Definition: flutter_windows.cc:54
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view()
Definition: flutter_windows_engine.h:117
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:109
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:206
incoming_message_dispatcher.h
FlutterDesktopMessengerRelease
void FlutterDesktopMessengerRelease(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:356
FlutterDesktopTextureRegistrarRegisterExternalTexture
int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, const FlutterDesktopTextureInfo *texture_info)
Definition: flutter_windows.cc:380
FlutterDesktopMessengerSetCallback
void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger, const char *channel, FlutterDesktopMessageCallback callback, void *user_data)
Definition: flutter_windows.cc:336
FlutterDesktopViewGetGraphicsAdapter
IDXGIAdapter * FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view)
Definition: flutter_windows.cc:217
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:269
FlutterDesktopPluginRegistrar
Definition: window_state.h:23
FlutterDesktopEngineRun
bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine, const char *entry_point)
Definition: flutter_windows.cc:167
flutter::FlutterWindowsEngine::Run
bool Run()
Definition: flutter_windows_engine.cc:254
flutter::FlutterWindowsView::GetEngine
FlutterWindowsEngine * GetEngine()
Definition: flutter_windows_view.cc:649
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:301
FlutterDesktopViewControllerCreate
FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(int width, int height, FlutterDesktopEngineRef engine_ref)
Definition: flutter_windows.cc:75
flutter::FlutterWindowsEngine::ReloadSystemFonts
void ReloadSystemFonts()
Definition: flutter_windows_engine.cc:583
FlutterDesktopEngineReloadSystemFonts
void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:181
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:48
FlutterDesktopMessengerAddRef
FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:349