| Flutter Linux Embedder |

fl_engine.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/linux/public/flutter_linux/fl_engine.h"
6
7 #include <epoxy/egl.h>
8 #include <gmodule.h>
9
10 #include <cstring>
11
12 #include "flutter/common/constants.h"
13 #include "flutter/shell/platform/common/engine_switches.h"
14 #include "flutter/shell/platform/embedder/embedder.h"
15 #include "flutter/shell/platform/linux/fl_binary_messenger_private.h"
16 #include "flutter/shell/platform/linux/fl_compositor_opengl.h"
17 #include "flutter/shell/platform/linux/fl_dart_project_private.h"
18 #include "flutter/shell/platform/linux/fl_display_monitor.h"
19 #include "flutter/shell/platform/linux/fl_engine_private.h"
20 #include "flutter/shell/platform/linux/fl_keyboard_handler.h"
21 #include "flutter/shell/platform/linux/fl_opengl_manager.h"
22 #include "flutter/shell/platform/linux/fl_pixel_buffer_texture_private.h"
23 #include "flutter/shell/platform/linux/fl_platform_handler.h"
24 #include "flutter/shell/platform/linux/fl_plugin_registrar_private.h"
25 #include "flutter/shell/platform/linux/fl_settings_handler.h"
26 #include "flutter/shell/platform/linux/fl_texture_gl_private.h"
27 #include "flutter/shell/platform/linux/fl_texture_registrar_private.h"
28 #include "flutter/shell/platform/linux/fl_windowing_handler.h"
29 #include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registry.h"
30
31 // Unique number associated with platform tasks.
32 static constexpr size_t kPlatformTaskRunnerIdentifier = 1;
33
34 // Use different device ID for mouse and pan/zoom events, since we can't
35 // differentiate the actual device (mouse v.s. trackpad)
36 static constexpr int32_t kMousePointerDeviceId = 0;
37 static constexpr int32_t kPointerPanZoomDeviceId = 1;
38
39 struct _FlEngine {
40 GObject parent_instance;
41
42 // Thread the GLib main loop is running on.
43 GThread* thread;
44
45 // The project this engine is running.
46 FlDartProject* project;
47
48 // Watches for monitors changes to update engine.
49 FlDisplayMonitor* display_monitor;
50
51 // Renders the Flutter app.
52 FlCompositor* compositor;
53
54 // Manages OpenGL contexts.
55 FlOpenGLManager* opengl_manager;
56
57 // Messenger used to send and receive platform messages.
58 FlBinaryMessenger* binary_messenger;
59
60 // Implements the flutter/settings channel.
61 FlSettingsHandler* settings_handler;
62
63 // Implements the flutter/platform channel.
64 FlPlatformHandler* platform_handler;
65
66 // Implements the flutter/windowing channel.
67 FlWindowingHandler* windowing_handler;
68
69 // Process keyboard events.
70 FlKeyboardManager* keyboard_manager;
71
72 // Implements the flutter/textinput channel.
73 FlTextInputHandler* text_input_handler;
74
75 // Implements the flutter/keyboard channel.
76 FlKeyboardHandler* keyboard_handler;
77
78 // Implements the flutter/mousecursor channel.
79 FlMouseCursorHandler* mouse_cursor_handler;
80
81 // Manages textures rendered by native code.
82 FlTextureRegistrar* texture_registrar;
83
84 // Schedules tasks to be run on the appropriate thread.
85 FlTaskRunner* task_runner;
86
87 // Ahead of time data used to make engine run faster.
88 FlutterEngineAOTData aot_data;
89
90 // The Flutter engine.
91 FLUTTER_API_SYMBOL(FlutterEngine) engine;
92
93 // Function table for engine API, used to intercept engine calls for testing
94 // purposes.
95 FlutterEngineProcTable embedder_api;
96
97 // Next ID to use for a view.
98 FlutterViewId next_view_id;
99
100 // Objects rendering the views.
101 GHashTable* renderables_by_view_id;
102
103 // Function to call when a platform message is received.
104 FlEnginePlatformMessageHandler platform_message_handler;
105 gpointer platform_message_handler_data;
106 GDestroyNotify platform_message_handler_destroy_notify;
107 };
108
109 G_DEFINE_QUARK(fl_engine_error_quark, fl_engine_error)
110
111 static void fl_engine_plugin_registry_iface_init(
112 FlPluginRegistryInterface* iface);
113
114 enum { SIGNAL_ON_PRE_ENGINE_RESTART, SIGNAL_UPDATE_SEMANTICS, LAST_SIGNAL };
115
116 static guint fl_engine_signals[LAST_SIGNAL];
117
118 G_DEFINE_TYPE_WITH_CODE(
119 FlEngine,
120 fl_engine,
121 G_TYPE_OBJECT,
122 G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(),
123 fl_engine_plugin_registry_iface_init))
124
125 enum { PROP_0, PROP_BINARY_MESSENGER, PROP_LAST };
126
127 // Parse a locale into its components.
128 static void parse_locale(const gchar* locale,
129 gchar** language,
130 gchar** territory,
131 gchar** codeset,
132 gchar** modifier) {
133 gchar* l = g_strdup(locale);
134
135 // Locales are in the form "language[_territory][.codeset][@modifier]"
136 gchar* match = strrchr(l, '@');
137 if (match != nullptr) {
138 if (modifier != nullptr) {
139 *modifier = g_strdup(match + 1);
140 }
141 *match = '\0';
142 } else if (modifier != nullptr) {
143 *modifier = nullptr;
144 }
145
146 match = strrchr(l, '.');
147 if (match != nullptr) {
148 if (codeset != nullptr) {
149 *codeset = g_strdup(match + 1);
150 }
151 *match = '\0';
152 } else if (codeset != nullptr) {
153 *codeset = nullptr;
154 }
155
156 match = strrchr(l, '_');
157 if (match != nullptr) {
158 if (territory != nullptr) {
159 *territory = g_strdup(match + 1);
160 }
161 *match = '\0';
162 } else if (territory != nullptr) {
163 *territory = nullptr;
164 }
165
166 if (language != nullptr) {
167 *language = l;
168 }
169 }
170
171 static void view_added_cb(const FlutterAddViewResult* result) {
172 g_autoptr(GTask) task = G_TASK(result->user_data);
173
174 if (result->added) {
175 g_task_return_boolean(task, TRUE);
176 } else {
177 g_task_return_new_error(task, fl_engine_error_quark(),
178 FL_ENGINE_ERROR_FAILED, "Failed to add view");
179 }
180 }
181
182 static void view_removed_cb(const FlutterRemoveViewResult* result) {
183 g_autoptr(GTask) task = G_TASK(result->user_data);
184
185 if (result->removed) {
186 g_task_return_boolean(task, TRUE);
187 } else {
188 g_task_return_new_error(task, fl_engine_error_quark(),
189 FL_ENGINE_ERROR_FAILED, "Failed to remove view");
190 }
191 }
192
193 static void free_locale(FlutterLocale* locale) {
194 free(const_cast<gchar*>(locale->language_code));
195 free(const_cast<gchar*>(locale->country_code));
196 free(locale);
197 }
198
199 // Passes locale information to the Flutter engine.
200 static void setup_locales(FlEngine* self) {
201 const gchar* const* languages = g_get_language_names();
202 g_autoptr(GPtrArray) locales_array = g_ptr_array_new_with_free_func(
203 reinterpret_cast<GDestroyNotify>(free_locale));
204 for (int i = 0; languages[i] != nullptr; i++) {
205 g_autofree gchar* locale_string = g_strstrip(g_strdup(languages[i]));
206
207 // Ignore empty locales, caused by settings like `LANGUAGE=pt_BR:`
208 if (strcmp(locale_string, "") == 0) {
209 continue;
210 }
211
212 g_autofree gchar* language = nullptr;
213 g_autofree gchar* territory = nullptr;
214 parse_locale(locale_string, &language, &territory, nullptr, nullptr);
215
216 // Ignore duplicate locales, caused by settings like `LANGUAGE=C` (returns
217 // two "C") or `LANGUAGE=en:en`
218 gboolean has_locale = FALSE;
219 for (guint j = 0; !has_locale && j < locales_array->len; j++) {
220 FlutterLocale* locale =
221 reinterpret_cast<FlutterLocale*>(g_ptr_array_index(locales_array, j));
222 has_locale = g_strcmp0(locale->language_code, language) == 0 &&
223 g_strcmp0(locale->country_code, territory) == 0;
224 }
225 if (has_locale) {
226 continue;
227 }
228
229 FlutterLocale* locale =
230 static_cast<FlutterLocale*>(g_malloc0(sizeof(FlutterLocale)));
231 g_ptr_array_add(locales_array, locale);
232 locale->struct_size = sizeof(FlutterLocale);
233 locale->language_code =
234 reinterpret_cast<const gchar*>(g_steal_pointer(&language));
235 locale->country_code =
236 reinterpret_cast<const gchar*>(g_steal_pointer(&territory));
237 locale->script_code = nullptr;
238 locale->variant_code = nullptr;
239 }
240 FlutterLocale** locales =
241 reinterpret_cast<FlutterLocale**>(locales_array->pdata);
242 FlutterEngineResult result = self->embedder_api.UpdateLocales(
243 self->engine, const_cast<const FlutterLocale**>(locales),
244 locales_array->len);
245 if (result != kSuccess) {
246 g_warning("Failed to set up Flutter locales");
247 }
248 }
249
250 // Called when engine needs a backing store for a specific #FlutterLayer.
251 static bool compositor_create_backing_store_callback(
252 const FlutterBackingStoreConfig* config,
253 FlutterBackingStore* backing_store_out,
254 void* user_data) {
255 FlEngine* self = static_cast<FlEngine*>(user_data);
256 return fl_compositor_create_backing_store(self->compositor, config,
257 backing_store_out);
258 }
259
260 // Called when the backing store is to be released.
261 static bool compositor_collect_backing_store_callback(
262 const FlutterBackingStore* backing_store,
263 void* user_data) {
264 FlEngine* self = static_cast<FlEngine*>(user_data);
265 return fl_compositor_collect_backing_store(self->compositor, backing_store);
266 }
267
268 // Called when embedder should composite contents of each layer onto the screen.
269 static bool compositor_present_view_callback(
270 const FlutterPresentViewInfo* info) {
271 FlEngine* self = static_cast<FlEngine*>(info->user_data);
272 return fl_compositor_present_layers(self->compositor, info->view_id,
273 info->layers, info->layers_count);
274 }
275
276 // Flutter engine rendering callbacks.
277
278 static void* fl_engine_gl_proc_resolver(void* user_data, const char* name) {
279 return reinterpret_cast<void*>(eglGetProcAddress(name));
280 }
281
282 static bool fl_engine_gl_make_current(void* user_data) {
283 FlEngine* self = static_cast<FlEngine*>(user_data);
284 fl_opengl_manager_make_current(self->opengl_manager);
285 return true;
286 }
287
288 static bool fl_engine_gl_clear_current(void* user_data) {
289 FlEngine* self = static_cast<FlEngine*>(user_data);
290 fl_opengl_manager_clear_current(self->opengl_manager);
291 return true;
292 }
293
294 static uint32_t fl_engine_gl_get_fbo(void* user_data) {
295 // There is only one frame buffer object - always return that.
296 return 0;
297 }
298
299 static bool fl_engine_gl_present(void* user_data) {
300 // No action required, as this is handled in
301 // compositor_present_view_callback.
302 return true;
303 }
304
305 static bool fl_engine_gl_make_resource_current(void* user_data) {
306 FlEngine* self = static_cast<FlEngine*>(user_data);
307 fl_opengl_manager_make_resource_current(self->opengl_manager);
308 return true;
309 }
310
311 // Called by the engine to retrieve an external texture.
312 static bool fl_engine_gl_external_texture_frame_callback(
313 void* user_data,
314 int64_t texture_id,
315 size_t width,
316 size_t height,
317 FlutterOpenGLTexture* opengl_texture) {
318 FlEngine* self = static_cast<FlEngine*>(user_data);
319 if (!self->texture_registrar) {
320 return false;
321 }
322
323 FlTexture* texture =
324 fl_texture_registrar_lookup_texture(self->texture_registrar, texture_id);
325 if (texture == nullptr) {
326 g_warning("Unable to find texture %" G_GINT64_FORMAT, texture_id);
327 return false;
328 }
329
330 gboolean result;
331 g_autoptr(GError) error = nullptr;
332 if (FL_IS_TEXTURE_GL(texture)) {
333 result = fl_texture_gl_populate(FL_TEXTURE_GL(texture), width, height,
334 opengl_texture, &error);
335 } else if (FL_IS_PIXEL_BUFFER_TEXTURE(texture)) {
336 result =
337 fl_pixel_buffer_texture_populate(FL_PIXEL_BUFFER_TEXTURE(texture),
338 width, height, opengl_texture, &error);
339 } else {
340 g_warning("Unsupported texture type %" G_GINT64_FORMAT, texture_id);
341 return false;
342 }
343
344 if (!result) {
345 g_warning("%s", error->message);
346 return false;
347 }
348
349 return true;
350 }
351
352 // Called by the engine to determine if it is on the GTK thread.
353 static bool fl_engine_runs_task_on_current_thread(void* user_data) {
354 FlEngine* self = static_cast<FlEngine*>(user_data);
355 return self->thread == g_thread_self();
356 }
357
358 // Called when the engine has a task to perform in the GTK thread.
359 static void fl_engine_post_task(FlutterTask task,
360 uint64_t target_time_nanos,
361 void* user_data) {
362 FlEngine* self = static_cast<FlEngine*>(user_data);
363
364 fl_task_runner_post_flutter_task(self->task_runner, task, target_time_nanos);
365 }
366
367 // Called when a platform message is received from the engine.
368 static void fl_engine_platform_message_cb(const FlutterPlatformMessage* message,
369 void* user_data) {
370 FlEngine* self = FL_ENGINE(user_data);
371
372 gboolean handled = FALSE;
373 if (self->platform_message_handler != nullptr) {
374 g_autoptr(GBytes) data =
375 g_bytes_new(message->message, message->message_size);
376 handled = self->platform_message_handler(
377 self, message->channel, data, message->response_handle,
378 self->platform_message_handler_data);
379 }
380
381 if (!handled) {
382 fl_engine_send_platform_message_response(self, message->response_handle,
383 nullptr, nullptr);
384 }
385 }
386
387 // Called when a semantic node update is received from the engine.
388 static void fl_engine_update_semantics_cb(const FlutterSemanticsUpdate2* update,
389 void* user_data) {
390 FlEngine* self = FL_ENGINE(user_data);
391
392 g_signal_emit(self, fl_engine_signals[SIGNAL_UPDATE_SEMANTICS], 0, update);
393 }
394
395 static void setup_keyboard(FlEngine* self) {
396 g_clear_object(&self->keyboard_manager);
397 self->keyboard_manager = fl_keyboard_manager_new(self);
398
399 g_clear_object(&self->keyboard_handler);
400 self->keyboard_handler =
401 fl_keyboard_handler_new(self->binary_messenger, self->keyboard_manager);
402
403 GtkWidget* widget =
404 self->text_input_handler != nullptr
405 ? fl_text_input_handler_get_widget(self->text_input_handler)
406 : nullptr;
407 g_clear_object(&self->text_input_handler);
408 self->text_input_handler = fl_text_input_handler_new(self->binary_messenger);
409 if (widget != nullptr) {
410 fl_text_input_handler_set_widget(self->text_input_handler, widget);
411 }
412 }
413
414 // Called right before the engine is restarted.
415 //
416 // This method should reset states to as if the engine has just been started,
417 // which usually indicates the user has requested a hot restart (Shift-R in the
418 // Flutter CLI.)
419 static void fl_engine_on_pre_engine_restart_cb(void* user_data) {
420 FlEngine* self = FL_ENGINE(user_data);
421
422 setup_keyboard(self);
423
424 g_signal_emit(self, fl_engine_signals[SIGNAL_ON_PRE_ENGINE_RESTART], 0);
425 }
426
427 // Called when a response to a sent platform message is received from the
428 // engine.
429 static void fl_engine_platform_message_response_cb(const uint8_t* data,
430 size_t data_length,
431 void* user_data) {
432 g_autoptr(GTask) task = G_TASK(user_data);
433 g_task_return_pointer(task, g_bytes_new(data, data_length),
434 reinterpret_cast<GDestroyNotify>(g_bytes_unref));
435 }
436
437 // Implements FlPluginRegistry::get_registrar_for_plugin.
438 static FlPluginRegistrar* fl_engine_get_registrar_for_plugin(
439 FlPluginRegistry* registry,
440 const gchar* name) {
441 FlEngine* self = FL_ENGINE(registry);
442
443 return fl_plugin_registrar_new(nullptr, self->binary_messenger,
444 self->texture_registrar);
445 }
446
447 static void fl_engine_plugin_registry_iface_init(
448 FlPluginRegistryInterface* iface) {
449 iface->get_registrar_for_plugin = fl_engine_get_registrar_for_plugin;
450 }
451
452 static void fl_engine_set_property(GObject* object,
453 guint prop_id,
454 const GValue* value,
455 GParamSpec* pspec) {
456 FlEngine* self = FL_ENGINE(object);
457 switch (prop_id) {
458 case PROP_BINARY_MESSENGER:
459 g_set_object(&self->binary_messenger,
460 FL_BINARY_MESSENGER(g_value_get_object(value)));
461 break;
462 default:
463 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
464 break;
465 }
466 }
467
468 static void fl_engine_dispose(GObject* object) {
469 FlEngine* self = FL_ENGINE(object);
470
471 if (self->engine != nullptr) {
472 self->embedder_api.Shutdown(self->engine);
473 self->engine = nullptr;
474 }
475
476 if (self->aot_data != nullptr) {
477 self->embedder_api.CollectAOTData(self->aot_data);
478 self->aot_data = nullptr;
479 }
480
481 fl_binary_messenger_shutdown(self->binary_messenger);
482 fl_texture_registrar_shutdown(self->texture_registrar);
483
484 g_clear_object(&self->project);
485 g_clear_object(&self->display_monitor);
486 g_clear_object(&self->compositor);
487 g_clear_object(&self->opengl_manager);
488 g_clear_object(&self->texture_registrar);
489 g_clear_object(&self->binary_messenger);
490 g_clear_object(&self->settings_handler);
491 g_clear_object(&self->platform_handler);
492 g_clear_object(&self->windowing_handler);
493 g_clear_object(&self->keyboard_manager);
494 g_clear_object(&self->text_input_handler);
495 g_clear_object(&self->keyboard_handler);
496 g_clear_object(&self->mouse_cursor_handler);
497 g_clear_object(&self->task_runner);
498 g_clear_pointer(&self->renderables_by_view_id, g_hash_table_unref);
499
500 if (self->platform_message_handler_destroy_notify) {
501 self->platform_message_handler_destroy_notify(
502 self->platform_message_handler_data);
503 }
504 self->platform_message_handler_data = nullptr;
505 self->platform_message_handler_destroy_notify = nullptr;
506
507 G_OBJECT_CLASS(fl_engine_parent_class)->dispose(object);
508 }
509
510 static void fl_engine_class_init(FlEngineClass* klass) {
511 G_OBJECT_CLASS(klass)->dispose = fl_engine_dispose;
512 G_OBJECT_CLASS(klass)->set_property = fl_engine_set_property;
513
514 g_object_class_install_property(
515 G_OBJECT_CLASS(klass), PROP_BINARY_MESSENGER,
516 g_param_spec_object(
517 "binary-messenger", "messenger", "Binary messenger",
518 fl_binary_messenger_get_type(),
519 static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
520 G_PARAM_STATIC_STRINGS)));
521
522 fl_engine_signals[SIGNAL_ON_PRE_ENGINE_RESTART] = g_signal_new(
523 "on-pre-engine-restart", fl_engine_get_type(), G_SIGNAL_RUN_LAST, 0,
524 nullptr, nullptr, nullptr, G_TYPE_NONE, 0);
525 fl_engine_signals[SIGNAL_UPDATE_SEMANTICS] = g_signal_new(
526 "update-semantics", fl_engine_get_type(), G_SIGNAL_RUN_LAST, 0, nullptr,
527 nullptr, nullptr, G_TYPE_NONE, 1, G_TYPE_POINTER);
528 }
529
530 static void fl_engine_init(FlEngine* self) {
531 self->thread = g_thread_self();
532
533 self->embedder_api.struct_size = sizeof(FlutterEngineProcTable);
534 if (FlutterEngineGetProcAddresses(&self->embedder_api) != kSuccess) {
535 g_warning("Failed get get engine function pointers");
536 }
537
538 self->opengl_manager = fl_opengl_manager_new();
539
540 self->display_monitor =
541 fl_display_monitor_new(self, gdk_display_get_default());
542 self->task_runner = fl_task_runner_new(self);
543
544 // Implicit view is 0, so start at 1.
545 self->next_view_id = 1;
546 self->renderables_by_view_id = g_hash_table_new_full(
547 g_direct_hash, g_direct_equal, nullptr, [](gpointer value) {
548 GWeakRef* ref = static_cast<GWeakRef*>(value);
549 g_weak_ref_clear(ref);
550 free(ref);
551 });
552
553 self->texture_registrar = fl_texture_registrar_new(self);
554 }
555
556 static FlEngine* fl_engine_new_full(FlDartProject* project,
557 FlBinaryMessenger* binary_messenger) {
558 g_return_val_if_fail(FL_IS_DART_PROJECT(project), nullptr);
559
560 FlEngine* self = FL_ENGINE(g_object_new(fl_engine_get_type(), nullptr));
561
562 self->project = FL_DART_PROJECT(g_object_ref(project));
563 self->compositor = FL_COMPOSITOR(fl_compositor_opengl_new(self));
564 if (binary_messenger != nullptr) {
565 self->binary_messenger =
566 FL_BINARY_MESSENGER(g_object_ref(binary_messenger));
567 } else {
568 self->binary_messenger = fl_binary_messenger_new(self);
569 }
570 self->keyboard_manager = fl_keyboard_manager_new(self);
571 self->mouse_cursor_handler =
572 fl_mouse_cursor_handler_new(self->binary_messenger);
573 self->windowing_handler = fl_windowing_handler_new(self);
574
575 return self;
576 }
577
578 FlEngine* fl_engine_for_id(int64_t id) {
579 void* engine = reinterpret_cast<void*>(id);
580 g_return_val_if_fail(FL_IS_ENGINE(engine), nullptr);
581 return FL_ENGINE(engine);
582 }
583
584 G_MODULE_EXPORT FlEngine* fl_engine_new(FlDartProject* project) {
585 return fl_engine_new_full(project, nullptr);
586 }
587
588 FlEngine* fl_engine_new_with_binary_messenger(
589 FlBinaryMessenger* binary_messenger) {
590 g_autoptr(FlDartProject) project = fl_dart_project_new();
591 return fl_engine_new_full(project, binary_messenger);
592 }
593
594 G_MODULE_EXPORT FlEngine* fl_engine_new_headless(FlDartProject* project) {
595 return fl_engine_new(project);
596 }
597
598 FlCompositor* fl_engine_get_compositor(FlEngine* self) {
599 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
600 return self->compositor;
601 }
602
603 FlOpenGLManager* fl_engine_get_opengl_manager(FlEngine* self) {
604 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
605 return self->opengl_manager;
606 }
607
608 FlDisplayMonitor* fl_engine_get_display_monitor(FlEngine* self) {
609 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
610 return self->display_monitor;
611 }
612
613 gboolean fl_engine_start(FlEngine* self, GError** error) {
614 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
615
616 FlutterRendererConfig config = {};
617 config.type = kOpenGL;
618 config.open_gl.struct_size = sizeof(FlutterOpenGLRendererConfig);
619 config.open_gl.gl_proc_resolver = fl_engine_gl_proc_resolver;
620 config.open_gl.make_current = fl_engine_gl_make_current;
621 config.open_gl.clear_current = fl_engine_gl_clear_current;
622 config.open_gl.fbo_callback = fl_engine_gl_get_fbo;
623 config.open_gl.present = fl_engine_gl_present;
624 config.open_gl.make_resource_current = fl_engine_gl_make_resource_current;
625 config.open_gl.gl_external_texture_frame_callback =
626 fl_engine_gl_external_texture_frame_callback;
627
628 FlutterTaskRunnerDescription platform_task_runner = {};
629 platform_task_runner.struct_size = sizeof(FlutterTaskRunnerDescription);
630 platform_task_runner.user_data = self;
631 platform_task_runner.runs_task_on_current_thread_callback =
632 fl_engine_runs_task_on_current_thread;
633 platform_task_runner.post_task_callback = fl_engine_post_task;
634 platform_task_runner.identifier = kPlatformTaskRunnerIdentifier;
635
636 FlutterCustomTaskRunners custom_task_runners = {};
637 custom_task_runners.struct_size = sizeof(FlutterCustomTaskRunners);
638 custom_task_runners.platform_task_runner = &platform_task_runner;
639
640 g_autoptr(GPtrArray) command_line_args =
641 g_ptr_array_new_with_free_func(g_free);
642 g_ptr_array_insert(command_line_args, 0, g_strdup("flutter"));
643 for (const auto& env_switch : flutter::GetSwitchesFromEnvironment()) {
644 g_ptr_array_add(command_line_args, g_strdup(env_switch.c_str()));
645 }
646
647 gchar** dart_entrypoint_args =
648 fl_dart_project_get_dart_entrypoint_arguments(self->project);
649
650 FlutterProjectArgs args = {};
651 args.struct_size = sizeof(FlutterProjectArgs);
652 args.assets_path = fl_dart_project_get_assets_path(self->project);
653 args.icu_data_path = fl_dart_project_get_icu_data_path(self->project);
654 args.command_line_argc = command_line_args->len;
655 args.command_line_argv =
656 reinterpret_cast<const char* const*>(command_line_args->pdata);
657 args.platform_message_callback = fl_engine_platform_message_cb;
658 args.update_semantics_callback2 = fl_engine_update_semantics_cb;
659 args.custom_task_runners = &custom_task_runners;
660 args.shutdown_dart_vm_when_done = true;
661 args.on_pre_engine_restart_callback = fl_engine_on_pre_engine_restart_cb;
662 args.dart_entrypoint_argc =
663 dart_entrypoint_args != nullptr ? g_strv_length(dart_entrypoint_args) : 0;
664 args.dart_entrypoint_argv =
665 reinterpret_cast<const char* const*>(dart_entrypoint_args);
666 args.engine_id = reinterpret_cast<int64_t>(self);
667
668 FlutterCompositor compositor = {};
669 compositor.struct_size = sizeof(FlutterCompositor);
670 compositor.user_data = self;
671 compositor.create_backing_store_callback =
672 compositor_create_backing_store_callback;
673 compositor.collect_backing_store_callback =
674 compositor_collect_backing_store_callback;
675 compositor.present_view_callback = compositor_present_view_callback;
676 args.compositor = &compositor;
677
678 if (self->embedder_api.RunsAOTCompiledDartCode()) {
679 FlutterEngineAOTDataSource source = {};
680 source.type = kFlutterEngineAOTDataSourceTypeElfPath;
681 source.elf_path = fl_dart_project_get_aot_library_path(self->project);
682 if (self->embedder_api.CreateAOTData(&source, &self->aot_data) !=
683 kSuccess) {
684 g_set_error(error, fl_engine_error_quark(), FL_ENGINE_ERROR_FAILED,
685 "Failed to create AOT data");
686 return FALSE;
687 }
688 args.aot_data = self->aot_data;
689 }
690
691 FlutterEngineResult result = self->embedder_api.Initialize(
692 FLUTTER_ENGINE_VERSION, &config, &args, self, &self->engine);
693 if (result != kSuccess) {
694 g_set_error(error, fl_engine_error_quark(), FL_ENGINE_ERROR_FAILED,
695 "Failed to initialize Flutter engine");
696 return FALSE;
697 }
698
699 result = self->embedder_api.RunInitialized(self->engine);
700 if (result != kSuccess) {
701 g_set_error(error, fl_engine_error_quark(), FL_ENGINE_ERROR_FAILED,
702 "Failed to run Flutter engine");
703 return FALSE;
704 }
705
706 setup_locales(self);
707
708 g_autoptr(FlSettings) settings = fl_settings_new();
709 self->settings_handler = fl_settings_handler_new(self);
710 fl_settings_handler_start(self->settings_handler, settings);
711
712 self->platform_handler = fl_platform_handler_new(self->binary_messenger);
713
714 setup_keyboard(self);
715
716 result = self->embedder_api.UpdateSemanticsEnabled(self->engine, TRUE);
717 if (result != kSuccess) {
718 g_warning("Failed to enable accessibility features on Flutter engine");
719 }
720
721 fl_display_monitor_start(self->display_monitor);
722
723 return TRUE;
724 }
725
726 FlutterEngineProcTable* fl_engine_get_embedder_api(FlEngine* self) {
727 return &(self->embedder_api);
728 }
729
730 void fl_engine_notify_display_update(FlEngine* self,
731 const FlutterEngineDisplay* displays,
732 size_t displays_length) {
733 g_return_if_fail(FL_IS_ENGINE(self));
734
735 FlutterEngineResult result = self->embedder_api.NotifyDisplayUpdate(
736 self->engine, kFlutterEngineDisplaysUpdateTypeStartup, displays,
737 displays_length);
738 if (result != kSuccess) {
739 g_warning("Failed to notify display update to Flutter engine: %d", result);
740 }
741 }
742
743 void fl_engine_set_implicit_view(FlEngine* self, FlRenderable* renderable) {
744 GWeakRef* ref = g_new(GWeakRef, 1);
745 g_weak_ref_init(ref, G_OBJECT(renderable));
746 g_hash_table_insert(self->renderables_by_view_id,
747 GINT_TO_POINTER(flutter::kFlutterImplicitViewId), ref);
748 }
749
750 FlutterViewId fl_engine_add_view(FlEngine* self,
751 FlRenderable* renderable,
752 size_t width,
753 size_t height,
754 double pixel_ratio,
755 GCancellable* cancellable,
756 GAsyncReadyCallback callback,
757 gpointer user_data) {
758 g_return_val_if_fail(FL_IS_ENGINE(self), -1);
759
760 g_autoptr(GTask) task = g_task_new(self, cancellable, callback, user_data);
761
762 FlutterViewId view_id = self->next_view_id;
763 self->next_view_id++;
764
765 GWeakRef* ref = g_new(GWeakRef, 1);
766 g_weak_ref_init(ref, G_OBJECT(renderable));
767 g_hash_table_insert(self->renderables_by_view_id, GINT_TO_POINTER(view_id),
768 ref);
769
770 // We don't know which display this view will open on, so set to zero and this
771 // will be updated in a following FlutterWindowMetricsEvent
772 FlutterEngineDisplayId display_id = 0;
773
774 FlutterWindowMetricsEvent metrics;
775 metrics.struct_size = sizeof(FlutterWindowMetricsEvent);
776 metrics.width = width;
777 metrics.height = height;
778 metrics.pixel_ratio = pixel_ratio;
779 metrics.display_id = display_id;
780 metrics.view_id = view_id;
781 FlutterAddViewInfo info;
782 info.struct_size = sizeof(FlutterAddViewInfo);
783 info.view_id = view_id;
784 info.view_metrics = &metrics;
785 info.user_data = g_object_ref(task);
786 info.add_view_callback = view_added_cb;
787 FlutterEngineResult result = self->embedder_api.AddView(self->engine, &info);
788 if (result != kSuccess) {
789 g_task_return_new_error(task, fl_engine_error_quark(),
790 FL_ENGINE_ERROR_FAILED, "AddView returned %d",
791 result);
792 // This would have been done in the callback, but that won't occur now.
793 g_object_unref(task);
794 }
795
796 return view_id;
797 }
798
799 gboolean fl_engine_add_view_finish(FlEngine* self,
800 GAsyncResult* result,
801 GError** error) {
802 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
803 return g_task_propagate_boolean(G_TASK(result), error);
804 }
805
806 FlRenderable* fl_engine_get_renderable(FlEngine* self, FlutterViewId view_id) {
807 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
808
809 GWeakRef* ref = static_cast<GWeakRef*>(g_hash_table_lookup(
810 self->renderables_by_view_id, GINT_TO_POINTER(view_id)));
811 return FL_RENDERABLE(g_weak_ref_get(ref));
812 }
813
814 void fl_engine_remove_view(FlEngine* self,
815 FlutterViewId view_id,
816 GCancellable* cancellable,
817 GAsyncReadyCallback callback,
818 gpointer user_data) {
819 g_return_if_fail(FL_IS_ENGINE(self));
820
821 g_hash_table_remove(self->renderables_by_view_id, GINT_TO_POINTER(view_id));
822
823 g_autoptr(GTask) task = g_task_new(self, cancellable, callback, user_data);
824
825 FlutterRemoveViewInfo info;
826 info.struct_size = sizeof(FlutterRemoveViewInfo);
827 info.view_id = view_id;
828 info.user_data = g_object_ref(task);
829 info.remove_view_callback = view_removed_cb;
830 FlutterEngineResult result =
831 self->embedder_api.RemoveView(self->engine, &info);
832 if (result != kSuccess) {
833 g_task_return_new_error(task, fl_engine_error_quark(),
834 FL_ENGINE_ERROR_FAILED, "RemoveView returned %d",
835 result);
836 // This would have been done in the callback, but that won't occur now.
837 g_object_unref(task);
838 }
839 }
840
841 gboolean fl_engine_remove_view_finish(FlEngine* self,
842 GAsyncResult* result,
843 GError** error) {
844 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
845 return g_task_propagate_boolean(G_TASK(result), error);
846 }
847
848 void fl_engine_set_platform_message_handler(
849 FlEngine* self,
850 FlEnginePlatformMessageHandler handler,
851 gpointer user_data,
852 GDestroyNotify destroy_notify) {
853 g_return_if_fail(FL_IS_ENGINE(self));
854 g_return_if_fail(handler != nullptr);
855
856 if (self->platform_message_handler_destroy_notify) {
857 self->platform_message_handler_destroy_notify(
858 self->platform_message_handler_data);
859 }
860
861 self->platform_message_handler = handler;
862 self->platform_message_handler_data = user_data;
863 self->platform_message_handler_destroy_notify = destroy_notify;
864 }
865
866 // Note: This function can be called from any thread.
867 gboolean fl_engine_send_platform_message_response(
868 FlEngine* self,
869 const FlutterPlatformMessageResponseHandle* handle,
870 GBytes* response,
871 GError** error) {
872 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
873 g_return_val_if_fail(handle != nullptr, FALSE);
874
875 if (self->engine == nullptr) {
876 g_set_error(error, fl_engine_error_quark(), FL_ENGINE_ERROR_FAILED,
877 "No engine to send response to");
878 return FALSE;
879 }
880
881 gsize data_length = 0;
882 const uint8_t* data = nullptr;
883 if (response != nullptr) {
884 data =
885 static_cast<const uint8_t*>(g_bytes_get_data(response, &data_length));
886 }
887 FlutterEngineResult result = self->embedder_api.SendPlatformMessageResponse(
888 self->engine, handle, data, data_length);
889
890 if (result != kSuccess) {
891 g_set_error(error, fl_engine_error_quark(), FL_ENGINE_ERROR_FAILED,
892 "Failed to send platform message response");
893 return FALSE;
894 }
895
896 return TRUE;
897 }
898
899 void fl_engine_send_platform_message(FlEngine* self,
900 const gchar* channel,
901 GBytes* message,
902 GCancellable* cancellable,
903 GAsyncReadyCallback callback,
904 gpointer user_data) {
905 g_return_if_fail(FL_IS_ENGINE(self));
906
907 GTask* task = nullptr;
908 FlutterPlatformMessageResponseHandle* response_handle = nullptr;
909 if (callback != nullptr) {
910 task = g_task_new(self, cancellable, callback, user_data);
911
912 if (self->engine == nullptr) {
913 g_task_return_new_error(task, fl_engine_error_quark(),
914 FL_ENGINE_ERROR_FAILED, "No engine to send to");
915 return;
916 }
917
918 FlutterEngineResult result =
919 self->embedder_api.PlatformMessageCreateResponseHandle(
920 self->engine, fl_engine_platform_message_response_cb, task,
921 &response_handle);
922 if (result != kSuccess) {
923 g_task_return_new_error(task, fl_engine_error_quark(),
924 FL_ENGINE_ERROR_FAILED,
925 "Failed to create response handle");
926 g_object_unref(task);
927 return;
928 }
929 } else if (self->engine == nullptr) {
930 return;
931 }
932
933 FlutterPlatformMessage fl_message = {};
934 fl_message.struct_size = sizeof(fl_message);
935 fl_message.channel = channel;
936 fl_message.message =
937 message != nullptr
938 ? static_cast<const uint8_t*>(g_bytes_get_data(message, nullptr))
939 : nullptr;
940 fl_message.message_size = message != nullptr ? g_bytes_get_size(message) : 0;
941 fl_message.response_handle = response_handle;
942 FlutterEngineResult result =
943 self->embedder_api.SendPlatformMessage(self->engine, &fl_message);
944
945 if (result != kSuccess && task != nullptr) {
946 g_task_return_new_error(task, fl_engine_error_quark(),
947 FL_ENGINE_ERROR_FAILED,
948 "Failed to send platform messages");
949 g_object_unref(task);
950 }
951
952 if (response_handle != nullptr) {
953 self->embedder_api.PlatformMessageReleaseResponseHandle(self->engine,
954 response_handle);
955 }
956 }
957
958 GBytes* fl_engine_send_platform_message_finish(FlEngine* self,
959 GAsyncResult* result,
960 GError** error) {
961 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
962 g_return_val_if_fail(g_task_is_valid(result, self), FALSE);
963
964 return static_cast<GBytes*>(g_task_propagate_pointer(G_TASK(result), error));
965 }
966
967 void fl_engine_send_window_metrics_event(FlEngine* self,
968 FlutterEngineDisplayId display_id,
969 FlutterViewId view_id,
970 size_t width,
971 size_t height,
972 double pixel_ratio) {
973 g_return_if_fail(FL_IS_ENGINE(self));
974
975 if (self->engine == nullptr) {
976 return;
977 }
978
979 FlutterWindowMetricsEvent event = {};
980 event.struct_size = sizeof(FlutterWindowMetricsEvent);
981 event.width = width;
982 event.height = height;
983 event.pixel_ratio = pixel_ratio;
984 event.display_id = display_id;
985 event.view_id = view_id;
986 self->embedder_api.SendWindowMetricsEvent(self->engine, &event);
987 }
988
989 void fl_engine_send_mouse_pointer_event(FlEngine* self,
990 FlutterViewId view_id,
991 FlutterPointerPhase phase,
992 size_t timestamp,
993 double x,
994 double y,
995 FlutterPointerDeviceKind device_kind,
996 double scroll_delta_x,
997 double scroll_delta_y,
998 int64_t buttons) {
999 g_return_if_fail(FL_IS_ENGINE(self));
1000
1001 if (self->engine == nullptr) {
1002 return;
1003 }
1004
1005 FlutterPointerEvent fl_event = {};
1006 fl_event.struct_size = sizeof(fl_event);
1007 fl_event.phase = phase;
1008 fl_event.timestamp = timestamp;
1009 fl_event.x = x;
1010 fl_event.y = y;
1011 if (scroll_delta_x != 0 || scroll_delta_y != 0) {
1012 fl_event.signal_kind = kFlutterPointerSignalKindScroll;
1013 }
1014 fl_event.scroll_delta_x = scroll_delta_x;
1015 fl_event.scroll_delta_y = scroll_delta_y;
1016 fl_event.device_kind = device_kind;
1017 fl_event.buttons = buttons;
1018 fl_event.device = kMousePointerDeviceId;
1019 fl_event.view_id = view_id;
1020 self->embedder_api.SendPointerEvent(self->engine, &fl_event, 1);
1021 }
1022
1023 void fl_engine_send_touch_up_event(FlEngine* self,
1024 FlutterViewId view_id,
1025 size_t timestamp,
1026 double x,
1027 double y,
1028 int32_t device) {
1029 g_return_if_fail(FL_IS_ENGINE(self));
1030
1031 if (self->engine == nullptr) {
1032 return;
1033 }
1034
1035 FlutterPointerEvent event;
1036 event.timestamp = timestamp;
1037 event.x = x;
1038 event.y = y;
1039 event.device_kind = kFlutterPointerDeviceKindTouch;
1040 event.device = device;
1041 event.buttons = 0;
1042 event.view_id = view_id;
1043 event.phase = FlutterPointerPhase::kUp;
1044 event.struct_size = sizeof(event);
1045
1046 self->embedder_api.SendPointerEvent(self->engine, &event, 1);
1047 }
1048
1049 void fl_engine_send_touch_down_event(FlEngine* self,
1050 FlutterViewId view_id,
1051 size_t timestamp,
1052 double x,
1053 double y,
1054 int32_t device) {
1055 g_return_if_fail(FL_IS_ENGINE(self));
1056
1057 if (self->engine == nullptr) {
1058 return;
1059 }
1060
1061 FlutterPointerEvent event;
1062 event.timestamp = timestamp;
1063 event.x = x;
1064 event.y = y;
1065 event.device_kind = kFlutterPointerDeviceKindTouch;
1066 event.device = device;
1067 event.buttons = FlutterPointerMouseButtons::kFlutterPointerButtonMousePrimary;
1068 event.view_id = view_id;
1069 event.phase = FlutterPointerPhase::kDown;
1070 event.struct_size = sizeof(event);
1071
1072 self->embedder_api.SendPointerEvent(self->engine, &event, 1);
1073 }
1074
1075 void fl_engine_send_touch_move_event(FlEngine* self,
1076 FlutterViewId view_id,
1077 size_t timestamp,
1078 double x,
1079 double y,
1080 int32_t device) {
1081 g_return_if_fail(FL_IS_ENGINE(self));
1082
1083 if (self->engine == nullptr) {
1084 return;
1085 }
1086
1087 FlutterPointerEvent event;
1088 event.timestamp = timestamp;
1089 event.x = x;
1090 event.y = y;
1091 event.device_kind = kFlutterPointerDeviceKindTouch;
1092 event.device = device;
1093 event.buttons = FlutterPointerMouseButtons::kFlutterPointerButtonMousePrimary;
1094 event.view_id = view_id;
1095 event.phase = FlutterPointerPhase::kMove;
1096 event.struct_size = sizeof(event);
1097
1098 self->embedder_api.SendPointerEvent(self->engine, &event, 1);
1099 }
1100
1101 void fl_engine_send_touch_add_event(FlEngine* self,
1102 FlutterViewId view_id,
1103 size_t timestamp,
1104 double x,
1105 double y,
1106 int32_t device) {
1107 g_return_if_fail(FL_IS_ENGINE(self));
1108
1109 if (self->engine == nullptr) {
1110 return;
1111 }
1112
1113 FlutterPointerEvent event;
1114 event.timestamp = timestamp;
1115 event.x = x;
1116 event.y = y;
1117 event.device_kind = kFlutterPointerDeviceKindTouch;
1118 event.device = device;
1119 event.buttons = 0;
1120 event.view_id = view_id;
1121 event.phase = FlutterPointerPhase::kAdd;
1122 event.struct_size = sizeof(event);
1123
1124 self->embedder_api.SendPointerEvent(self->engine, &event, 1);
1125 }
1126
1127 void fl_engine_send_touch_remove_event(FlEngine* self,
1128 FlutterViewId view_id,
1129 size_t timestamp,
1130 double x,
1131 double y,
1132 int32_t device) {
1133 g_return_if_fail(FL_IS_ENGINE(self));
1134
1135 if (self->engine == nullptr) {
1136 return;
1137 }
1138
1139 FlutterPointerEvent event;
1140 event.timestamp = timestamp;
1141 event.x = x;
1142 event.y = y;
1143 event.device_kind = kFlutterPointerDeviceKindTouch;
1144 event.device = device;
1145 event.buttons = 0;
1146 event.view_id = view_id;
1147 event.phase = FlutterPointerPhase::kRemove;
1148 event.struct_size = sizeof(event);
1149
1150 self->embedder_api.SendPointerEvent(self->engine, &event, 1);
1151 }
1152
1153 void fl_engine_send_pointer_pan_zoom_event(FlEngine* self,
1154 FlutterViewId view_id,
1155 size_t timestamp,
1156 double x,
1157 double y,
1158 FlutterPointerPhase phase,
1159 double pan_x,
1160 double pan_y,
1161 double scale,
1162 double rotation) {
1163 g_return_if_fail(FL_IS_ENGINE(self));
1164
1165 if (self->engine == nullptr) {
1166 return;
1167 }
1168
1169 FlutterPointerEvent fl_event = {};
1170 fl_event.struct_size = sizeof(fl_event);
1171 fl_event.timestamp = timestamp;
1172 fl_event.x = x;
1173 fl_event.y = y;
1174 fl_event.phase = phase;
1175 fl_event.pan_x = pan_x;
1176 fl_event.pan_y = pan_y;
1177 fl_event.scale = scale;
1178 fl_event.rotation = rotation;
1179 fl_event.device = kPointerPanZoomDeviceId;
1180 fl_event.device_kind = kFlutterPointerDeviceKindTrackpad;
1181 fl_event.view_id = view_id;
1182 self->embedder_api.SendPointerEvent(self->engine, &fl_event, 1);
1183 }
1184
1185 static void send_key_event_cb(bool handled, void* user_data) {
1186 g_autoptr(GTask) task = G_TASK(user_data);
1187 gboolean* return_value = g_new0(gboolean, 1);
1188 *return_value = handled;
1189 g_task_return_pointer(task, return_value, g_free);
1190 }
1191
1192 void fl_engine_send_key_event(FlEngine* self,
1193 const FlutterKeyEvent* event,
1194 GCancellable* cancellable,
1195 GAsyncReadyCallback callback,
1196 gpointer user_data) {
1197 g_return_if_fail(FL_IS_ENGINE(self));
1198
1199 g_autoptr(GTask) task = g_task_new(self, cancellable, callback, user_data);
1200
1201 if (self->engine == nullptr) {
1202 g_task_return_new_error(task, fl_engine_error_quark(),
1203 FL_ENGINE_ERROR_FAILED, "No engine");
1204 return;
1205 }
1206
1207 if (self->embedder_api.SendKeyEvent(self->engine, event, send_key_event_cb,
1208 g_object_ref(task)) != kSuccess) {
1209 g_task_return_new_error(task, fl_engine_error_quark(),
1210 FL_ENGINE_ERROR_FAILED, "Failed to send key event");
1211 g_object_unref(task);
1212 }
1213 }
1214
1215 gboolean fl_engine_send_key_event_finish(FlEngine* self,
1216 GAsyncResult* result,
1217 gboolean* handled,
1218 GError** error) {
1219 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
1220 g_return_val_if_fail(g_task_is_valid(result, self), FALSE);
1221
1222 g_autofree gboolean* return_value =
1223 static_cast<gboolean*>(g_task_propagate_pointer(G_TASK(result), error));
1224 if (return_value == nullptr) {
1225 return FALSE;
1226 }
1227
1228 *handled = *return_value;
1229 return TRUE;
1230 }
1231
1232 void fl_engine_dispatch_semantics_action(FlEngine* self,
1233 FlutterViewId view_id,
1234 uint64_t node_id,
1235 FlutterSemanticsAction action,
1236 GBytes* data) {
1237 g_return_if_fail(FL_IS_ENGINE(self));
1238
1239 if (self->engine == nullptr) {
1240 return;
1241 }
1242
1243 const uint8_t* action_data = nullptr;
1244 size_t action_data_length = 0;
1245 if (data != nullptr) {
1246 action_data = static_cast<const uint8_t*>(
1247 g_bytes_get_data(data, &action_data_length));
1248 }
1249
1250 FlutterSendSemanticsActionInfo info;
1251 info.struct_size = sizeof(FlutterSendSemanticsActionInfo);
1252 info.view_id = view_id;
1253 info.node_id = node_id;
1254 info.action = action;
1255 info.data = action_data;
1256 info.data_length = action_data_length;
1257 self->embedder_api.SendSemanticsAction(self->engine, &info);
1258 }
1259
1260 gboolean fl_engine_mark_texture_frame_available(FlEngine* self,
1261 int64_t texture_id) {
1262 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
1263 return self->embedder_api.MarkExternalTextureFrameAvailable(
1264 self->engine, texture_id) == kSuccess;
1265 }
1266
1267 gboolean fl_engine_register_external_texture(FlEngine* self,
1268 int64_t texture_id) {
1269 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
1270 return self->embedder_api.RegisterExternalTexture(self->engine, texture_id) ==
1271 kSuccess;
1272 }
1273
1274 gboolean fl_engine_unregister_external_texture(FlEngine* self,
1275 int64_t texture_id) {
1276 g_return_val_if_fail(FL_IS_ENGINE(self), FALSE);
1277 return self->embedder_api.UnregisterExternalTexture(self->engine,
1278 texture_id) == kSuccess;
1279 }
1280
1281 G_MODULE_EXPORT FlBinaryMessenger* fl_engine_get_binary_messenger(
1282 FlEngine* self) {
1283 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
1284 return self->binary_messenger;
1285 }
1286
1287 FlTaskRunner* fl_engine_get_task_runner(FlEngine* self) {
1288 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
1289 return self->task_runner;
1290 }
1291
1292 void fl_engine_execute_task(FlEngine* self, FlutterTask* task) {
1293 g_return_if_fail(FL_IS_ENGINE(self));
1294 self->embedder_api.RunTask(self->engine, task);
1295 }
1296
1297 G_MODULE_EXPORT FlTextureRegistrar* fl_engine_get_texture_registrar(
1298 FlEngine* self) {
1299 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
1300 return self->texture_registrar;
1301 }
1302
1303 void fl_engine_update_accessibility_features(FlEngine* self, int32_t flags) {
1304 g_return_if_fail(FL_IS_ENGINE(self));
1305
1306 if (self->engine == nullptr) {
1307 return;
1308 }
1309
1310 self->embedder_api.UpdateAccessibilityFeatures(
1311 self->engine, static_cast<FlutterAccessibilityFeature>(flags));
1312 }
1313
1314 void fl_engine_request_app_exit(FlEngine* self) {
1315 g_return_if_fail(FL_IS_ENGINE(self));
1316 fl_platform_handler_request_app_exit(self->platform_handler);
1317 }
1318
1319 FlWindowingHandler* fl_engine_get_windowing_handler(FlEngine* self) {
1320 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
1321 return self->windowing_handler;
1322 }
1323
1324 FlKeyboardManager* fl_engine_get_keyboard_manager(FlEngine* self) {
1325 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
1326 return self->keyboard_manager;
1327 }
1328
1329 FlTextInputHandler* fl_engine_get_text_input_handler(FlEngine* self) {
1330 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
1331 return self->text_input_handler;
1332 }
1333
1334 FlMouseCursorHandler* fl_engine_get_mouse_cursor_handler(FlEngine* self) {
1335 g_return_val_if_fail(FL_IS_ENGINE(self), nullptr);
1336 return self->mouse_cursor_handler;
1337 }
engine_switches.h
flags
FlutterSemanticsFlag flags
Definition: fl_accessible_node.cc:109
PROP_LAST
@ PROP_LAST
Definition: fl_accessible_node.cc:87
PROP_0
@ PROP_0
Definition: fl_accessible_node.cc:87
g_signal_emit
g_signal_emit(self, fl_application_signals[SIGNAL_CREATE_WINDOW], 0, view, &window)
G_DEFINE_QUARK
G_DEFINE_QUARK(fl_binary_messenger_codec_error_quark, fl_binary_messenger_codec_error) G_DECLARE_FINAL_TYPE(FlBinaryMessengerImpl
fl_binary_messenger_new
FlBinaryMessenger * fl_binary_messenger_new(FlEngine *engine)
Definition: fl_binary_messenger.cc:391
fl_binary_messenger_shutdown
void fl_binary_messenger_shutdown(FlBinaryMessenger *self)
Definition: fl_binary_messenger.cc:500
fl_binary_messenger_private.h
fl_compositor_present_layers
gboolean fl_compositor_present_layers(FlCompositor *self, FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count)
Definition: fl_compositor.cc:40
fl_compositor_collect_backing_store
gboolean fl_compositor_collect_backing_store(FlCompositor *self, const FlutterBackingStore *backing_store)
Definition: fl_compositor.cc:24
fl_compositor_create_backing_store
gboolean fl_compositor_create_backing_store(FlCompositor *self, const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out)
Definition: fl_compositor.cc:15
fl_compositor_opengl_new
FlCompositorOpenGL * fl_compositor_opengl_new(FlEngine *engine)
Definition: fl_compositor_opengl.cc:571
fl_compositor_opengl.h
fl_dart_project_new
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
Definition: fl_dart_project.cc:50
fl_dart_project_get_aot_library_path
G_MODULE_EXPORT const gchar * fl_dart_project_get_aot_library_path(FlDartProject *self)
Definition: fl_dart_project.cc:72
fl_dart_project_get_dart_entrypoint_arguments
G_MODULE_EXPORT gchar ** fl_dart_project_get_dart_entrypoint_arguments(FlDartProject *self)
Definition: fl_dart_project.cc:104
fl_dart_project_get_icu_data_path
G_MODULE_EXPORT const gchar * fl_dart_project_get_icu_data_path(FlDartProject *self)
Definition: fl_dart_project.cc:98
fl_dart_project_get_assets_path
G_MODULE_EXPORT const gchar * fl_dart_project_get_assets_path(FlDartProject *self)
Definition: fl_dart_project.cc:85
fl_dart_project_private.h
fl_display_monitor_start
void fl_display_monitor_start(FlDisplayMonitor *self)
Definition: fl_display_monitor.cc:103
fl_display_monitor_new
FlDisplayMonitor * fl_display_monitor_new(FlEngine *engine, GdkDisplay *display)
Definition: fl_display_monitor.cc:94
fl_display_monitor.h
fl_engine_gl_external_texture_frame_callback
static bool fl_engine_gl_external_texture_frame_callback(void *user_data, int64_t texture_id, size_t width, size_t height, FlutterOpenGLTexture *opengl_texture)
Definition: fl_engine.cc:312
fl_engine_get_texture_registrar
G_MODULE_EXPORT FlTextureRegistrar * fl_engine_get_texture_registrar(FlEngine *self)
Definition: fl_engine.cc:1297
fl_engine_get_mouse_cursor_handler
FlMouseCursorHandler * fl_engine_get_mouse_cursor_handler(FlEngine *self)
Definition: fl_engine.cc:1334
fl_engine_runs_task_on_current_thread
static bool fl_engine_runs_task_on_current_thread(void *user_data)
Definition: fl_engine.cc:353
fl_engine_on_pre_engine_restart_cb
static void fl_engine_on_pre_engine_restart_cb(void *user_data)
Definition: fl_engine.cc:419
fl_engine_send_mouse_pointer_event
void fl_engine_send_mouse_pointer_event(FlEngine *self, FlutterViewId view_id, FlutterPointerPhase phase, size_t timestamp, double x, double y, FlutterPointerDeviceKind device_kind, double scroll_delta_x, double scroll_delta_y, int64_t buttons)
Definition: fl_engine.cc:989
fl_engine_set_platform_message_handler
void fl_engine_set_platform_message_handler(FlEngine *self, FlEnginePlatformMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_engine.cc:848
fl_engine_get_registrar_for_plugin
static FlPluginRegistrar * fl_engine_get_registrar_for_plugin(FlPluginRegistry *registry, const gchar *name)
Definition: fl_engine.cc:438
G_DEFINE_TYPE_WITH_CODE
G_DEFINE_TYPE_WITH_CODE(FlEngine, fl_engine, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(), fl_engine_plugin_registry_iface_init)) enum
Definition: fl_engine.cc:118
view_added_cb
static void view_added_cb(const FlutterAddViewResult *result)
Definition: fl_engine.cc:171
compositor_create_backing_store_callback
static bool compositor_create_backing_store_callback(const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out, void *user_data)
Definition: fl_engine.cc:251
fl_engine_gl_make_current
static bool fl_engine_gl_make_current(void *user_data)
Definition: fl_engine.cc:282
fl_engine_send_key_event_finish
gboolean fl_engine_send_key_event_finish(FlEngine *self, GAsyncResult *result, gboolean *handled, GError **error)
Definition: fl_engine.cc:1215
fl_engine_get_embedder_api
FlutterEngineProcTable * fl_engine_get_embedder_api(FlEngine *self)
Definition: fl_engine.cc:726
fl_engine_dispatch_semantics_action
void fl_engine_dispatch_semantics_action(FlEngine *self, FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:1232
fl_engine_new_full
static FlEngine * fl_engine_new_full(FlDartProject *project, FlBinaryMessenger *binary_messenger)
Definition: fl_engine.cc:556
parse_locale
static void parse_locale(const gchar *locale, gchar **language, gchar **territory, gchar **codeset, gchar **modifier)
Definition: fl_engine.cc:128
fl_engine_send_touch_up_event
void fl_engine_send_touch_up_event(FlEngine *self, FlutterViewId view_id, size_t timestamp, double x, double y, int32_t device)
Definition: fl_engine.cc:1023
fl_engine_notify_display_update
void fl_engine_notify_display_update(FlEngine *self, const FlutterEngineDisplay *displays, size_t displays_length)
Definition: fl_engine.cc:730
fl_engine_get_compositor
FlCompositor * fl_engine_get_compositor(FlEngine *self)
Definition: fl_engine.cc:598
compositor_present_view_callback
static bool compositor_present_view_callback(const FlutterPresentViewInfo *info)
Definition: fl_engine.cc:269
fl_engine_get_opengl_manager
FlOpenGLManager * fl_engine_get_opengl_manager(FlEngine *self)
Definition: fl_engine.cc:603
fl_engine_send_window_metrics_event
void fl_engine_send_window_metrics_event(FlEngine *self, FlutterEngineDisplayId display_id, FlutterViewId view_id, size_t width, size_t height, double pixel_ratio)
Definition: fl_engine.cc:967
compositor_collect_backing_store_callback
static bool compositor_collect_backing_store_callback(const FlutterBackingStore *backing_store, void *user_data)
Definition: fl_engine.cc:261
fl_engine_dispose
static void fl_engine_dispose(GObject *object)
Definition: fl_engine.cc:468
fl_engine_mark_texture_frame_available
gboolean fl_engine_mark_texture_frame_available(FlEngine *self, int64_t texture_id)
Definition: fl_engine.cc:1260
fl_engine_get_windowing_handler
FlWindowingHandler * fl_engine_get_windowing_handler(FlEngine *self)
Definition: fl_engine.cc:1319
fl_engine_remove_view_finish
gboolean fl_engine_remove_view_finish(FlEngine *self, GAsyncResult *result, GError **error)
Definition: fl_engine.cc:841
fl_engine_get_task_runner
FlTaskRunner * fl_engine_get_task_runner(FlEngine *self)
Definition: fl_engine.cc:1287
fl_engine_get_keyboard_manager
FlKeyboardManager * fl_engine_get_keyboard_manager(FlEngine *self)
Definition: fl_engine.cc:1324
fl_engine_get_display_monitor
FlDisplayMonitor * fl_engine_get_display_monitor(FlEngine *self)
Definition: fl_engine.cc:608
fl_engine_get_renderable
FlRenderable * fl_engine_get_renderable(FlEngine *self, FlutterViewId view_id)
Definition: fl_engine.cc:806
fl_engine_signals
static guint fl_engine_signals[LAST_SIGNAL]
Definition: fl_engine.cc:116
fl_engine_platform_message_response_cb
static void fl_engine_platform_message_response_cb(const uint8_t *data, size_t data_length, void *user_data)
Definition: fl_engine.cc:429
fl_engine_send_platform_message_response
gboolean fl_engine_send_platform_message_response(FlEngine *self, const FlutterPlatformMessageResponseHandle *handle, GBytes *response, GError **error)
Definition: fl_engine.cc:867
fl_engine_init
static void fl_engine_init(FlEngine *self)
Definition: fl_engine.cc:530
fl_engine_post_task
static void fl_engine_post_task(FlutterTask task, uint64_t target_time_nanos, void *user_data)
Definition: fl_engine.cc:359
fl_engine_get_text_input_handler
FlTextInputHandler * fl_engine_get_text_input_handler(FlEngine *self)
Definition: fl_engine.cc:1329
fl_engine_set_implicit_view
void fl_engine_set_implicit_view(FlEngine *self, FlRenderable *renderable)
Definition: fl_engine.cc:743
fl_engine_gl_get_fbo
static uint32_t fl_engine_gl_get_fbo(void *user_data)
Definition: fl_engine.cc:294
view_removed_cb
static void view_removed_cb(const FlutterRemoveViewResult *result)
Definition: fl_engine.cc:182
fl_engine_unregister_external_texture
gboolean fl_engine_unregister_external_texture(FlEngine *self, int64_t texture_id)
Definition: fl_engine.cc:1274
fl_engine_send_platform_message
void fl_engine_send_platform_message(FlEngine *self, const gchar *channel, GBytes *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_engine.cc:899
fl_engine_register_external_texture
gboolean fl_engine_register_external_texture(FlEngine *self, int64_t texture_id)
Definition: fl_engine.cc:1267
fl_engine_for_id
FlEngine * fl_engine_for_id(int64_t id)
Definition: fl_engine.cc:578
fl_engine_gl_proc_resolver
static void * fl_engine_gl_proc_resolver(void *user_data, const char *name)
Definition: fl_engine.cc:278
fl_engine_send_touch_move_event
void fl_engine_send_touch_move_event(FlEngine *self, FlutterViewId view_id, size_t timestamp, double x, double y, int32_t device)
Definition: fl_engine.cc:1075
fl_engine_set_property
static void fl_engine_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
Definition: fl_engine.cc:452
fl_engine_send_touch_add_event
void fl_engine_send_touch_add_event(FlEngine *self, FlutterViewId view_id, size_t timestamp, double x, double y, int32_t device)
Definition: fl_engine.cc:1101
fl_engine_remove_view
void fl_engine_remove_view(FlEngine *self, FlutterViewId view_id, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_engine.cc:814
fl_engine_gl_present
static bool fl_engine_gl_present(void *user_data)
Definition: fl_engine.cc:299
fl_engine_get_binary_messenger
G_MODULE_EXPORT FlBinaryMessenger * fl_engine_get_binary_messenger(FlEngine *self)
Definition: fl_engine.cc:1281
fl_engine_add_view_finish
gboolean fl_engine_add_view_finish(FlEngine *self, GAsyncResult *result, GError **error)
Definition: fl_engine.cc:799
fl_engine_send_key_event
void fl_engine_send_key_event(FlEngine *self, const FlutterKeyEvent *event, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_engine.cc:1192
setup_keyboard
static void setup_keyboard(FlEngine *self)
Definition: fl_engine.cc:395
free_locale
static void free_locale(FlutterLocale *locale)
Definition: fl_engine.cc:193
fl_engine_request_app_exit
void fl_engine_request_app_exit(FlEngine *self)
Definition: fl_engine.cc:1314
setup_locales
static void setup_locales(FlEngine *self)
Definition: fl_engine.cc:200
LAST_SIGNAL
@ LAST_SIGNAL
Definition: fl_engine.cc:114
SIGNAL_UPDATE_SEMANTICS
@ SIGNAL_UPDATE_SEMANTICS
Definition: fl_engine.cc:114
SIGNAL_ON_PRE_ENGINE_RESTART
@ SIGNAL_ON_PRE_ENGINE_RESTART
Definition: fl_engine.cc:114
fl_engine_send_pointer_pan_zoom_event
void fl_engine_send_pointer_pan_zoom_event(FlEngine *self, FlutterViewId view_id, size_t timestamp, double x, double y, FlutterPointerPhase phase, double pan_x, double pan_y, double scale, double rotation)
Definition: fl_engine.cc:1153
fl_engine_add_view
FlutterViewId fl_engine_add_view(FlEngine *self, FlRenderable *renderable, size_t width, size_t height, double pixel_ratio, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_engine.cc:750
fl_engine_update_semantics_cb
static void fl_engine_update_semantics_cb(const FlutterSemanticsUpdate2 *update, void *user_data)
Definition: fl_engine.cc:388
fl_engine_gl_make_resource_current
static bool fl_engine_gl_make_resource_current(void *user_data)
Definition: fl_engine.cc:305
fl_engine_new_headless
G_MODULE_EXPORT FlEngine * fl_engine_new_headless(FlDartProject *project)
Definition: fl_engine.cc:594
fl_engine_update_accessibility_features
void fl_engine_update_accessibility_features(FlEngine *self, int32_t flags)
Definition: fl_engine.cc:1303
fl_engine_platform_message_cb
static void fl_engine_platform_message_cb(const FlutterPlatformMessage *message, void *user_data)
Definition: fl_engine.cc:368
fl_engine_send_touch_remove_event
void fl_engine_send_touch_remove_event(FlEngine *self, FlutterViewId view_id, size_t timestamp, double x, double y, int32_t device)
Definition: fl_engine.cc:1127
fl_engine_execute_task
void fl_engine_execute_task(FlEngine *self, FlutterTask *task)
Definition: fl_engine.cc:1292
fl_engine_send_touch_down_event
void fl_engine_send_touch_down_event(FlEngine *self, FlutterViewId view_id, size_t timestamp, double x, double y, int32_t device)
Definition: fl_engine.cc:1049
fl_engine_start
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition: fl_engine.cc:613
send_key_event_cb
static void send_key_event_cb(bool handled, void *user_data)
Definition: fl_engine.cc:1185
kPlatformTaskRunnerIdentifier
static constexpr size_t kPlatformTaskRunnerIdentifier
Definition: fl_engine.cc:32
fl_engine_new_with_binary_messenger
FlEngine * fl_engine_new_with_binary_messenger(FlBinaryMessenger *binary_messenger)
Definition: fl_engine.cc:588
kPointerPanZoomDeviceId
static constexpr int32_t kPointerPanZoomDeviceId
Definition: fl_engine.cc:37
fl_engine_new
G_MODULE_EXPORT FlEngine * fl_engine_new(FlDartProject *project)
Definition: fl_engine.cc:584
kMousePointerDeviceId
static constexpr int32_t kMousePointerDeviceId
Definition: fl_engine.cc:36
fl_engine_class_init
static void fl_engine_class_init(FlEngineClass *klass)
Definition: fl_engine.cc:510
fl_engine_gl_clear_current
static bool fl_engine_gl_clear_current(void *user_data)
Definition: fl_engine.cc:288
fl_engine_send_platform_message_finish
GBytes * fl_engine_send_platform_message_finish(FlEngine *self, GAsyncResult *result, GError **error)
Definition: fl_engine.cc:958
fl_engine_plugin_registry_iface_init
static void fl_engine_plugin_registry_iface_init(FlPluginRegistryInterface *iface)
Definition: fl_engine.cc:447
fl_engine.h
fl_engine_private.h
fl_engine_error_quark
GQuark fl_engine_error_quark(void) G_GNUC_CONST
FL_ENGINE_ERROR_FAILED
@ FL_ENGINE_ERROR_FAILED
Definition: fl_engine_private.h:31
FlEnginePlatformMessageHandler
gboolean(* FlEnginePlatformMessageHandler)(FlEngine *engine, const gchar *channel, GBytes *message, const FlutterPlatformMessageResponseHandle *response_handle, gpointer user_data)
Definition: fl_engine_private.h:48
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
fl_keyboard_handler_new
FlKeyboardHandler * fl_keyboard_handler_new(FlBinaryMessenger *messenger, FlKeyboardManager *keyboard_manager)
Definition: fl_keyboard_handler.cc:63
fl_keyboard_handler.h
fl_keyboard_manager_new
FlKeyboardManager * fl_keyboard_manager_new(FlEngine *engine)
Definition: fl_keyboard_manager.cc:356
fl_mouse_cursor_handler_new
FlMouseCursorHandler * fl_mouse_cursor_handler_new(FlBinaryMessenger *messenger)
Definition: fl_mouse_cursor_handler.cc:134
fl_opengl_manager_clear_current
void fl_opengl_manager_clear_current(FlOpenGLManager *self)
Definition: fl_opengl_manager.cc:90
fl_opengl_manager_new
FlOpenGLManager * fl_opengl_manager_new()
Definition: fl_opengl_manager.cc:39
fl_opengl_manager_make_current
void fl_opengl_manager_make_current(FlOpenGLManager *self)
Definition: fl_opengl_manager.cc:82
fl_opengl_manager_make_resource_current
void fl_opengl_manager_make_resource_current(FlOpenGLManager *self)
Definition: fl_opengl_manager.cc:86
fl_opengl_manager.h
id
int64_t id
Definition: fl_pixel_buffer_texture.cc:28
fl_pixel_buffer_texture_populate
gboolean fl_pixel_buffer_texture_populate(FlPixelBufferTexture *texture, uint32_t width, uint32_t height, FlutterOpenGLTexture *opengl_texture, GError **error)
Definition: fl_pixel_buffer_texture.cc:71
fl_pixel_buffer_texture_private.h
height
const uint8_t uint32_t uint32_t * height
Definition: fl_pixel_buffer_texture_test.cc:39
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
fl_platform_handler_new
FlPlatformHandler * fl_platform_handler_new(FlBinaryMessenger *messenger)
Definition: fl_platform_handler.cc:251
fl_platform_handler_request_app_exit
void fl_platform_handler_request_app_exit(FlPlatformHandler *self)
Definition: fl_platform_handler.cc:264
fl_platform_handler.h
fl_plugin_registrar_new
FlPluginRegistrar * fl_plugin_registrar_new(FlView *view, FlBinaryMessenger *messenger, FlTextureRegistrar *texture_registrar)
Definition: fl_plugin_registrar.cc:84
fl_plugin_registrar_private.h
fl_plugin_registry.h
fl_settings_new
FlSettings * fl_settings_new()
Definition: fl_settings.cc:55
fl_settings_handler_start
void fl_settings_handler_start(FlSettingsHandler *self, FlSettings *settings)
Definition: fl_settings_handler.cc:88
fl_settings_handler_new
FlSettingsHandler * fl_settings_handler_new(FlEngine *engine)
Definition: fl_settings_handler.cc:74
fl_settings_handler.h
i
int i
Definition: fl_socket_accessible.cc:18
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
prop_id
guint prop_id
Definition: fl_standard_method_codec.cc:31
pspec
guint const GValue GParamSpec * pspec
Definition: fl_standard_method_codec.cc:33
fl_task_runner_post_flutter_task
void fl_task_runner_post_flutter_task(FlTaskRunner *self, FlutterTask task, uint64_t target_time_nanos)
Definition: fl_task_runner.cc:174
fl_task_runner_new
FlTaskRunner * fl_task_runner_new(FlEngine *engine)
Definition: fl_task_runner.cc:167
fl_text_input_handler_new
FlTextInputHandler * fl_text_input_handler_new(FlBinaryMessenger *messenger)
Definition: fl_text_input_handler.cc:422
fl_text_input_handler_set_widget
void fl_text_input_handler_set_widget(FlTextInputHandler *self, GtkWidget *widget)
Definition: fl_text_input_handler.cc:464
fl_text_input_handler_get_widget
GtkWidget * fl_text_input_handler_get_widget(FlTextInputHandler *self)
Definition: fl_text_input_handler.cc:472
fl_texture_gl_populate
gboolean fl_texture_gl_populate(FlTextureGL *self, uint32_t width, uint32_t height, FlutterOpenGLTexture *opengl_texture, GError **error)
Definition: fl_texture_gl.cc:50
fl_texture_gl_private.h
fl_texture_registrar_shutdown
void fl_texture_registrar_shutdown(FlTextureRegistrar *self)
Definition: fl_texture_registrar.cc:215
fl_texture_registrar_new
FlTextureRegistrar * fl_texture_registrar_new(FlEngine *engine)
Definition: fl_texture_registrar.cc:221
fl_texture_registrar_lookup_texture
FlTexture * fl_texture_registrar_lookup_texture(FlTextureRegistrar *self, int64_t texture_id)
Definition: fl_texture_registrar.cc:190
fl_texture_registrar_private.h
view_id
G_BEGIN_DECLS FlutterViewId view_id
Definition: fl_view_accessible.h:49
fl_windowing_handler_new
FlWindowingHandler * fl_windowing_handler_new(FlEngine *engine)
Definition: fl_windowing_handler.cc:260
fl_windowing_handler.h
flutter::GetSwitchesFromEnvironment
std::vector< std::string > GetSwitchesFromEnvironment()
Definition: engine_switches.cc:14
_FlEngine
Definition: fl_engine.cc:39
_FlEngine::task_runner
FlTaskRunner * task_runner
Definition: fl_engine.cc:85
_FlEngine::platform_message_handler
FlEnginePlatformMessageHandler platform_message_handler
Definition: fl_engine.cc:104
_FlEngine::mouse_cursor_handler
FlMouseCursorHandler * mouse_cursor_handler
Definition: fl_engine.cc:79
_FlEngine::platform_message_handler_destroy_notify
GDestroyNotify platform_message_handler_destroy_notify
Definition: fl_engine.cc:106
_FlEngine::next_view_id
FlutterViewId next_view_id
Definition: fl_engine.cc:98
_FlEngine::settings_handler
FlSettingsHandler * settings_handler
Definition: fl_engine.cc:61
_FlEngine::platform_message_handler_data
gpointer platform_message_handler_data
Definition: fl_engine.cc:105
_FlEngine::opengl_manager
FlOpenGLManager * opengl_manager
Definition: fl_engine.cc:55
_FlEngine::thread
GThread * thread
Definition: fl_engine.cc:43
_FlEngine::platform_handler
FlPlatformHandler * platform_handler
Definition: fl_engine.cc:64
_FlEngine::compositor
FlCompositor * compositor
Definition: fl_engine.cc:52
_FlEngine::FLUTTER_API_SYMBOL
FLUTTER_API_SYMBOL(FlutterEngine) engine
_FlEngine::binary_messenger
FlBinaryMessenger * binary_messenger
Definition: fl_engine.cc:58
_FlEngine::display_monitor
FlDisplayMonitor * display_monitor
Definition: fl_engine.cc:49
_FlEngine::renderables_by_view_id
GHashTable * renderables_by_view_id
Definition: fl_engine.cc:101
_FlEngine::project
FlDartProject * project
Definition: fl_engine.cc:46
_FlEngine::keyboard_manager
FlKeyboardManager * keyboard_manager
Definition: fl_engine.cc:70
_FlEngine::windowing_handler
FlWindowingHandler * windowing_handler
Definition: fl_engine.cc:67
_FlEngine::parent_instance
GObject parent_instance
Definition: fl_engine.cc:40
_FlEngine::texture_registrar
FlTextureRegistrar * texture_registrar
Definition: fl_engine.cc:82
_FlEngine::aot_data
FlutterEngineAOTData aot_data
Definition: fl_engine.cc:88
_FlEngine::embedder_api
FlutterEngineProcTable embedder_api
Definition: fl_engine.cc:95
_FlEngine::text_input_handler
FlTextInputHandler * text_input_handler
Definition: fl_engine.cc:73
_FlEngine::keyboard_handler
FlKeyboardHandler * keyboard_handler
Definition: fl_engine.cc:76
texture_id
int64_t texture_id
Definition: texture_registrar_unittests.cc:24