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