| 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 auto controller = std::make_unique<flutter::FlutterWindowsViewController>(
97 std::move(engine), std::move(view));
98
99 controller->view()->CreateRenderSurface();
100 if (!controller->engine()->running()) {
101 if (!controller->engine()->Run()) {
102 return nullptr;
103 }
104 }
105
106 // Must happen after engine is running.
107 controller->view()->SendInitialBounds();
108
109 // The Windows embedder listens to accessibility updates using the
110 // view's HWND. The embedder's accessibility features may be stale if
111 // the app was in headless mode.
112 controller->engine()->UpdateAccessibilityFeatures();
113
114 return HandleForViewController(controller.release());
115 }
116
117 FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(
118 int width,
119 int height,
120 FlutterDesktopEngineRef engine) {
121 return CreateViewController(engine, width, height, /*owns_engine=*/true);
122 }
123
124 FlutterDesktopViewControllerRef FlutterDesktopEngineCreateViewController(
125 FlutterDesktopEngineRef engine,
126 const FlutterDesktopViewControllerProperties* properties) {
127 return CreateViewController(engine, properties->width, properties->height,
128 /*owns_engine=*/false);
129 }
130
131 void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef ref) {
132 auto controller = ViewControllerFromHandle(ref);
133 delete controller;
134 }
135
136 FlutterDesktopViewId FlutterDesktopViewControllerGetViewId(
137 FlutterDesktopViewControllerRef ref) {
138 auto controller = ViewControllerFromHandle(ref);
139 return static_cast<FlutterDesktopViewId>(controller->view()->view_id());
140 }
141
142 FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(
143 FlutterDesktopViewControllerRef ref) {
144 auto controller = ViewControllerFromHandle(ref);
145 return HandleForEngine(controller->engine());
146 }
147
148 FlutterDesktopViewRef FlutterDesktopViewControllerGetView(
149 FlutterDesktopViewControllerRef ref) {
150 auto controller = ViewControllerFromHandle(ref);
151 return HandleForView(controller->view());
152 }
153
154 void FlutterDesktopViewControllerForceRedraw(
155 FlutterDesktopViewControllerRef ref) {
156 auto controller = ViewControllerFromHandle(ref);
157 controller->view()->ForceRedraw();
158 }
159
160 bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
161 FlutterDesktopViewControllerRef ref,
162 HWND hwnd,
163 UINT message,
164 WPARAM wparam,
165 LPARAM lparam,
166 LRESULT* result) {
167 auto controller = ViewControllerFromHandle(ref);
168 std::optional<LRESULT> delegate_result =
169 controller->engine()
170 ->window_proc_delegate_manager()
171 ->OnTopLevelWindowProc(hwnd, message, wparam, lparam);
172 if (delegate_result) {
173 *result = *delegate_result;
174 }
175 return delegate_result.has_value();
176 }
177
178 FlutterDesktopEngineRef FlutterDesktopEngineCreate(
179 const FlutterDesktopEngineProperties* engine_properties) {
180 flutter::FlutterProjectBundle project(*engine_properties);
181 auto engine = std::make_unique<flutter::FlutterWindowsEngine>(project);
182 return HandleForEngine(engine.release());
183 }
184
185 bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref) {
186 flutter::FlutterWindowsEngine* engine = EngineFromHandle(engine_ref);
187 bool result = true;
188 if (engine->running()) {
189 result = engine->Stop();
190 }
191 delete engine;
192 return result;
193 }
194
195 bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine,
196 const char* entry_point) {
197 std::string_view entry_point_view{""};
198 if (entry_point != nullptr) {
199 entry_point_view = entry_point;
200 }
201
202 return EngineFromHandle(engine)->Run(entry_point_view);
203 }
204
205 uint64_t FlutterDesktopEngineProcessMessages(FlutterDesktopEngineRef engine) {
206 return std::chrono::nanoseconds::max().count();
207 }
208
209 void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine) {
210 EngineFromHandle(engine)->ReloadSystemFonts();
211 }
212
213 FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(
214 FlutterDesktopEngineRef engine,
215 const char* plugin_name) {
216 // Currently, one registrar acts as the registrar for all plugins, so the
217 // name is ignored. It is part of the API to reduce churn in the future when
218 // aligning more closely with the Flutter registrar system.
219
220 return EngineFromHandle(engine)->GetRegistrar();
221 }
222
223 FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(
224 FlutterDesktopEngineRef engine) {
225 return EngineFromHandle(engine)->messenger();
226 }
227
228 FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(
229 FlutterDesktopEngineRef engine) {
230 return HandleForTextureRegistrar(
231 EngineFromHandle(engine)->texture_registrar());
232 }
233
234 void FlutterDesktopEngineSetNextFrameCallback(FlutterDesktopEngineRef engine,
235 VoidCallback callback,
236 void* user_data) {
237 EngineFromHandle(engine)->SetNextFrameCallback(
238 [callback, user_data]() { callback(user_data); });
239 }
240
241 HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef view) {
242 return ViewFromHandle(view)->GetWindowHandle();
243 }
244
245 IDXGIAdapter* FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view) {
246 auto egl_manager = ViewFromHandle(view)->GetEngine()->egl_manager();
247 if (egl_manager) {
248 Microsoft::WRL::ComPtr<ID3D11Device> d3d_device;
249 Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device;
250 if (egl_manager->GetDevice(d3d_device.GetAddressOf()) &&
251 SUCCEEDED(d3d_device.As(&dxgi_device))) {
252 IDXGIAdapter* adapter;
253 if (SUCCEEDED(dxgi_device->GetAdapter(&adapter))) {
254 return adapter;
255 }
256 }
257 }
258 return nullptr;
259 }
260
261 bool FlutterDesktopEngineProcessExternalWindowMessage(
262 FlutterDesktopEngineRef engine,
263 HWND hwnd,
264 UINT message,
265 WPARAM wparam,
266 LPARAM lparam,
267 LRESULT* result) {
268 std::optional<LRESULT> lresult =
269 EngineFromHandle(engine)->ProcessExternalWindowMessage(hwnd, message,
270 wparam, lparam);
271 if (result && lresult.has_value()) {
272 *result = lresult.value();
273 }
274 return lresult.has_value();
275 }
276
277 void FlutterDesktopEngineRegisterPlatformViewType(
278 FlutterDesktopEngineRef engine,
279 const char* view_type_name,
280 FlutterPlatformViewTypeEntry view_type) {
281 // TODO(schectman): forward to platform view manager.
282 // https://github.com/flutter/flutter/issues/143375
283 }
284
285 FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(
286 FlutterDesktopPluginRegistrarRef registrar) {
287 return HandleForView(registrar->engine->view(flutter::kImplicitViewId));
288 }
289
290 FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById(
291 FlutterDesktopPluginRegistrarRef registrar,
292 FlutterDesktopViewId view_id) {
293 return HandleForView(registrar->engine->view(view_id));
294 }
295
296 void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(
297 FlutterDesktopPluginRegistrarRef registrar,
298 FlutterDesktopWindowProcCallback delegate,
299 void* user_data) {
300 registrar->engine->window_proc_delegate_manager()
301 ->RegisterTopLevelWindowProcDelegate(delegate, user_data);
302 }
303
304 void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(
305 FlutterDesktopPluginRegistrarRef registrar,
306 FlutterDesktopWindowProcCallback delegate) {
307 registrar->engine->window_proc_delegate_manager()
308 ->UnregisterTopLevelWindowProcDelegate(delegate);
309 }
310
311 UINT FlutterDesktopGetDpiForHWND(HWND hwnd) {
312 return flutter::GetDpiForHWND(hwnd);
313 }
314
315 UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor) {
316 return flutter::GetDpiForMonitor(monitor);
317 }
318
319 void FlutterDesktopResyncOutputStreams() {
320 FILE* unused;
321 if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
322 _dup2(_fileno(stdout), 1);
323 }
324 if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
325 _dup2(_fileno(stdout), 2);
326 }
327 std::ios::sync_with_stdio();
328 }
329
330 // Implementations of common/ API methods.
331
332 FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(
333 FlutterDesktopPluginRegistrarRef registrar) {
334 return registrar->engine->messenger();
335 }
336
337 void FlutterDesktopPluginRegistrarSetDestructionHandler(
338 FlutterDesktopPluginRegistrarRef registrar,
339 FlutterDesktopOnPluginRegistrarDestroyed callback) {
340 registrar->engine->AddPluginRegistrarDestructionCallback(callback, registrar);
341 }
342
343 bool FlutterDesktopMessengerSendWithReply(FlutterDesktopMessengerRef messenger,
344 const char* channel,
345 const uint8_t* message,
346 const size_t message_size,
347 const FlutterDesktopBinaryReply reply,
348 void* user_data) {
349 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
350 << "Messenger must reference a running engine to send a message";
351
352 return flutter::FlutterDesktopMessenger::FromRef(messenger)
353 ->GetEngine()
354 ->SendPlatformMessage(channel, message, message_size, reply, user_data);
355 }
356
357 bool FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger,
358 const char* channel,
359 const uint8_t* message,
360 const size_t message_size) {
361 return FlutterDesktopMessengerSendWithReply(messenger, channel, message,
362 message_size, nullptr, nullptr);
363 }
364
365 void FlutterDesktopMessengerSendResponse(
366 FlutterDesktopMessengerRef messenger,
367 const FlutterDesktopMessageResponseHandle* handle,
368 const uint8_t* data,
369 size_t data_length) {
370 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
371 << "Messenger must reference a running engine to send a response";
372
373 flutter::FlutterDesktopMessenger::FromRef(messenger)
374 ->GetEngine()
375 ->SendPlatformMessageResponse(handle, data, data_length);
376 }
377
378 void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger,
379 const char* channel,
380 FlutterDesktopMessageCallback callback,
381 void* user_data) {
382 FML_DCHECK(FlutterDesktopMessengerIsAvailable(messenger))
383 << "Messenger must reference a running engine to set a callback";
384
385 flutter::FlutterDesktopMessenger::FromRef(messenger)
386 ->GetEngine()
387 ->message_dispatcher()
388 ->SetMessageCallback(channel, callback, user_data);
389 }
390
391 FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(
392 FlutterDesktopMessengerRef messenger) {
393 return flutter::FlutterDesktopMessenger::FromRef(messenger)
394 ->AddRef()
395 ->ToRef();
396 }
397
398 void FlutterDesktopMessengerRelease(FlutterDesktopMessengerRef messenger) {
399 flutter::FlutterDesktopMessenger::FromRef(messenger)->Release();
400 }
401
402 bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger) {
403 return flutter::FlutterDesktopMessenger::FromRef(messenger)->GetEngine() !=
404 nullptr;
405 }
406
407 FlutterDesktopMessengerRef FlutterDesktopMessengerLock(
408 FlutterDesktopMessengerRef messenger) {
409 flutter::FlutterDesktopMessenger::FromRef(messenger)->GetMutex().lock();
410 return messenger;
411 }
412
413 void FlutterDesktopMessengerUnlock(FlutterDesktopMessengerRef messenger) {
414 flutter::FlutterDesktopMessenger::FromRef(messenger)->GetMutex().unlock();
415 }
416
417 FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar(
418 FlutterDesktopPluginRegistrarRef registrar) {
419 return HandleForTextureRegistrar(registrar->engine->texture_registrar());
420 }
421
422 int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(
423 FlutterDesktopTextureRegistrarRef texture_registrar,
424 const FlutterDesktopTextureInfo* texture_info) {
425 return TextureRegistrarFromHandle(texture_registrar)
426 ->RegisterTexture(texture_info);
427 }
428
429 void FlutterDesktopTextureRegistrarUnregisterExternalTexture(
430 FlutterDesktopTextureRegistrarRef texture_registrar,
431 int64_t texture_id,
432 void (*callback)(void* user_data),
433 void* user_data) {
434 auto registrar = TextureRegistrarFromHandle(texture_registrar);
435 if (callback) {
436 registrar->UnregisterTexture(
437 texture_id, [callback, user_data]() { callback(user_data); });
438 return;
439 }
440 registrar->UnregisterTexture(texture_id);
441 }
442
443 bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(
444 FlutterDesktopTextureRegistrarRef texture_registrar,
445 int64_t texture_id) {
446 return TextureRegistrarFromHandle(texture_registrar)
447 ->MarkTextureFrameAvailable(texture_id);
448 }
FlutterDesktopViewControllerProperties::height
int height
Definition: flutter_windows_internal.h:23
flutter::kImplicitViewId
constexpr FlutterViewId kImplicitViewId
Definition: flutter_windows_engine.h:54
FlutterDesktopViewControllerHandleTopLevelWindowProc
bool FlutterDesktopViewControllerHandleTopLevelWindowProc(FlutterDesktopViewControllerRef ref, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
Definition: flutter_windows.cc:160
flutter::FlutterWindowsEngine::GetRegistrar
FlutterDesktopPluginRegistrarRef GetRegistrar()
Definition: flutter_windows_engine.cc:543
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:241
FlutterDesktopViewControllerGetView
FlutterDesktopViewRef FlutterDesktopViewControllerGetView(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:148
FlutterDesktopEngineGetTextureRegistrar
FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:228
FlutterDesktopPluginRegistrarGetView
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:285
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view(FlutterViewId view_id) const
Definition: flutter_windows_engine.cc:533
FlutterDesktopEngineGetMessenger
FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:223
FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
Definition: flutter_windows.cc:296
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:413
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:357
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:637
flutter::GetDpiForMonitor
UINT GetDpiForMonitor(HMONITOR monitor)
Definition: dpi_utils.cc:134
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:52
flutter::FlutterWindowsTextureRegistrar::MarkTextureFrameAvailable
bool MarkTextureFrameAvailable(int64_t texture_id)
Definition: flutter_windows_texture_registrar.cc:103
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:89
flutter::FlutterWindowsEngine::window_proc_delegate_manager
WindowProcDelegateManager * window_proc_delegate_manager()
Definition: flutter_windows_engine.h:161
flutter::FlutterWindowsEngine::running
virtual bool running() const
Definition: flutter_windows_engine.h:116
FlutterDesktopEngineRegisterPlatformViewType
void FlutterDesktopEngineRegisterPlatformViewType(FlutterDesktopEngineRef engine, const char *view_type_name, FlutterPlatformViewTypeEntry view_type)
Definition: flutter_windows.cc:277
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:261
FlutterDesktopPluginRegistrarSetDestructionHandler
void FlutterDesktopPluginRegistrarSetDestructionHandler(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopOnPluginRegistrarDestroyed callback)
Definition: flutter_windows.cc:337
FlutterDesktopEngineGetPluginRegistrar
FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(FlutterDesktopEngineRef engine, const char *plugin_name)
Definition: flutter_windows.cc:213
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:291
EngineFromHandle
static flutter::FlutterWindowsEngine * EngineFromHandle(FlutterDesktopEngineRef ref)
Definition: flutter_windows.cc:32
FlutterDesktopPluginRegistrarGetMessenger
FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows.cc:332
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:727
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:574
FlutterDesktopResyncOutputStreams
void FlutterDesktopResyncOutputStreams()
Definition: flutter_windows.cc:319
FlutterDesktopViewControllerGetViewId
FlutterDesktopViewId FlutterDesktopViewControllerGetViewId(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:136
flutter::FlutterWindowsEngine::Stop
virtual bool Stop()
Definition: flutter_windows_engine.cc:479
flutter::FlutterWindowsEngine::messenger
FlutterDesktopMessengerRef messenger()
Definition: flutter_windows_engine.h:143
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:843
FlutterPlatformViewTypeEntry
Definition: flutter_windows_internal.h:57
path_utils.h
FlutterDesktopMessengerLock
FlutterDesktopMessengerRef FlutterDesktopMessengerLock(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:407
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:492
flutter::FlutterWindowsEngine::texture_registrar
FlutterWindowsTextureRegistrar * texture_registrar()
Definition: flutter_windows_engine.h:153
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:417
flutter::FlutterWindowsEngine::AddPluginRegistrarDestructionCallback
void AddPluginRegistrarDestructionCallback(FlutterDesktopOnPluginRegistrarDestroyed callback, FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows_engine.cc:547
FlutterDesktopTextureRegistrarRef
struct FlutterDesktopTextureRegistrar * FlutterDesktopTextureRegistrarRef
Definition: flutter_texture_registrar.h:19
FlutterDesktopGetDpiForMonitor
UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor)
Definition: flutter_windows.cc:315
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:205
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:429
flutter::FlutterWindowsEngine::SendPlatformMessageResponse
void SendPlatformMessageResponse(const FlutterDesktopMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
Definition: flutter_windows_engine.cc:608
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:117
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:304
FlutterDesktopOnPluginRegistrarDestroyed
void(* FlutterDesktopOnPluginRegistrarDestroyed)(FlutterDesktopPluginRegistrarRef)
Definition: flutter_plugin_registrar.h:23
FlutterDesktopViewControllerForceRedraw
void FlutterDesktopViewControllerForceRedraw(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:154
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:145
flutter::FlutterDesktopMessenger::AddRef
FlutterDesktopMessenger * AddRef()
Definition: flutter_desktop_messenger.h:50
flutter::FlutterWindowsView::GetEngine
FlutterWindowsEngine * GetEngine() const
Definition: flutter_windows_view.cc:731
FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable
bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id)
Definition: flutter_windows.cc:443
FlutterDesktopEngineDestroy
bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref)
Definition: flutter_windows.cc:185
flutter_windows_engine.h
FlutterDesktopEngineCreate
FlutterDesktopEngineRef FlutterDesktopEngineCreate(const FlutterDesktopEngineProperties *engine_properties)
Definition: flutter_windows.cc:178
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:365
FlutterDesktopMessengerIsAvailable
bool FlutterDesktopMessengerIsAvailable(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:402
FlutterDesktopViewControllerGetEngine
FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(FlutterDesktopViewControllerRef ref)
Definition: flutter_windows.cc:142
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:131
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:234
FlutterDesktopEngineCreateViewController
FlutterDesktopViewControllerRef FlutterDesktopEngineCreateViewController(FlutterDesktopEngineRef engine, const FlutterDesktopViewControllerProperties *properties)
Definition: flutter_windows.cc:124
FlutterDesktopViewControllerProperties::width
int width
Definition: flutter_windows_internal.h:20
incoming_message_dispatcher.h
FlutterDesktopMessengerRelease
void FlutterDesktopMessengerRelease(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:398
FlutterDesktopTextureRegistrarRegisterExternalTexture
int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, const FlutterDesktopTextureInfo *texture_info)
Definition: flutter_windows.cc:422
FlutterDesktopMessengerSetCallback
void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger, const char *channel, FlutterDesktopMessageCallback callback, void *user_data)
Definition: flutter_windows.cc:378
FlutterDesktopViewGetGraphicsAdapter
IDXGIAdapter * FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view)
Definition: flutter_windows.cc:245
flutter::FlutterWindowsEngine::egl_manager
egl::Manager * egl_manager() const
Definition: flutter_windows_engine.h:159
FlutterDesktopMessageCallback
void(* FlutterDesktopMessageCallback)(FlutterDesktopMessengerRef, const FlutterDesktopMessage *, void *)
Definition: flutter_messenger.h:49
FlutterDesktopGetDpiForHWND
UINT FlutterDesktopGetDpiForHWND(HWND hwnd)
Definition: flutter_windows.cc:311
FlutterDesktopPluginRegistrar
Definition: window_state.h:23
FlutterDesktopEngineRun
bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine, const char *entry_point)
Definition: flutter_windows.cc:195
flutter::FlutterWindowsEngine::Run
bool Run()
Definition: flutter_windows_engine.cc:237
texture_id
uint32_t texture_id
Definition: compositor_opengl.cc:20
FlutterDesktopPluginRegistrarGetViewById
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopViewId view_id)
Definition: flutter_windows.cc:290
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:343
flutter::FlutterWindowsEngine::ReloadSystemFonts
void ReloadSystemFonts()
Definition: flutter_windows_engine.cc:629
FlutterDesktopEngineReloadSystemFonts
void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine)
Definition: flutter_windows.cc:209
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:51
FlutterDesktopMessengerAddRef
FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(FlutterDesktopMessengerRef messenger)
Definition: flutter_windows.cc:391