| Flutter Linux Embedder |

fl_view.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_view.h"
6
7 #include "flutter/shell/platform/linux/fl_view_private.h"
8
9 #include <cstring>
10
11 #include "flutter/shell/platform/linux/fl_accessibility_plugin.h"
12 #include "flutter/shell/platform/linux/fl_engine_private.h"
13 #include "flutter/shell/platform/linux/fl_key_event.h"
14 #include "flutter/shell/platform/linux/fl_keyboard_manager.h"
15 #include "flutter/shell/platform/linux/fl_keyboard_view_delegate.h"
16 #include "flutter/shell/platform/linux/fl_mouse_cursor_plugin.h"
17 #include "flutter/shell/platform/linux/fl_platform_plugin.h"
18 #include "flutter/shell/platform/linux/fl_plugin_registrar_private.h"
19 #include "flutter/shell/platform/linux/fl_renderer_gl.h"
20 #include "flutter/shell/platform/linux/fl_scrolling_manager.h"
21 #include "flutter/shell/platform/linux/fl_scrolling_view_delegate.h"
22 #include "flutter/shell/platform/linux/fl_text_input_plugin.h"
23 #include "flutter/shell/platform/linux/fl_text_input_view_delegate.h"
24 #include "flutter/shell/platform/linux/fl_view_accessible.h"
25 #include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"
26 #include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registry.h"
27
28 static constexpr int kMicrosecondsPerMillisecond = 1000;
29
30 struct _FlView {
31 GtkBox parent_instance;
32
33 // Project being run.
34 FlDartProject* project;
35
36 // Rendering output.
37 FlRenderer* renderer;
38
39 // Engine running @project.
40 FlEngine* engine;
41
42 // Pointer button state recorded for sending status updates.
43 int64_t button_state;
44
45 // Current state information for the window associated with this view.
46 GdkWindowState window_state;
47
48 // Flutter system channel handlers.
49 FlAccessibilityPlugin* accessibility_plugin;
50 FlKeyboardManager* keyboard_manager;
51 FlScrollingManager* scrolling_manager;
52 FlTextInputPlugin* text_input_plugin;
53 FlMouseCursorPlugin* mouse_cursor_plugin;
54 FlPlatformPlugin* platform_plugin;
55
56 GtkWidget* event_box;
57 FlGLArea* gl_area;
58
59 // Tracks whether mouse pointer is inside the view.
60 gboolean pointer_inside;
61
62 /* FlKeyboardViewDelegate related properties */
63 KeyboardLayoutNotifier keyboard_layout_notifier;
64 GdkKeymap* keymap;
65 gulong keymap_keys_changed_cb_id; // Signal connection ID for
66 // keymap-keys-changed
67 gulong window_state_cb_id; // Signal connection ID for window-state-changed
68 };
69
70 enum { kPropFlutterProject = 1, kPropLast };
71
72 static void fl_view_plugin_registry_iface_init(
73 FlPluginRegistryInterface* iface);
74
75 static void fl_view_keyboard_delegate_iface_init(
76 FlKeyboardViewDelegateInterface* iface);
77
78 static void fl_view_scrolling_delegate_iface_init(
79 FlScrollingViewDelegateInterface* iface);
80
81 static void fl_view_text_input_delegate_iface_init(
82 FlTextInputViewDelegateInterface* iface);
83
84 G_DEFINE_TYPE_WITH_CODE(
85 FlView,
86 fl_view,
87 GTK_TYPE_BOX,
88 G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(),
89 fl_view_plugin_registry_iface_init)
90 G_IMPLEMENT_INTERFACE(fl_keyboard_view_delegate_get_type(),
91 fl_view_keyboard_delegate_iface_init)
92 G_IMPLEMENT_INTERFACE(fl_scrolling_view_delegate_get_type(),
93 fl_view_scrolling_delegate_iface_init)
94 G_IMPLEMENT_INTERFACE(fl_text_input_view_delegate_get_type(),
95 fl_view_text_input_delegate_iface_init))
96
97 // Signal handler for GtkWidget::delete-event
98 static gboolean window_delete_event_cb(GtkWidget* widget,
99 GdkEvent* event,
100 FlView* self) {
101 fl_platform_plugin_request_app_exit(self->platform_plugin);
102 // Stop the event from propagating.
103 return TRUE;
104 }
105
106 // Initialize keyboard manager.
107 static void init_keyboard(FlView* self) {
108 FlBinaryMessenger* messenger = fl_engine_get_binary_messenger(self->engine);
109
110 GdkWindow* window =
111 gtk_widget_get_window(gtk_widget_get_toplevel(GTK_WIDGET(self)));
112 g_return_if_fail(GDK_IS_WINDOW(window));
113 g_autoptr(GtkIMContext) im_context = gtk_im_multicontext_new();
114 gtk_im_context_set_client_window(im_context, window);
115
116 self->text_input_plugin = fl_text_input_plugin_new(
117 messenger, im_context, FL_TEXT_INPUT_VIEW_DELEGATE(self));
118 self->keyboard_manager =
119 fl_keyboard_manager_new(messenger, FL_KEYBOARD_VIEW_DELEGATE(self));
120 }
121
122 static void init_scrolling(FlView* self) {
123 self->scrolling_manager =
124 fl_scrolling_manager_new(FL_SCROLLING_VIEW_DELEGATE(self));
125 }
126
127 // Converts a GDK button event into a Flutter event and sends it to the engine.
128 static gboolean send_pointer_button_event(FlView* self, GdkEventButton* event) {
129 int64_t button;
130 switch (event->button) {
131 case 1:
132 button = kFlutterPointerButtonMousePrimary;
133 break;
134 case 2:
135 button = kFlutterPointerButtonMouseMiddle;
136 break;
137 case 3:
138 button = kFlutterPointerButtonMouseSecondary;
139 break;
140 default:
141 return FALSE;
142 }
143 int old_button_state = self->button_state;
144 FlutterPointerPhase phase = kMove;
145 if (event->type == GDK_BUTTON_PRESS) {
146 // Drop the event if Flutter already thinks the button is down.
147 if ((self->button_state & button) != 0) {
148 return FALSE;
149 }
150 self->button_state ^= button;
151
152 phase = old_button_state == 0 ? kDown : kMove;
153 } else if (event->type == GDK_BUTTON_RELEASE) {
154 // Drop the event if Flutter already thinks the button is up.
155 if ((self->button_state & button) == 0) {
156 return FALSE;
157 }
158 self->button_state ^= button;
159
160 phase = self->button_state == 0 ? kUp : kMove;
161 }
162
163 if (self->engine == nullptr) {
164 return FALSE;
165 }
166
167 gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
168 fl_scrolling_manager_set_last_mouse_position(self->scrolling_manager,
169 event->x * scale_factor,
170 event->y * scale_factor);
171 fl_keyboard_manager_sync_modifier_if_needed(self->keyboard_manager,
172 event->state, event->time);
173 fl_engine_send_mouse_pointer_event(
174 self->engine, phase, event->time * kMicrosecondsPerMillisecond,
175 event->x * scale_factor, event->y * scale_factor, 0, 0,
176 self->button_state);
177
178 return TRUE;
179 }
180
181 // Generates a mouse pointer event if the pointer appears inside the window.
182 static void check_pointer_inside(FlView* self, GdkEvent* event) {
183 if (!self->pointer_inside) {
184 self->pointer_inside = TRUE;
185
186 gdouble x, y;
187 if (gdk_event_get_coords(event, &x, &y)) {
188 gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
189
190 fl_engine_send_mouse_pointer_event(
191 self->engine, kAdd,
192 gdk_event_get_time(event) * kMicrosecondsPerMillisecond,
193 x * scale_factor, y * scale_factor, 0, 0, self->button_state);
194 }
195 }
196 }
197
198 // Updates the engine with the current window metrics.
199 static void handle_geometry_changed(FlView* self) {
200 GtkAllocation allocation;
201 gtk_widget_get_allocation(GTK_WIDGET(self), &allocation);
202 gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
203 fl_engine_send_window_metrics_event(
204 self->engine, allocation.width * scale_factor,
205 allocation.height * scale_factor, scale_factor);
206
207 // Make sure the view has been realized and its size has been allocated before
208 // waiting for a frame. `fl_view_realize()` and `fl_view_size_allocate()` may
209 // be called in either order depending on the order in which the window is
210 // shown and the view is added to a container in the app runner.
211 //
212 // Note: `gtk_widget_init()` initializes the size allocation to 1x1.
213 if (allocation.width > 1 && allocation.height > 1 &&
214 gtk_widget_get_realized(GTK_WIDGET(self))) {
215 fl_renderer_wait_for_frame(self->renderer, allocation.width * scale_factor,
216 allocation.height * scale_factor);
217 }
218 }
219
220 // Called when the engine updates accessibility nodes.
221 static void update_semantics_node_cb(FlEngine* engine,
222 const FlutterSemanticsNode* node,
223 gpointer user_data) {
224 FlView* self = FL_VIEW(user_data);
225
226 fl_accessibility_plugin_handle_update_semantics_node(
227 self->accessibility_plugin, node);
228 }
229
230 // Invoked by the engine right before the engine is restarted.
231 //
232 // This method should reset states to be as if the engine had just been started,
233 // which usually indicates the user has requested a hot restart (Shift-R in the
234 // Flutter CLI.)
235 static void on_pre_engine_restart_cb(FlEngine* engine, gpointer user_data) {
236 FlView* self = FL_VIEW(user_data);
237
238 g_clear_object(&self->keyboard_manager);
239 g_clear_object(&self->text_input_plugin);
240 g_clear_object(&self->scrolling_manager);
241 init_keyboard(self);
242 init_scrolling(self);
243 self->window_state =
244 gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(self)));
245 }
246
247 // Implements FlPluginRegistry::get_registrar_for_plugin.
248 static FlPluginRegistrar* fl_view_get_registrar_for_plugin(
249 FlPluginRegistry* registry,
250 const gchar* name) {
251 FlView* self = FL_VIEW(registry);
252
253 return fl_plugin_registrar_new(self,
254 fl_engine_get_binary_messenger(self->engine),
255 fl_engine_get_texture_registrar(self->engine));
256 }
257
258 static void fl_view_plugin_registry_iface_init(
259 FlPluginRegistryInterface* iface) {
260 iface->get_registrar_for_plugin = fl_view_get_registrar_for_plugin;
261 }
262
263 static void fl_view_keyboard_delegate_iface_init(
264 FlKeyboardViewDelegateInterface* iface) {
265 iface->send_key_event =
266 [](FlKeyboardViewDelegate* view_delegate, const FlutterKeyEvent* event,
267 FlutterKeyEventCallback callback, void* user_data) {
268 FlView* self = FL_VIEW(view_delegate);
269 if (self->engine != nullptr) {
270 fl_engine_send_key_event(self->engine, event, callback, user_data);
271 };
272 };
273
274 iface->text_filter_key_press = [](FlKeyboardViewDelegate* view_delegate,
275 FlKeyEvent* event) {
276 FlView* self = FL_VIEW(view_delegate);
277 return fl_text_input_plugin_filter_keypress(self->text_input_plugin, event);
278 };
279
280 iface->get_messenger = [](FlKeyboardViewDelegate* view_delegate) {
281 FlView* self = FL_VIEW(view_delegate);
282 return fl_engine_get_binary_messenger(self->engine);
283 };
284
285 iface->redispatch_event = [](FlKeyboardViewDelegate* view_delegate,
286 std::unique_ptr<FlKeyEvent> in_event) {
287 FlKeyEvent* event = in_event.release();
288 GdkEvent* gdk_event = reinterpret_cast<GdkEvent*>(event->origin);
289 GdkEventType type = gdk_event->type;
290 g_return_if_fail(type == GDK_KEY_PRESS || type == GDK_KEY_RELEASE);
291 gdk_event_put(gdk_event);
292 fl_key_event_dispose(event);
293 };
294
295 iface->subscribe_to_layout_change = [](FlKeyboardViewDelegate* view_delegate,
296 KeyboardLayoutNotifier notifier) {
297 FlView* self = FL_VIEW(view_delegate);
298 self->keyboard_layout_notifier = std::move(notifier);
299 };
300
301 iface->lookup_key = [](FlKeyboardViewDelegate* view_delegate,
302 const GdkKeymapKey* key) -> guint {
303 FlView* self = FL_VIEW(view_delegate);
304 g_return_val_if_fail(self->keymap != nullptr, 0);
305 return gdk_keymap_lookup_key(self->keymap, key);
306 };
307
308 iface->get_keyboard_state =
309 [](FlKeyboardViewDelegate* view_delegate) -> GHashTable* {
310 FlView* self = FL_VIEW(view_delegate);
311 return fl_view_get_keyboard_state(self);
312 };
313 }
314
315 static void fl_view_scrolling_delegate_iface_init(
316 FlScrollingViewDelegateInterface* iface) {
317 iface->send_mouse_pointer_event =
318 [](FlScrollingViewDelegate* view_delegate, FlutterPointerPhase phase,
319 size_t timestamp, double x, double y, double scroll_delta_x,
320 double scroll_delta_y, int64_t buttons) {
321 FlView* self = FL_VIEW(view_delegate);
322 if (self->engine != nullptr) {
323 fl_engine_send_mouse_pointer_event(self->engine, phase, timestamp, x,
324 y, scroll_delta_x, scroll_delta_y,
325 buttons);
326 }
327 };
328 iface->send_pointer_pan_zoom_event =
329 [](FlScrollingViewDelegate* view_delegate, size_t timestamp, double x,
330 double y, FlutterPointerPhase phase, double pan_x, double pan_y,
331 double scale, double rotation) {
332 FlView* self = FL_VIEW(view_delegate);
333 if (self->engine != nullptr) {
334 fl_engine_send_pointer_pan_zoom_event(self->engine, timestamp, x, y,
335 phase, pan_x, pan_y, scale,
336 rotation);
337 };
338 };
339 }
340
341 static void fl_view_text_input_delegate_iface_init(
342 FlTextInputViewDelegateInterface* iface) {
343 iface->translate_coordinates = [](FlTextInputViewDelegate* delegate,
344 gint view_x, gint view_y, gint* window_x,
345 gint* window_y) {
346 FlView* self = FL_VIEW(delegate);
347 gtk_widget_translate_coordinates(GTK_WIDGET(self),
348 gtk_widget_get_toplevel(GTK_WIDGET(self)),
349 view_x, view_y, window_x, window_y);
350 };
351 }
352
353 // Signal handler for GtkWidget::button-press-event
354 static gboolean button_press_event_cb(GtkWidget* widget,
355 GdkEventButton* event,
356 FlView* self) {
357 // Flutter doesn't handle double and triple click events.
358 if (event->type == GDK_DOUBLE_BUTTON_PRESS ||
359 event->type == GDK_TRIPLE_BUTTON_PRESS) {
360 return FALSE;
361 }
362
363 check_pointer_inside(self, reinterpret_cast<GdkEvent*>(event));
364
365 return send_pointer_button_event(self, event);
366 }
367
368 // Signal handler for GtkWidget::button-release-event
369 static gboolean button_release_event_cb(GtkWidget* widget,
370 GdkEventButton* event,
371 FlView* self) {
372 return send_pointer_button_event(self, event);
373 }
374
375 // Signal handler for GtkWidget::scroll-event
376 static gboolean scroll_event_cb(GtkWidget* widget,
377 GdkEventScroll* event,
378 FlView* self) {
379 // TODO(robert-ancell): Update to use GtkEventControllerScroll when we can
380 // depend on GTK 3.24.
381
382 fl_scrolling_manager_handle_scroll_event(
383 self->scrolling_manager, event,
384 gtk_widget_get_scale_factor(GTK_WIDGET(self)));
385 return TRUE;
386 }
387
388 // Signal handler for GtkWidget::motion-notify-event
389 static gboolean motion_notify_event_cb(GtkWidget* widget,
390 GdkEventMotion* event,
391 FlView* self) {
392 if (self->engine == nullptr) {
393 return FALSE;
394 }
395
396 check_pointer_inside(self, reinterpret_cast<GdkEvent*>(event));
397
398 gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
399
400 fl_keyboard_manager_sync_modifier_if_needed(self->keyboard_manager,
401 event->state, event->time);
402 fl_engine_send_mouse_pointer_event(
403 self->engine, self->button_state != 0 ? kMove : kHover,
404 event->time * kMicrosecondsPerMillisecond, event->x * scale_factor,
405 event->y * scale_factor, 0, 0, self->button_state);
406
407 return TRUE;
408 }
409
410 // Signal handler for GtkWidget::enter-notify-event
411 static gboolean enter_notify_event_cb(GtkWidget* widget,
412 GdkEventCrossing* event,
413 FlView* self) {
414 if (self->engine == nullptr) {
415 return FALSE;
416 }
417
418 check_pointer_inside(self, reinterpret_cast<GdkEvent*>(event));
419
420 return TRUE;
421 }
422
423 // Signal handler for GtkWidget::leave-notify-event
424 static gboolean leave_notify_event_cb(GtkWidget* widget,
425 GdkEventCrossing* event,
426 FlView* self) {
427 if (event->mode != GDK_CROSSING_NORMAL) {
428 return FALSE;
429 }
430
431 if (self->engine == nullptr) {
432 return FALSE;
433 }
434
435 // Don't remove pointer while button is down; In case of dragging outside of
436 // window with mouse grab active Gtk will send another leave notify on
437 // release.
438 if (self->pointer_inside && self->button_state == 0) {
439 gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
440 fl_engine_send_mouse_pointer_event(
441 self->engine, kRemove, event->time * kMicrosecondsPerMillisecond,
442 event->x * scale_factor, event->y * scale_factor, 0, 0,
443 self->button_state);
444 self->pointer_inside = FALSE;
445 }
446
447 return TRUE;
448 }
449
450 static void keymap_keys_changed_cb(GdkKeymap* keymapf, FlView* self) {
451 if (self->keyboard_layout_notifier == nullptr) {
452 return;
453 }
454
455 self->keyboard_layout_notifier();
456 }
457
458 static void gesture_rotation_begin_cb(GtkGestureRotate* gesture,
459 GdkEventSequence* sequence,
460 FlView* self) {
461 fl_scrolling_manager_handle_rotation_begin(self->scrolling_manager);
462 }
463
464 static void gesture_rotation_update_cb(GtkGestureRotate* widget,
465 gdouble rotation,
466 gdouble delta,
467 FlView* self) {
468 fl_scrolling_manager_handle_rotation_update(self->scrolling_manager,
469 rotation);
470 }
471
472 static void gesture_rotation_end_cb(GtkGestureRotate* gesture,
473 GdkEventSequence* sequence,
474 FlView* self) {
475 fl_scrolling_manager_handle_rotation_end(self->scrolling_manager);
476 }
477
478 static void gesture_zoom_begin_cb(GtkGestureZoom* gesture,
479 GdkEventSequence* sequence,
480 FlView* self) {
481 fl_scrolling_manager_handle_zoom_begin(self->scrolling_manager);
482 }
483
484 static void gesture_zoom_update_cb(GtkGestureZoom* widget,
485 gdouble scale,
486 FlView* self) {
487 fl_scrolling_manager_handle_zoom_update(self->scrolling_manager, scale);
488 }
489
490 static void gesture_zoom_end_cb(GtkGestureZoom* gesture,
491 GdkEventSequence* sequence,
492 FlView* self) {
493 fl_scrolling_manager_handle_zoom_end(self->scrolling_manager);
494 }
495
496 static gboolean window_state_event_cb(GtkWidget* widget,
497 GdkEvent* event,
498 gpointer user_data) {
499 g_return_val_if_fail(FL_IS_VIEW(user_data), FALSE);
500 g_return_val_if_fail(FL_IS_ENGINE(FL_VIEW(user_data)->engine), FALSE);
501 FlView* self = FL_VIEW(user_data);
502 GdkWindowState state = event->window_state.new_window_state;
503 GdkWindowState previous_state = self->window_state;
504 self->window_state = state;
505 bool was_visible = !((previous_state & GDK_WINDOW_STATE_WITHDRAWN) ||
506 (previous_state & GDK_WINDOW_STATE_ICONIFIED));
507 bool is_visible = !((state & GDK_WINDOW_STATE_WITHDRAWN) ||
508 (state & GDK_WINDOW_STATE_ICONIFIED));
509 bool was_focused = (previous_state & GDK_WINDOW_STATE_FOCUSED);
510 bool is_focused = (state & GDK_WINDOW_STATE_FOCUSED);
511 if (was_visible != is_visible || was_focused != is_focused) {
512 if (self->engine != nullptr) {
513 fl_engine_send_window_state_event(FL_ENGINE(self->engine), is_visible,
514 is_focused);
515 }
516 }
517 return FALSE;
518 }
519
520 static void realize_cb(GtkWidget* widget) {
521 FlView* self = FL_VIEW(widget);
522 g_autoptr(GError) error = nullptr;
523
524 // Handle requests by the user to close the application.
525 GtkWidget* toplevel_window = gtk_widget_get_toplevel(GTK_WIDGET(self));
526
527 // Listen to window state changes.
528 self->window_state_cb_id =
529 g_signal_connect(toplevel_window, "window-state-event",
530 G_CALLBACK(window_state_event_cb), self);
531
532 g_signal_connect(toplevel_window, "delete-event",
533 G_CALLBACK(window_delete_event_cb), self);
534
535 init_keyboard(self);
536
537 if (!fl_renderer_start(self->renderer, self, &error)) {
538 g_warning("Failed to start Flutter renderer: %s", error->message);
539 return;
540 }
541
542 if (!fl_engine_start(self->engine, &error)) {
543 g_warning("Failed to start Flutter engine: %s", error->message);
544 return;
545 }
546
547 handle_geometry_changed(self);
548 }
549
550 static void configure_cb(GtkWidget* widget, GdkEventConfigure event) {
551 FlView* self = FL_VIEW(widget);
552 handle_geometry_changed(self);
553 }
554
555 static void fl_view_constructed(GObject* object) {
556 FlView* self = FL_VIEW(object);
557
558 self->renderer = FL_RENDERER(fl_renderer_gl_new());
559 self->engine = fl_engine_new(self->project, self->renderer);
560 fl_engine_set_update_semantics_node_handler(
561 self->engine, update_semantics_node_cb, self, nullptr);
562 fl_engine_set_on_pre_engine_restart_handler(
563 self->engine, on_pre_engine_restart_cb, self, nullptr);
564
565 // Must initialize the keymap before the keyboard.
566 self->keymap = gdk_keymap_get_for_display(gdk_display_get_default());
567
568 // Create system channel handlers.
569 FlBinaryMessenger* messenger = fl_engine_get_binary_messenger(self->engine);
570 self->accessibility_plugin = fl_accessibility_plugin_new(self);
571 init_scrolling(self);
572 self->mouse_cursor_plugin = fl_mouse_cursor_plugin_new(messenger, self);
573 self->platform_plugin = fl_platform_plugin_new(messenger);
574
575 self->event_box = gtk_event_box_new();
576 gtk_widget_set_hexpand(self->event_box, TRUE);
577 gtk_widget_set_vexpand(self->event_box, TRUE);
578 gtk_container_add(GTK_CONTAINER(self), self->event_box);
579 gtk_widget_show(self->event_box);
580 gtk_widget_add_events(self->event_box,
581 GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK |
582 GDK_BUTTON_RELEASE_MASK | GDK_SCROLL_MASK |
583 GDK_SMOOTH_SCROLL_MASK);
584
585 g_signal_connect(self->event_box, "button-press-event",
586 G_CALLBACK(button_press_event_cb), self);
587 g_signal_connect(self->event_box, "button-release-event",
588 G_CALLBACK(button_release_event_cb), self);
589 g_signal_connect(self->event_box, "scroll-event", G_CALLBACK(scroll_event_cb),
590 self);
591 g_signal_connect(self->event_box, "motion-notify-event",
592 G_CALLBACK(motion_notify_event_cb), self);
593 g_signal_connect(self->event_box, "enter-notify-event",
594 G_CALLBACK(enter_notify_event_cb), self);
595 g_signal_connect(self->event_box, "leave-notify-event",
596 G_CALLBACK(leave_notify_event_cb), self);
597 self->keymap_keys_changed_cb_id = g_signal_connect(
598 self->keymap, "keys-changed", G_CALLBACK(keymap_keys_changed_cb), self);
599 GtkGesture* zoom = gtk_gesture_zoom_new(self->event_box);
600 g_signal_connect(zoom, "begin", G_CALLBACK(gesture_zoom_begin_cb), self);
601 g_signal_connect(zoom, "scale-changed", G_CALLBACK(gesture_zoom_update_cb),
602 self);
603 g_signal_connect(zoom, "end", G_CALLBACK(gesture_zoom_end_cb), self);
604 GtkGesture* rotate = gtk_gesture_rotate_new(self->event_box);
605 g_signal_connect(rotate, "begin", G_CALLBACK(gesture_rotation_begin_cb),
606 self);
607 g_signal_connect(rotate, "angle-changed",
608 G_CALLBACK(gesture_rotation_update_cb), self);
609 g_signal_connect(rotate, "end", G_CALLBACK(gesture_rotation_end_cb), self);
610
611 g_signal_connect(self, "realize", G_CALLBACK(realize_cb), self);
612 g_signal_connect(self, "size-allocate", G_CALLBACK(configure_cb), self);
613 }
614
615 static void fl_view_set_property(GObject* object,
616 guint prop_id,
617 const GValue* value,
618 GParamSpec* pspec) {
619 FlView* self = FL_VIEW(object);
620
621 switch (prop_id) {
622 case kPropFlutterProject:
623 g_set_object(&self->project,
624 static_cast<FlDartProject*>(g_value_get_object(value)));
625 break;
626 default:
627 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
628 break;
629 }
630 }
631
632 static void fl_view_get_property(GObject* object,
633 guint prop_id,
634 GValue* value,
635 GParamSpec* pspec) {
636 FlView* self = FL_VIEW(object);
637
638 switch (prop_id) {
639 case kPropFlutterProject:
640 g_value_set_object(value, self->project);
641 break;
642 default:
643 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
644 break;
645 }
646 }
647
648 static void fl_view_notify(GObject* object, GParamSpec* pspec) {
649 FlView* self = FL_VIEW(object);
650
651 if (strcmp(pspec->name, "scale-factor") == 0) {
652 handle_geometry_changed(self);
653 }
654
655 if (G_OBJECT_CLASS(fl_view_parent_class)->notify != nullptr) {
656 G_OBJECT_CLASS(fl_view_parent_class)->notify(object, pspec);
657 }
658 }
659
660 static void fl_view_dispose(GObject* object) {
661 FlView* self = FL_VIEW(object);
662
663 if (self->engine != nullptr) {
664 fl_engine_set_update_semantics_node_handler(self->engine, nullptr, nullptr,
665 nullptr);
666 fl_engine_set_on_pre_engine_restart_handler(self->engine, nullptr, nullptr,
667 nullptr);
668 }
669
670 if (self->window_state_cb_id != 0) {
671 GtkWidget* toplevel_window = gtk_widget_get_toplevel(GTK_WIDGET(self));
672 g_signal_handler_disconnect(toplevel_window, self->window_state_cb_id);
673 self->window_state_cb_id = 0;
674 }
675
676 g_clear_object(&self->project);
677 g_clear_object(&self->renderer);
678 g_clear_object(&self->engine);
679 g_clear_object(&self->accessibility_plugin);
680 g_clear_object(&self->keyboard_manager);
681 if (self->keymap_keys_changed_cb_id != 0) {
682 g_signal_handler_disconnect(self->keymap, self->keymap_keys_changed_cb_id);
683 self->keymap_keys_changed_cb_id = 0;
684 }
685 g_clear_object(&self->mouse_cursor_plugin);
686 g_clear_object(&self->platform_plugin);
687
688 G_OBJECT_CLASS(fl_view_parent_class)->dispose(object);
689 }
690
691 // Implements GtkWidget::key_press_event.
692 static gboolean fl_view_key_press_event(GtkWidget* widget, GdkEventKey* event) {
693 FlView* self = FL_VIEW(widget);
694
695 return fl_keyboard_manager_handle_event(
696 self->keyboard_manager, fl_key_event_new_from_gdk_event(gdk_event_copy(
697 reinterpret_cast<GdkEvent*>(event))));
698 }
699
700 // Implements GtkWidget::key_release_event.
701 static gboolean fl_view_key_release_event(GtkWidget* widget,
702 GdkEventKey* event) {
703 FlView* self = FL_VIEW(widget);
704 return fl_keyboard_manager_handle_event(
705 self->keyboard_manager, fl_key_event_new_from_gdk_event(gdk_event_copy(
706 reinterpret_cast<GdkEvent*>(event))));
707 }
708
709 static void fl_view_class_init(FlViewClass* klass) {
710 GObjectClass* object_class = G_OBJECT_CLASS(klass);
711 object_class->constructed = fl_view_constructed;
712 object_class->set_property = fl_view_set_property;
713 object_class->get_property = fl_view_get_property;
714 object_class->notify = fl_view_notify;
715 object_class->dispose = fl_view_dispose;
716
717 GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
718 widget_class->key_press_event = fl_view_key_press_event;
719 widget_class->key_release_event = fl_view_key_release_event;
720
721 g_object_class_install_property(
722 G_OBJECT_CLASS(klass), kPropFlutterProject,
723 g_param_spec_object(
724 "flutter-project", "flutter-project", "Flutter project in use",
725 fl_dart_project_get_type(),
726 static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
727 G_PARAM_STATIC_STRINGS)));
728
729 gtk_widget_class_set_accessible_type(GTK_WIDGET_CLASS(klass),
730 fl_view_accessible_get_type());
731 }
732
733 static void fl_view_init(FlView* self) {
734 gtk_widget_set_can_focus(GTK_WIDGET(self), TRUE);
735 self->window_state = gdk_window_get_state(
736 gtk_widget_get_window(gtk_widget_get_toplevel(GTK_WIDGET(self))));
737 }
738
739 G_MODULE_EXPORT FlView* fl_view_new(FlDartProject* project) {
740 return static_cast<FlView*>(
741 g_object_new(fl_view_get_type(), "flutter-project", project, nullptr));
742 }
743
744 G_MODULE_EXPORT FlEngine* fl_view_get_engine(FlView* self) {
745 g_return_val_if_fail(FL_IS_VIEW(self), nullptr);
746 return self->engine;
747 }
748
749 void fl_view_set_textures(FlView* self,
750 GdkGLContext* context,
751 GPtrArray* textures) {
752 g_return_if_fail(FL_IS_VIEW(self));
753
754 if (self->gl_area == nullptr) {
755 self->gl_area = FL_GL_AREA(fl_gl_area_new(context));
756 gtk_widget_show(GTK_WIDGET(self->gl_area));
757 gtk_container_add(GTK_CONTAINER(self->event_box),
758 GTK_WIDGET(self->gl_area));
759 }
760
761 fl_gl_area_queue_render(self->gl_area, textures);
762 }
763
764 GHashTable* fl_view_get_keyboard_state(FlView* self) {
765 g_return_val_if_fail(FL_IS_VIEW(self), nullptr);
766
767 return fl_keyboard_manager_get_pressed_state(self->keyboard_manager);
768 }
fl_accessibility_plugin_new
FlAccessibilityPlugin * fl_accessibility_plugin_new(FlView *view)
Definition: fl_accessibility_plugin.cc:35
_FlView::pointer_inside
gboolean pointer_inside
Definition: fl_view.cc:60
realize_cb
static void realize_cb(GtkWidget *widget)
Definition: fl_view.cc:520
fl_renderer_wait_for_frame
void fl_renderer_wait_for_frame(FlRenderer *self, int target_width, int target_height)
Definition: fl_renderer.cc:140
fl_view_text_input_delegate_iface_init
static void fl_view_text_input_delegate_iface_init(FlTextInputViewDelegateInterface *iface)
Definition: fl_view.cc:341
fl_view_get_property
static void fl_view_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
Definition: fl_view.cc:632
fl_view_accessible.h
gesture_rotation_begin_cb
static void gesture_rotation_begin_cb(GtkGestureRotate *gesture, GdkEventSequence *sequence, FlView *self)
Definition: fl_view.cc:458
fl_scrolling_manager_handle_zoom_end
void fl_scrolling_manager_handle_zoom_end(FlScrollingManager *self)
Definition: fl_scrolling_manager.cc:174
fl_engine_send_key_event
void fl_engine_send_key_event(FlEngine *self, const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)
Definition: fl_engine.cc:838
kMicrosecondsPerMillisecond
static constexpr int kMicrosecondsPerMillisecond
Definition: fl_view.cc:28
fl_view_scrolling_delegate_iface_init
static void fl_view_scrolling_delegate_iface_init(FlScrollingViewDelegateInterface *iface)
Definition: fl_view.cc:315
motion_notify_event_cb
static gboolean motion_notify_event_cb(GtkWidget *widget, GdkEventMotion *event, FlView *self)
Definition: fl_view.cc:389
fl_text_input_view_delegate.h
fl_text_input_plugin_filter_keypress
gboolean fl_text_input_plugin_filter_keypress(FlTextInputPlugin *self, FlKeyEvent *event)
Definition: fl_text_input_plugin.cc:776
fl_scrolling_view_delegate.h
fl_view_class_init
static void fl_view_class_init(FlViewClass *klass)
Definition: fl_view.cc:709
fl_plugin_registrar_private.h
gesture_zoom_end_cb
static void gesture_zoom_end_cb(GtkGestureZoom *gesture, GdkEventSequence *sequence, FlView *self)
Definition: fl_view.cc:490
_FlView::parent_instance
GtkBox parent_instance
Definition: fl_view.cc:31
fl_keyboard_manager.h
init_scrolling
static void init_scrolling(FlView *self)
Definition: fl_view.cc:122
fl_engine_send_mouse_pointer_event
void fl_engine_send_mouse_pointer_event(FlEngine *self, FlutterPointerPhase phase, size_t timestamp, double x, double y, double scroll_delta_x, double scroll_delta_y, int64_t buttons)
Definition: fl_engine.cc:777
fl_mouse_cursor_plugin.h
G_DEFINE_TYPE_WITH_CODE
G_DEFINE_TYPE_WITH_CODE(FlView, fl_view, GTK_TYPE_BOX, G_IMPLEMENT_INTERFACE(fl_plugin_registry_get_type(), fl_view_plugin_registry_iface_init) G_IMPLEMENT_INTERFACE(fl_keyboard_view_delegate_get_type(), fl_view_keyboard_delegate_iface_init) G_IMPLEMENT_INTERFACE(fl_scrolling_view_delegate_get_type(), fl_view_scrolling_delegate_iface_init) G_IMPLEMENT_INTERFACE(fl_text_input_view_delegate_get_type(), fl_view_text_input_delegate_iface_init)) static gboolean window_delete_event_cb(GtkWidget *widget
fl_text_input_plugin.h
send_pointer_button_event
static gboolean send_pointer_button_event(FlView *self, GdkEventButton *event)
Definition: fl_view.cc:128
fl_view_get_registrar_for_plugin
static FlPluginRegistrar * fl_view_get_registrar_for_plugin(FlPluginRegistry *registry, const gchar *name)
Definition: fl_view.cc:248
configure_cb
static void configure_cb(GtkWidget *widget, GdkEventConfigure event)
Definition: fl_view.cc:550
leave_notify_event_cb
static gboolean leave_notify_event_cb(GtkWidget *widget, GdkEventCrossing *event, FlView *self)
Definition: fl_view.cc:424
gesture_rotation_end_cb
static void gesture_rotation_end_cb(GtkGestureRotate *gesture, GdkEventSequence *sequence, FlView *self)
Definition: fl_view.cc:472
fl_platform_plugin_request_app_exit
void fl_platform_plugin_request_app_exit(FlPlatformPlugin *self)
Definition: fl_platform_plugin.cc:407
_FlView::window_state
GdkWindowState window_state
Definition: fl_view.cc:46
_FlView::keymap
GdkKeymap * keymap
Definition: fl_view.cc:64
fl_renderer_gl.h
fl_platform_plugin_new
FlPlatformPlugin * fl_platform_plugin_new(FlBinaryMessenger *messenger)
Definition: fl_platform_plugin.cc:391
user_data
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
Definition: fl_key_channel_responder.cc:121
_FlView
Definition: fl_view.cc:30
_FlView::event_box
GtkWidget * event_box
Definition: fl_view.cc:56
fl_accessibility_plugin_handle_update_semantics_node
void fl_accessibility_plugin_handle_update_semantics_node(FlAccessibilityPlugin *self, const FlutterSemanticsNode *node)
Definition: fl_accessibility_plugin.cc:46
fl_engine_send_window_metrics_event
void fl_engine_send_window_metrics_event(FlEngine *self, size_t width, size_t height, double pixel_ratio)
Definition: fl_engine.cc:759
fl_view_set_property
static void fl_view_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
Definition: fl_view.cc:615
fl_key_event_new_from_gdk_event
FlKeyEvent * fl_key_event_new_from_gdk_event(GdkEvent *raw_event)
Definition: fl_key_event.cc:12
keymap_keys_changed_cb
static void keymap_keys_changed_cb(GdkKeymap *keymapf, FlView *self)
Definition: fl_view.cc:450
fl_engine_get_binary_messenger
G_MODULE_EXPORT FlBinaryMessenger * fl_engine_get_binary_messenger(FlEngine *self)
Definition: fl_engine.cc:893
_FlView::accessibility_plugin
FlAccessibilityPlugin * accessibility_plugin
Definition: fl_view.cc:49
event
GdkEvent * event
Definition: fl_view.cc:99
_FlKeyEvent
Definition: fl_key_event.h:31
state
AtkStateType state
Definition: fl_accessible_node.cc:10
gesture_zoom_update_cb
static void gesture_zoom_update_cb(GtkGestureZoom *widget, gdouble scale, FlView *self)
Definition: fl_view.cc:484
fl_view_private.h
_FlView::scrolling_manager
FlScrollingManager * scrolling_manager
Definition: fl_view.cc:51
_FlView::window_state_cb_id
gulong window_state_cb_id
Definition: fl_view.cc:67
fl_gl_area_new
GtkWidget * fl_gl_area_new(GdkGLContext *context)
Definition: fl_gl_area.cc:121
fl_view_new
G_MODULE_EXPORT FlView * fl_view_new(FlDartProject *project)
Definition: fl_view.cc:739
fl_keyboard_manager_handle_event
gboolean fl_keyboard_manager_handle_event(FlKeyboardManager *self, FlKeyEvent *event)
Definition: fl_keyboard_manager.cc:635
_FlView::gl_area
FlGLArea * gl_area
Definition: fl_view.cc:57
_FlView::button_state
int64_t button_state
Definition: fl_view.cc:43
fl_engine_set_update_semantics_node_handler
void fl_engine_set_update_semantics_node_handler(FlEngine *self, FlEngineUpdateSemanticsNodeHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_engine.cc:612
KeyboardLayoutNotifier
std::function< void()> KeyboardLayoutNotifier
Definition: fl_keyboard_view_delegate.h:17
window_state_event_cb
static gboolean window_state_event_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data)
Definition: fl_view.cc:496
kPropLast
@ kPropLast
Definition: fl_view.cc:70
TRUE
return TRUE
Definition: fl_view.cc:103
fl_accessibility_plugin.h
fl_engine_send_pointer_pan_zoom_event
void fl_engine_send_pointer_pan_zoom_event(FlEngine *self, size_t timestamp, double x, double y, FlutterPointerPhase phase, double pan_x, double pan_y, double scale, double rotation)
Definition: fl_engine.cc:808
fl_scrolling_manager_new
FlScrollingManager * fl_scrolling_manager_new(FlScrollingViewDelegate *view_delegate)
Definition: fl_scrolling_manager.cc:41
_FlView::keyboard_layout_notifier
KeyboardLayoutNotifier keyboard_layout_notifier
Definition: fl_view.cc:63
fl_view_key_press_event
static gboolean fl_view_key_press_event(GtkWidget *widget, GdkEventKey *event)
Definition: fl_view.cc:692
enter_notify_event_cb
static gboolean enter_notify_event_cb(GtkWidget *widget, GdkEventCrossing *event, FlView *self)
Definition: fl_view.cc:411
_FlView::engine
FlEngine * engine
Definition: fl_view.cc:40
fl_engine_new
FlEngine * fl_engine_new(FlDartProject *project, FlRenderer *renderer)
Definition: fl_engine.cc:466
fl_view_key_release_event
static gboolean fl_view_key_release_event(GtkWidget *widget, GdkEventKey *event)
Definition: fl_view.cc:701
fl_view_plugin_registry_iface_init
static void fl_view_plugin_registry_iface_init(FlPluginRegistryInterface *iface)
Definition: fl_view.cc:258
fl_scrolling_manager_set_last_mouse_position
void fl_scrolling_manager_set_last_mouse_position(FlScrollingManager *self, gdouble x, gdouble y)
Definition: fl_scrolling_manager.cc:60
fl_view_dispose
static void fl_view_dispose(GObject *object)
Definition: fl_view.cc:660
fl_engine_private.h
fl_scrolling_manager.h
fl_scrolling_manager_handle_zoom_update
void fl_scrolling_manager_handle_zoom_update(FlScrollingManager *self, gdouble scale)
Definition: fl_scrolling_manager.cc:167
fl_view_get_engine
G_MODULE_EXPORT FlEngine * fl_view_get_engine(FlView *self)
Definition: fl_view.cc:744
check_pointer_inside
static void check_pointer_inside(FlView *self, GdkEvent *event)
Definition: fl_view.cc:182
button_press_event_cb
static gboolean button_press_event_cb(GtkWidget *widget, GdkEventButton *event, FlView *self)
Definition: fl_view.cc:354
fl_view_get_keyboard_state
GHashTable * fl_view_get_keyboard_state(FlView *self)
Definition: fl_view.cc:764
fl_scrolling_manager_handle_rotation_update
void fl_scrolling_manager_handle_rotation_update(FlScrollingManager *self, gdouble rotation)
Definition: fl_scrolling_manager.cc:141
gesture_rotation_update_cb
static void gesture_rotation_update_cb(GtkGestureRotate *widget, gdouble rotation, gdouble delta, FlView *self)
Definition: fl_view.cc:464
_FlView::keymap_keys_changed_cb_id
gulong keymap_keys_changed_cb_id
Definition: fl_view.cc:65
fl_view.h
_FlView::mouse_cursor_plugin
FlMouseCursorPlugin * mouse_cursor_plugin
Definition: fl_view.cc:53
fl_keyboard_manager_new
FlKeyboardManager * fl_keyboard_manager_new(FlBinaryMessenger *messenger, FlKeyboardViewDelegate *view_delegate)
Definition: fl_keyboard_manager.cc:585
fl_key_event_dispose
void fl_key_event_dispose(FlKeyEvent *event)
Definition: fl_key_event.cc:33
fl_keyboard_manager_sync_modifier_if_needed
void fl_keyboard_manager_sync_modifier_if_needed(FlKeyboardManager *self, guint state, double event_time)
Definition: fl_keyboard_manager.cc:672
button_release_event_cb
static gboolean button_release_event_cb(GtkWidget *widget, GdkEventButton *event, FlView *self)
Definition: fl_view.cc:369
_FlView::text_input_plugin
FlTextInputPlugin * text_input_plugin
Definition: fl_view.cc:52
self
GdkEvent FlView * self
Definition: fl_view.cc:100
on_pre_engine_restart_cb
static void on_pre_engine_restart_cb(FlEngine *engine, gpointer user_data)
Definition: fl_view.cc:235
fl_renderer_start
gboolean fl_renderer_start(FlRenderer *self, FlView *view, GError **error)
Definition: fl_renderer.cc:59
fl_keyboard_manager_get_pressed_state
GHashTable * fl_keyboard_manager_get_pressed_state(FlKeyboardManager *self)
Definition: fl_keyboard_manager.cc:685
update_semantics_node_cb
static void update_semantics_node_cb(FlEngine *engine, const FlutterSemanticsNode *node, gpointer user_data)
Definition: fl_view.cc:221
fl_gl_area_queue_render
void fl_gl_area_queue_render(FlGLArea *self, GPtrArray *textures)
Definition: fl_gl_area.cc:129
handle_geometry_changed
static void handle_geometry_changed(FlView *self)
Definition: fl_view.cc:199
fl_view_constructed
static void fl_view_constructed(GObject *object)
Definition: fl_view.cc:555
fl_renderer_gl_new
FlRendererGL * fl_renderer_gl_new()
Definition: fl_renderer_gl.cc:134
fl_view_keyboard_delegate_iface_init
static void fl_view_keyboard_delegate_iface_init(FlKeyboardViewDelegateInterface *iface)
Definition: fl_view.cc:263
fl_scrolling_manager_handle_scroll_event
void fl_scrolling_manager_handle_scroll_event(FlScrollingManager *self, GdkEventScroll *event, gint scale_factor)
Definition: fl_scrolling_manager.cc:67
fl_key_event.h
fl_engine.h
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
_FlView::renderer
FlRenderer * renderer
Definition: fl_view.cc:37
fl_mouse_cursor_plugin_new
FlMouseCursorPlugin * fl_mouse_cursor_plugin_new(FlBinaryMessenger *messenger, FlView *view)
Definition: fl_mouse_cursor_plugin.cc:163
fl_view_init
static void fl_view_init(FlView *self)
Definition: fl_view.cc:733
fl_view_notify
static void fl_view_notify(GObject *object, GParamSpec *pspec)
Definition: fl_view.cc:648
fl_scrolling_manager_handle_rotation_end
void fl_scrolling_manager_handle_rotation_end(FlScrollingManager *self)
Definition: fl_scrolling_manager.cc:148
fl_view_set_textures
void fl_view_set_textures(FlView *self, GdkGLContext *context, GPtrArray *textures)
Definition: fl_view.cc:749
fl_engine_start
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition: fl_engine.cc:482
fl_scrolling_manager_handle_rotation_begin
void fl_scrolling_manager_handle_rotation_begin(FlScrollingManager *self)
Definition: fl_scrolling_manager.cc:130
_FlView::keyboard_manager
FlKeyboardManager * keyboard_manager
Definition: fl_view.cc:50
fl_engine_send_window_state_event
void fl_engine_send_window_state_event(FlEngine *self, gboolean visible, gboolean focused)
Definition: fl_engine.cc:747
fl_plugin_registrar_new
FlPluginRegistrar * fl_plugin_registrar_new(FlView *view, FlBinaryMessenger *messenger, FlTextureRegistrar *texture_registrar)
Definition: fl_plugin_registrar.cc:87
engine
FlEngine * engine
Definition: fl_view_accessible.cc:29
fl_keyboard_view_delegate.h
fl_platform_plugin.h
fl_plugin_registry.h
callback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition: fl_key_channel_responder.cc:120
_FlView::project
FlDartProject * project
Definition: fl_view.cc:34
fl_scrolling_manager_handle_zoom_begin
void fl_scrolling_manager_handle_zoom_begin(FlScrollingManager *self)
Definition: fl_scrolling_manager.cc:157
_FlView::platform_plugin
FlPlatformPlugin * platform_plugin
Definition: fl_view.cc:54
value
uint8_t value
Definition: fl_standard_message_codec.cc:41
init_keyboard
static void init_keyboard(FlView *self)
Definition: fl_view.cc:107
fl_engine_get_texture_registrar
G_MODULE_EXPORT FlTextureRegistrar * fl_engine_get_texture_registrar(FlEngine *self)
Definition: fl_engine.cc:909
node
G_BEGIN_DECLS const FlutterSemanticsNode * node
Definition: fl_view_accessible.h:40
fl_text_input_plugin_new
FlTextInputPlugin * fl_text_input_plugin_new(FlBinaryMessenger *messenger, GtkIMContext *im_context, FlTextInputViewDelegate *view_delegate)
Definition: fl_text_input_plugin.cc:745
fl_engine_set_on_pre_engine_restart_handler
void fl_engine_set_on_pre_engine_restart_handler(FlEngine *self, FlEngineOnPreEngineRestartHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_engine.cc:629
scroll_event_cb
static gboolean scroll_event_cb(GtkWidget *widget, GdkEventScroll *event, FlView *self)
Definition: fl_view.cc:376
kPropFlutterProject
@ kPropFlutterProject
Definition: fl_view.cc:70
gesture_zoom_begin_cb
static void gesture_zoom_begin_cb(GtkGestureZoom *gesture, GdkEventSequence *sequence, FlView *self)
Definition: fl_view.cc:478
FlKeyboardManager
typedefG_BEGIN_DECLS struct _FlKeyboardManager FlKeyboardManager
Definition: fl_key_responder.h:17