| Flutter Windows Embedder |

flutter_windows_engine.h
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 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_
7
8 #include <chrono>
9 #include <map>
10 #include <memory>
11 #include <optional>
12 #include <shared_mutex>
13 #include <string>
14 #include <string_view>
15 #include <unordered_map>
16 #include <vector>
17
18 #include "flutter/fml/closure.h"
19 #include "flutter/fml/macros.h"
20 #include "flutter/shell/platform/common/accessibility_bridge.h"
21 #include "flutter/shell/platform/common/app_lifecycle_state.h"
22 #include "flutter/shell/platform/common/client_wrapper/binary_messenger_impl.h"
23 #include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h"
24 #include "flutter/shell/platform/common/incoming_message_dispatcher.h"
25 #include "flutter/shell/platform/embedder/embedder.h"
26 #include "flutter/shell/platform/windows/accessibility_bridge_windows.h"
27 #include "flutter/shell/platform/windows/accessibility_plugin.h"
28 #include "flutter/shell/platform/windows/compositor.h"
29 #include "flutter/shell/platform/windows/cursor_handler.h"
30 #include "flutter/shell/platform/windows/egl/manager.h"
31 #include "flutter/shell/platform/windows/egl/proc_table.h"
32 #include "flutter/shell/platform/windows/flutter_desktop_messenger.h"
33 #include "flutter/shell/platform/windows/flutter_project_bundle.h"
34 #include "flutter/shell/platform/windows/flutter_windows_texture_registrar.h"
35 #include "flutter/shell/platform/windows/host_window.h"
36 #include "flutter/shell/platform/windows/keyboard_handler_base.h"
37 #include "flutter/shell/platform/windows/keyboard_key_embedder_handler.h"
38 #include "flutter/shell/platform/windows/platform_handler.h"
39 #include "flutter/shell/platform/windows/platform_view_plugin.h"
40 #include "flutter/shell/platform/windows/public/flutter_windows.h"
41 #include "flutter/shell/platform/windows/settings_plugin.h"
42 #include "flutter/shell/platform/windows/task_runner.h"
43 #include "flutter/shell/platform/windows/text_input_plugin.h"
44 #include "flutter/shell/platform/windows/window_proc_delegate_manager.h"
45 #include "flutter/shell/platform/windows/window_state.h"
46 #include "flutter/shell/platform/windows/windows_lifecycle_manager.h"
47 #include "flutter/shell/platform/windows/windows_proc_table.h"
48 #include "third_party/rapidjson/include/rapidjson/document.h"
49
50 namespace flutter {
51
52 // The implicit view's ID.
53 //
54 // See:
55 // https://api.flutter.dev/flutter/dart-ui/PlatformDispatcher/implicitView.html
56 constexpr FlutterViewId kImplicitViewId = 0;
57
58 class FlutterWindowsView;
59 class DisplayManagerWin32;
60
61 // Update the thread priority for the Windows engine.
62 static void WindowsPlatformThreadPrioritySetter(
63 FlutterThreadPriority priority) {
64 // TODO(99502): Add support for tracing to the windows embedding so we can
65 // mark thread priorities and success/failure.
66 switch (priority) {
67 case FlutterThreadPriority::kBackground: {
68 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
69 break;
70 }
71 case FlutterThreadPriority::kDisplay: {
72 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
73 break;
74 }
75 case FlutterThreadPriority::kRaster: {
76 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
77 break;
78 }
79 case FlutterThreadPriority::kNormal: {
80 // For normal or default priority we do not need to set the priority
81 // class.
82 break;
83 }
84 }
85 }
86
87 // Manages state associated with the underlying FlutterEngine that isn't
88 // related to its display.
89 //
90 // In most cases this will be associated with a FlutterView, but if not will
91 // run in headless mode.
92 class FlutterWindowsEngine {
93 public:
94 // Creates a new Flutter engine object configured to run |project|.
95 FlutterWindowsEngine(
96 const FlutterProjectBundle& project,
97 std::shared_ptr<WindowsProcTable> windows_proc_table = nullptr);
98
99 virtual ~FlutterWindowsEngine();
100
101 // Returns the engine associated with the given identifier.
102 // The engine_id must be valid and for a running engine, otherwise
103 // the behavior is undefined.
104 // Must be called on the platform thread.
105 static FlutterWindowsEngine* GetEngineForId(int64_t engine_id);
106
107 // Starts running the entrypoint function specifed in the project bundle. If
108 // unspecified, defaults to main().
109 //
110 // Returns false if the engine couldn't be started.
111 bool Run();
112
113 // Starts running the engine with the given entrypoint. If the empty string
114 // is specified, defaults to the entrypoint function specified in the project
115 // bundle, or main() if both are unspecified.
116 //
117 // Returns false if the engine couldn't be started or if conflicting,
118 // non-default values are passed here and in the project bundle..
119 //
120 // DEPRECATED: Prefer setting the entrypoint in the FlutterProjectBundle
121 // passed to the constructor and calling the no-parameter overload.
122 bool Run(std::string_view entrypoint);
123
124 // Returns true if the engine is currently running.
125 virtual bool running() const { return engine_ != nullptr; }
126
127 // Stops the engine. This invalidates the pointer returned by engine().
128 //
129 // Returns false if stopping the engine fails, or if it was not running.
130 virtual bool Stop();
131
132 // Create a view that can display this engine's content.
133 //
134 // Returns null on failure.
135 std::unique_ptr<FlutterWindowsView> CreateView(
136 std::unique_ptr<WindowBindingHandler> window,
137 bool is_sized_to_content,
138 const BoxConstraints& box_constraints,
139 FlutterWindowsViewSizingDelegate* sizing_delegate = nullptr);
140
141 // Remove a view. The engine will no longer render into it.
142 virtual void RemoveView(FlutterViewId view_id);
143
144 // Get a view that displays this engine's content.
145 //
146 // Returns null if the view does not exist.
147 FlutterWindowsView* view(FlutterViewId view_id) const;
148
149 // Returns the currently configured Plugin Registrar.
150 FlutterDesktopPluginRegistrarRef GetRegistrar();
151
152 // Registers |callback| to be called when the plugin registrar is destroyed.
153 void AddPluginRegistrarDestructionCallback(
154 FlutterDesktopOnPluginRegistrarDestroyed callback,
155 FlutterDesktopPluginRegistrarRef registrar);
156
157 // Sets switches member to the given switches.
158 void SetSwitches(const std::vector<std::string>& switches);
159
160 FlutterDesktopMessengerRef messenger() { return messenger_->ToRef(); }
161
162 IncomingMessageDispatcher* message_dispatcher() {
163 return message_dispatcher_.get();
164 }
165
166 std::shared_ptr<DisplayManagerWin32> display_manager() {
167 return display_manager_;
168 }
169
170 // Notifies the engine about a display update.
171 void UpdateDisplay(const std::vector<FlutterEngineDisplay>& displays);
172
173 TaskRunner* task_runner() { return task_runner_.get(); }
174
175 BinaryMessenger* messenger_wrapper() { return messenger_wrapper_.get(); }
176
177 FlutterWindowsTextureRegistrar* texture_registrar() {
178 return texture_registrar_.get();
179 }
180
181 // The EGL manager object. If this is nullptr, then we are
182 // rendering using software instead of OpenGL.
183 egl::Manager* egl_manager() const { return egl_manager_.get(); }
184
185 WindowProcDelegateManager* window_proc_delegate_manager() {
186 return window_proc_delegate_manager_.get();
187 }
188
189 // Informs the engine that the window metrics have changed.
190 void SendWindowMetricsEvent(const FlutterWindowMetricsEvent& event);
191
192 // Informs the engine of an incoming pointer event.
193 void SendPointerEvent(const FlutterPointerEvent& event);
194
195 // Informs the engine of an incoming key event.
196 void SendKeyEvent(const FlutterKeyEvent& event,
197 FlutterKeyEventCallback callback,
198 void* user_data);
199
200 // Informs the engine of an incoming focus event.
201 void SendViewFocusEvent(const FlutterViewFocusEvent& event);
202
203 KeyboardHandlerBase* keyboard_key_handler() {
204 return keyboard_key_handler_.get();
205 }
206 TextInputPlugin* text_input_plugin() { return text_input_plugin_.get(); }
207
208 // Sends the given message to the engine, calling |reply| with |user_data|
209 // when a response is received from the engine if they are non-null.
210 bool SendPlatformMessage(const char* channel,
211 const uint8_t* message,
212 const size_t message_size,
213 const FlutterDesktopBinaryReply reply,
214 void* user_data);
215
216 // Sends the given data as the response to an earlier platform message.
217 void SendPlatformMessageResponse(
218 const FlutterDesktopMessageResponseHandle* handle,
219 const uint8_t* data,
220 size_t data_length);
221
222 // Callback passed to Flutter engine for notifying window of platform
223 // messages.
224 void HandlePlatformMessage(const FlutterPlatformMessage*);
225
226 // Informs the engine that the system font list has changed.
227 void ReloadSystemFonts();
228
229 // Informs the engine that a new frame is needed to redraw the content.
230 void ScheduleFrame();
231
232 // Set the callback that is called when the next frame is drawn.
233 void SetNextFrameCallback(fml::closure callback);
234
235 // Attempts to register the texture with the given |texture_id|.
236 bool RegisterExternalTexture(int64_t texture_id);
237
238 // Attempts to unregister the texture with the given |texture_id|.
239 bool UnregisterExternalTexture(int64_t texture_id);
240
241 // Notifies the engine about a new frame being available for the
242 // given |texture_id|.
243 bool MarkExternalTextureFrameAvailable(int64_t texture_id);
244
245 // Posts the given callback onto the raster thread.
246 virtual bool PostRasterThreadTask(fml::closure callback) const;
247
248 // Invoke on the embedder's vsync callback to schedule a frame.
249 void OnVsync(intptr_t baton);
250
251 // Dispatches a semantics action to the specified semantics node.
252 bool DispatchSemanticsAction(FlutterViewId view_id,
253 uint64_t node_id,
254 FlutterSemanticsAction action,
255 fml::MallocMapping data);
256
257 // Informs the engine that the semantics enabled state has changed.
258 void UpdateSemanticsEnabled(bool enabled);
259
260 // Returns true if the semantics tree is enabled.
261 bool semantics_enabled() const { return semantics_enabled_; }
262
263 // Refresh accessibility features and send them to the engine.
264 void UpdateAccessibilityFeatures();
265
266 // Refresh high contrast accessibility mode and notify the engine.
267 void UpdateHighContrastMode();
268
269 // Returns true if the high contrast feature is enabled.
270 bool high_contrast_enabled() const { return high_contrast_enabled_; }
271
272 // Register a root isolate create callback.
273 //
274 // The root isolate create callback is invoked at creation of the root Dart
275 // isolate in the app. This may be used to be notified that execution of the
276 // main Dart entrypoint is about to begin, and is used by test infrastructure
277 // to register a native function resolver that can register and resolve
278 // functions marked as native in the Dart code.
279 //
280 // This must be called before calling |Run|.
281 void SetRootIsolateCreateCallback(const fml::closure& callback) {
282 root_isolate_create_callback_ = callback;
283 }
284
285 // Returns the executable name for this process or "Flutter" if unknown.
286 std::string GetExecutableName() const;
287
288 // Called when the application quits in response to a quit request.
289 void OnQuit(std::optional<HWND> hwnd,
290 std::optional<WPARAM> wparam,
291 std::optional<LPARAM> lparam,
292 UINT exit_code);
293
294 // Called when a WM_CLOSE message is received.
295 void RequestApplicationQuit(HWND hwnd,
296 WPARAM wparam,
297 LPARAM lparam,
298 AppExitType exit_type);
299
300 // Called when a WM_DWMCOMPOSITIONCHANGED message is received.
301 void OnDwmCompositionChanged();
302
303 // Called when a Window receives an event that may alter the application
304 // lifecycle state.
305 void OnWindowStateEvent(HWND hwnd, WindowStateEvent event);
306
307 // Handle a message from a non-Flutter window in the same application.
308 // Returns a result when the message is consumed and should not be processed
309 // further.
310 std::optional<LRESULT> ProcessExternalWindowMessage(HWND hwnd,
311 UINT message,
312 WPARAM wparam,
313 LPARAM lparam);
314
315 WindowsLifecycleManager* lifecycle_manager() {
316 return lifecycle_manager_.get();
317 }
318
319 std::shared_ptr<WindowsProcTable> windows_proc_table() {
320 return windows_proc_table_;
321 }
322
323 // Sets the cursor that should be used when the mouse is over the Flutter
324 // content. See mouse_cursor.dart for the values and meanings of cursor_name.
325 void UpdateFlutterCursor(const std::string& cursor_name) const;
326
327 // Sets the cursor directly from a cursor handle.
328 void SetFlutterCursor(HCURSOR cursor) const;
329
330 WindowManager* window_manager() { return window_manager_.get(); }
331
332 // Returns the root view associated with the top-level window with |hwnd| as
333 // the window handle or nullptr if no such view could be found.
334 FlutterWindowsView* GetViewFromTopLevelWindow(HWND hwnd) const;
335
336 protected:
337 // Creates the keyboard key handler.
338 //
339 // Exposing this method allows unit tests to override in order to
340 // capture information.
341 virtual std::unique_ptr<KeyboardHandlerBase> CreateKeyboardKeyHandler(
342 BinaryMessenger* messenger,
343 KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state,
344 KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode map_vk_to_scan);
345
346 // Creates the text input plugin.
347 //
348 // Exposing this method allows unit tests to override in order to
349 // capture information.
350 virtual std::unique_ptr<TextInputPlugin> CreateTextInputPlugin(
351 BinaryMessenger* messenger);
352
353 // Invoked by the engine right before the engine is restarted.
354 //
355 // This should reset necessary states to as if the engine has just been
356 // created. This is typically caused by a hot restart (Shift-R in CLI.)
357 void OnPreEngineRestart();
358
359 // Invoked by the engine when a listener is set or cleared on a platform
360 // channel.
361 virtual void OnChannelUpdate(std::string name, bool listening);
362
363 virtual void OnViewFocusChangeRequest(
364 const FlutterViewFocusChangeRequest* request);
365
366 private:
367 // Allows swapping out embedder_api_ calls in tests.
368 friend class EngineModifier;
369
370 // Maps a Flutter cursor name to an HCURSOR.
371 //
372 // Returns the arrow cursor for unknown constants.
373 //
374 // This map must be kept in sync with Flutter framework's
375 // services/mouse_cursor.dart.
376 HCURSOR GetCursorByName(const std::string& cursor_name) const;
377
378 // Sends system locales to the engine.
379 //
380 // Should be called just after the engine is run, and after any relevant
381 // system changes.
382 void SendSystemLocales();
383
384 // Create the keyboard & text input sub-systems.
385 //
386 // This requires that a view is attached to the engine.
387 // Calling this method again resets the keyboard state.
388 void InitializeKeyboard();
389
390 // Send the currently enabled accessibility features to the engine.
391 void SendAccessibilityFeatures();
392
393 // Present content to a view. Returns true if the content was presented.
394 //
395 // This is invoked on the raster thread.
396 bool Present(const FlutterPresentViewInfo* info);
397
398 // The handle to the embedder.h engine instance.
399 FLUTTER_API_SYMBOL(FlutterEngine) engine_ = nullptr;
400
401 FlutterEngineProcTable embedder_api_ = {};
402
403 std::unique_ptr<FlutterProjectBundle> project_;
404
405 // AOT data, if any.
406 UniqueAotDataPtr aot_data_;
407
408 // The ID that the next view will have.
409 FlutterViewId next_view_id_ = kImplicitViewId;
410
411 // The views displaying the content running in this engine, if any.
412 //
413 // This is read and mutated by the platform thread. This is read by the raster
414 // thread to present content to a view.
415 //
416 // Reads to this object on non-platform threads must be protected
417 // by acquiring a shared lock on |views_mutex_|.
418 //
419 // Writes to this object must only happen on the platform thread
420 // and must be protected by acquiring an exclusive lock on |views_mutex_|.
421 std::unordered_map<FlutterViewId, FlutterWindowsView*> views_;
422
423 // The mutex that protects the |views_| map.
424 //
425 // The raster thread acquires a shared lock to present to a view.
426 //
427 // The platform thread acquires a shared lock to access the view.
428 // The platform thread acquires an exclusive lock before adding
429 // a view to the engine or after removing a view from the engine.
430 mutable std::shared_mutex views_mutex_;
431
432 // The display monitor.
433 std::shared_ptr<DisplayManagerWin32> display_manager_;
434
435 // Task runner for tasks posted from the engine.
436 std::unique_ptr<TaskRunner> task_runner_;
437
438 // The plugin messenger handle given to API clients.
439 fml::RefPtr<flutter::FlutterDesktopMessenger> messenger_;
440
441 // A wrapper around messenger_ for interacting with client_wrapper-level APIs.
442 std::unique_ptr<BinaryMessengerImpl> messenger_wrapper_;
443
444 // Message dispatch manager for messages from engine_.
445 std::unique_ptr<IncomingMessageDispatcher> message_dispatcher_;
446
447 // The plugin registrar handle given to API clients.
448 std::unique_ptr<FlutterDesktopPluginRegistrar> plugin_registrar_;
449
450 // The texture registrar.
451 std::unique_ptr<FlutterWindowsTextureRegistrar> texture_registrar_;
452
453 // An object used for intializing ANGLE and creating / destroying render
454 // surfaces. If nullptr, ANGLE failed to initialize and software rendering
455 // should be used instead.
456 std::unique_ptr<egl::Manager> egl_manager_;
457
458 // The compositor that creates backing stores for the engine to render into
459 // and then presents them onto views.
460 std::unique_ptr<Compositor> compositor_;
461
462 // The plugin registrar managing internal plugins.
463 std::unique_ptr<PluginRegistrar> internal_plugin_registrar_;
464
465 // Handler for accessibility events.
466 std::unique_ptr<AccessibilityPlugin> accessibility_plugin_;
467
468 // Handler for cursor events.
469 std::unique_ptr<CursorHandler> cursor_handler_;
470
471 // Handler for the flutter/platform channel.
472 std::unique_ptr<PlatformHandler> platform_handler_;
473
474 // Handlers for keyboard events from Windows.
475 std::unique_ptr<KeyboardHandlerBase> keyboard_key_handler_;
476
477 // The manager that manages the lifecycle of |HostWindow|s, native
478 // Win32 windows hosting a Flutter view in their client area.
479 std::unique_ptr<WindowManager> window_manager_;
480
481 // Handlers for text events from Windows.
482 std::unique_ptr<TextInputPlugin> text_input_plugin_;
483
484 // The settings plugin.
485 std::unique_ptr<SettingsPlugin> settings_plugin_;
486
487 // Callbacks to be called when the engine (and thus the plugin registrar) is
488 // being destroyed.
489 std::map<FlutterDesktopOnPluginRegistrarDestroyed,
490 FlutterDesktopPluginRegistrarRef>
491 plugin_registrar_destruction_callbacks_;
492
493 // The approximate time between vblank events.
494 std::chrono::nanoseconds FrameInterval();
495
496 // The start time used to align frames.
497 std::chrono::nanoseconds start_time_ = std::chrono::nanoseconds::zero();
498
499 // An override of the frame interval used by EngineModifier for testing.
500 std::optional<std::chrono::nanoseconds> frame_interval_override_ =
501 std::nullopt;
502
503 bool semantics_enabled_ = false;
504
505 bool high_contrast_enabled_ = false;
506
507 bool enable_impeller_ = false;
508
509 // The manager for WindowProc delegate registration and callbacks.
510 std::unique_ptr<WindowProcDelegateManager> window_proc_delegate_manager_;
511
512 // The root isolate creation callback.
513 fml::closure root_isolate_create_callback_;
514
515 // The on frame drawn callback.
516 fml::closure next_frame_callback_;
517
518 // Handler for top level window messages.
519 std::unique_ptr<WindowsLifecycleManager> lifecycle_manager_;
520
521 std::shared_ptr<WindowsProcTable> windows_proc_table_;
522
523 std::shared_ptr<egl::ProcTable> gl_;
524
525 std::unique_ptr<PlatformViewPlugin> platform_view_plugin_;
526
527 // Handles display-related window messages.
528 bool HandleDisplayMonitorMessage(HWND hwnd,
529 UINT message,
530 WPARAM wparam,
531 LPARAM lparam,
532 LRESULT* result);
533
534 FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindowsEngine);
535 };
536
537 } // namespace flutter
538
539 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_
accessibility_bridge.h
accessibility_bridge_windows.h
accessibility_plugin.h
app_lifecycle_state.h
basic_message_channel.h
binary_messenger_impl.h
flutter::BinaryMessenger
Definition: binary_messenger.h:29
flutter::DisplayManagerWin32
Definition: display_manager.h:18
flutter::FlutterEngine
Definition: flutter_engine.h:28
flutter::FlutterProjectBundle
Definition: flutter_project_bundle.h:33
flutter::FlutterWindowsEngine
Definition: flutter_windows_engine.h:92
flutter::FlutterWindowsEngine::texture_registrar
FlutterWindowsTextureRegistrar * texture_registrar()
Definition: flutter_windows_engine.h:177
flutter::FlutterWindowsEngine::UpdateHighContrastMode
void UpdateHighContrastMode()
Definition: flutter_windows_engine.cc:1025
flutter::FlutterWindowsEngine::windows_proc_table
std::shared_ptr< WindowsProcTable > windows_proc_table()
Definition: flutter_windows_engine.h:319
flutter::FlutterWindowsEngine::task_runner
TaskRunner * task_runner()
Definition: flutter_windows_engine.h:173
flutter::FlutterWindowsEngine::FlutterWindowsEngine
FlutterWindowsEngine(const FlutterProjectBundle &project, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr)
Definition: flutter_windows_engine.cc:151
flutter::FlutterWindowsEngine::UpdateAccessibilityFeatures
void UpdateAccessibilityFeatures()
Definition: flutter_windows_engine.cc:1021
flutter::FlutterWindowsEngine::messenger
FlutterDesktopMessengerRef messenger()
Definition: flutter_windows_engine.h:160
flutter::FlutterWindowsEngine::Run
bool Run()
Definition: flutter_windows_engine.cc:268
flutter::FlutterWindowsEngine::lifecycle_manager
WindowsLifecycleManager * lifecycle_manager()
Definition: flutter_windows_engine.h:315
flutter::FlutterWindowsEngine::OnWindowStateEvent
void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)
Definition: flutter_windows_engine.cc:1069
flutter::FlutterWindowsEngine::OnDwmCompositionChanged
void OnDwmCompositionChanged()
Definition: flutter_windows_engine.cc:1058
flutter::FlutterWindowsEngine::RequestApplicationQuit
void RequestApplicationQuit(HWND hwnd, WPARAM wparam, LPARAM lparam, AppExitType exit_type)
Definition: flutter_windows_engine.cc:1044
flutter::FlutterWindowsEngine::window_proc_delegate_manager
WindowProcDelegateManager * window_proc_delegate_manager()
Definition: flutter_windows_engine.h:185
flutter::FlutterWindowsEngine::view
FlutterWindowsView * view(FlutterViewId view_id) const
Definition: flutter_windows_engine.cc:692
flutter::FlutterWindowsEngine::OnPreEngineRestart
void OnPreEngineRestart()
Definition: flutter_windows_engine.cc:1002
flutter::FlutterWindowsEngine::display_manager
std::shared_ptr< DisplayManagerWin32 > display_manager()
Definition: flutter_windows_engine.h:166
flutter::FlutterWindowsEngine::SendViewFocusEvent
void SendViewFocusEvent(const FlutterViewFocusEvent &event)
Definition: flutter_windows_engine.cc:744
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:751
flutter::FlutterWindowsEngine::OnViewFocusChangeRequest
virtual void OnViewFocusChangeRequest(const FlutterViewFocusChangeRequest *request)
Definition: flutter_windows_engine.cc:1103
flutter::FlutterWindowsEngine::ProcessExternalWindowMessage
std::optional< LRESULT > ProcessExternalWindowMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: flutter_windows_engine.cc:1074
flutter::FlutterWindowsEngine::AddPluginRegistrarDestructionCallback
void AddPluginRegistrarDestructionCallback(FlutterDesktopOnPluginRegistrarDestroyed callback, FlutterDesktopPluginRegistrarRef registrar)
Definition: flutter_windows_engine.cc:708
flutter::FlutterWindowsEngine::RegisterExternalTexture
bool RegisterExternalTexture(int64_t texture_id)
Definition: flutter_windows_engine.cc:938
flutter::FlutterWindowsEngine::UpdateDisplay
void UpdateDisplay(const std::vector< FlutterEngineDisplay > &displays)
Definition: flutter_windows_engine.cc:714
flutter::FlutterWindowsEngine::SendPlatformMessageResponse
void SendPlatformMessageResponse(const FlutterDesktopMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
Definition: flutter_windows_engine.cc:785
flutter::FlutterWindowsEngine::SetRootIsolateCreateCallback
void SetRootIsolateCreateCallback(const fml::closure &callback)
Definition: flutter_windows_engine.h:281
flutter::FlutterWindowsEngine::GetEngineForId
static FlutterWindowsEngine * GetEngineForId(int64_t engine_id)
Definition: flutter_windows_engine.cc:259
flutter::FlutterWindowsEngine::UpdateSemanticsEnabled
void UpdateSemanticsEnabled(bool enabled)
Definition: flutter_windows_engine.cc:990
flutter::FlutterWindowsEngine::CreateView
std::unique_ptr< FlutterWindowsView > CreateView(std::unique_ptr< WindowBindingHandler > window, bool is_sized_to_content, const BoxConstraints &box_constraints, FlutterWindowsViewSizingDelegate *sizing_delegate=nullptr)
Definition: flutter_windows_engine.cc:526
flutter::FlutterWindowsEngine::GetExecutableName
std::string GetExecutableName() const
Definition: flutter_windows_engine.cc:1007
flutter::FlutterWindowsEngine::OnChannelUpdate
virtual void OnChannelUpdate(std::string name, bool listening)
Definition: flutter_windows_engine.cc:1095
flutter::FlutterWindowsEngine::CreateKeyboardKeyHandler
virtual std::unique_ptr< KeyboardHandlerBase > CreateKeyboardKeyHandler(BinaryMessenger *messenger, KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state, KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode map_vk_to_scan)
Definition: flutter_windows_engine.cc:915
flutter::FlutterWindowsEngine::DispatchSemanticsAction
bool DispatchSemanticsAction(FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, fml::MallocMapping data)
Definition: flutter_windows_engine.cc:974
flutter::FlutterWindowsEngine::MarkExternalTextureFrameAvailable
bool MarkExternalTextureFrameAvailable(int64_t texture_id)
Definition: flutter_windows_engine.cc:948
flutter::FlutterWindowsEngine::GetViewFromTopLevelWindow
FlutterWindowsView * GetViewFromTopLevelWindow(HWND hwnd) const
Definition: flutter_windows_engine.cc:868
flutter::FlutterWindowsEngine::keyboard_key_handler
KeyboardHandlerBase * keyboard_key_handler()
Definition: flutter_windows_engine.h:203
flutter::FlutterWindowsEngine::high_contrast_enabled
bool high_contrast_enabled() const
Definition: flutter_windows_engine.h:270
flutter::FlutterWindowsEngine::running
virtual bool running() const
Definition: flutter_windows_engine.h:125
flutter::FlutterWindowsEngine::semantics_enabled
bool semantics_enabled() const
Definition: flutter_windows_engine.h:261
flutter::FlutterWindowsEngine::PostRasterThreadTask
virtual bool PostRasterThreadTask(fml::closure callback) const
Definition: flutter_windows_engine.cc:954
flutter::FlutterWindowsEngine::message_dispatcher
IncomingMessageDispatcher * message_dispatcher()
Definition: flutter_windows_engine.h:162
flutter::FlutterWindowsEngine::EngineModifier
friend class EngineModifier
Definition: flutter_windows_engine.h:368
flutter::FlutterWindowsEngine::UnregisterExternalTexture
bool UnregisterExternalTexture(int64_t texture_id)
Definition: flutter_windows_engine.cc:943
flutter::FlutterWindowsEngine::messenger_wrapper
BinaryMessenger * messenger_wrapper()
Definition: flutter_windows_engine.h:175
flutter::FlutterWindowsEngine::ScheduleFrame
void ScheduleFrame()
Definition: flutter_windows_engine.cc:810
flutter::FlutterWindowsEngine::SetNextFrameCallback
void SetNextFrameCallback(fml::closure callback)
Definition: flutter_windows_engine.cc:814
flutter::FlutterWindowsEngine::HandlePlatformMessage
void HandlePlatformMessage(const FlutterPlatformMessage *)
Definition: flutter_windows_engine.cc:792
flutter::FlutterWindowsEngine::Stop
virtual bool Stop()
Definition: flutter_windows_engine.cc:512
flutter::FlutterWindowsEngine::RemoveView
virtual void RemoveView(FlutterViewId view_id)
Definition: flutter_windows_engine.cc:602
flutter::FlutterWindowsEngine::window_manager
WindowManager * window_manager()
Definition: flutter_windows_engine.h:330
flutter::FlutterWindowsEngine::GetRegistrar
FlutterDesktopPluginRegistrarRef GetRegistrar()
Definition: flutter_windows_engine.cc:704
flutter::FlutterWindowsEngine::ReloadSystemFonts
void ReloadSystemFonts()
Definition: flutter_windows_engine.cc:806
flutter::FlutterWindowsEngine::CreateTextInputPlugin
virtual std::unique_ptr< TextInputPlugin > CreateTextInputPlugin(BinaryMessenger *messenger)
Definition: flutter_windows_engine.cc:933
flutter::FlutterWindowsEngine::UpdateFlutterCursor
void UpdateFlutterCursor(const std::string &cursor_name) const
Definition: flutter_windows_engine.cc:1086
flutter::FlutterWindowsEngine::text_input_plugin
TextInputPlugin * text_input_plugin()
Definition: flutter_windows_engine.h:206
flutter::FlutterWindowsEngine::SetFlutterCursor
void SetFlutterCursor(HCURSOR cursor) const
Definition: flutter_windows_engine.cc:1091
flutter::FlutterWindowsEngine::OnVsync
void OnVsync(intptr_t baton)
Definition: flutter_windows_engine.cc:664
flutter::FlutterWindowsEngine::SendPointerEvent
void SendPointerEvent(const FlutterPointerEvent &event)
Definition: flutter_windows_engine.cc:730
flutter::FlutterWindowsEngine::SendWindowMetricsEvent
void SendWindowMetricsEvent(const FlutterWindowMetricsEvent &event)
Definition: flutter_windows_engine.cc:723
flutter::FlutterWindowsEngine::SetSwitches
void SetSwitches(const std::vector< std::string > &switches)
Definition: flutter_windows_engine.cc:263
flutter::FlutterWindowsEngine::SendKeyEvent
void SendKeyEvent(const FlutterKeyEvent &event, FlutterKeyEventCallback callback, void *user_data)
Definition: flutter_windows_engine.cc:736
flutter::FlutterWindowsEngine::egl_manager
egl::Manager * egl_manager() const
Definition: flutter_windows_engine.h:183
flutter::FlutterWindowsEngine::OnQuit
void OnQuit(std::optional< HWND > hwnd, std::optional< WPARAM > wparam, std::optional< LPARAM > lparam, UINT exit_code)
Definition: flutter_windows_engine.cc:1051
flutter::FlutterWindowsEngine::~FlutterWindowsEngine
virtual ~FlutterWindowsEngine()
Definition: flutter_windows_engine.cc:254
flutter::FlutterWindowsTextureRegistrar
Definition: flutter_windows_texture_registrar.h:24
flutter::FlutterWindowsView
Definition: flutter_windows_view.h:46
flutter::FlutterWindowsViewSizingDelegate
Definition: flutter_windows_view.h:33
flutter::IncomingMessageDispatcher
Definition: incoming_message_dispatcher.h:20
flutter::KeyboardHandlerBase
Definition: keyboard_handler_base.h:18
flutter::KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode
std::function< SHORT(UINT, bool)> MapVirtualKeyToScanCode
Definition: keyboard_key_embedder_handler.h:43
flutter::KeyboardKeyEmbedderHandler::GetKeyStateHandler
std::function< SHORT(int)> GetKeyStateHandler
Definition: keyboard_key_embedder_handler.h:41
flutter::TaskRunner
Definition: task_runner.h:26
flutter::TextInputPlugin
Definition: text_input_plugin.h:29
flutter::WindowManager
Definition: window_manager.h:109
flutter::WindowProcDelegateManager
Definition: window_proc_delegate_manager.h:20
flutter::WindowsLifecycleManager
Definition: windows_lifecycle_manager.h:37
flutter::egl::Manager
Definition: manager.h:40
compositor.h
texture_id
uint32_t texture_id
Definition: compositor_opengl.cc:20
cursor_handler.h
displays
std::vector< FlutterEngineDisplay > * displays
Definition: display_manager.cc:19
flutter_desktop_messenger.h
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
FlutterDesktopMessageResponseHandle
struct _FlutterPlatformMessageResponseHandle FlutterDesktopMessageResponseHandle
Definition: flutter_messenger.h:22
FlutterDesktopOnPluginRegistrarDestroyed
void(* FlutterDesktopOnPluginRegistrarDestroyed)(FlutterDesktopPluginRegistrarRef)
Definition: flutter_plugin_registrar.h:23
flutter_project_bundle.h
flutter_windows.h
flutter_windows_texture_registrar.h
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:53
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:52
host_window.h
incoming_message_dispatcher.h
keyboard_handler_base.h
keyboard_key_embedder_handler.h
action
int action
Definition: keyboard_key_handler_unittests.cc:116
message
Win32Message message
Definition: keyboard_unittests.cc:137
manager.h
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::AppExitType
AppExitType
Definition: platform_handler.h:27
flutter::WindowStateEvent
WindowStateEvent
An event representing a change in window state that may update the.
Definition: windows_lifecycle_manager.h:24
flutter::FlutterViewId
int64_t FlutterViewId
Definition: accessibility_plugin.h:15
flutter::WindowsPlatformThreadPrioritySetter
static void WindowsPlatformThreadPrioritySetter(FlutterThreadPriority priority)
Definition: flutter_windows_engine.h:62
flutter::kImplicitViewId
constexpr FlutterViewId kImplicitViewId
Definition: flutter_windows_engine.h:56
flutter::UniqueAotDataPtr
std::unique_ptr< _FlutterEngineAOTData, FlutterEngineCollectAOTDataFnPtr > UniqueAotDataPtr
Definition: flutter_project_bundle.h:18
platform_handler.h
platform_view_plugin.h
proc_table.h
settings_plugin.h
FlutterDesktopPluginRegistrar
Definition: window_state.h:23
task_runner.h
text_input_plugin.h
window_proc_delegate_manager.h
window_state.h
windows_lifecycle_manager.h
windows_proc_table.h