Flutter Linux Embedder
fl_view.cc File Reference

Go to the source code of this file.

Classes

struct  _FlView
 

Enumerations

enum  {
  kPropFlutterProject = 1,
  kPropLast
}
 

Functions

static void fl_view_plugin_registry_iface_init (FlPluginRegistryInterface *iface)
 
static void fl_view_keyboard_delegate_iface_init (FlKeyboardViewDelegateInterface *iface)
 
static void fl_view_scrolling_delegate_iface_init (FlScrollingViewDelegateInterface *iface)
 
static void fl_view_text_input_delegate_iface_init (FlTextInputViewDelegateInterface *iface)
 
 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(FlView *self)
 
static void init_keyboard (FlView *self)
 
static void init_scrolling (FlView *self)
 
static FlutterPointerDeviceKind get_device_kind (GdkEvent *event)
 
static gboolean send_pointer_button_event (FlView *self, GdkEvent *event)
 
static void check_pointer_inside (FlView *self, GdkEvent *event)
 
static void handle_geometry_changed (FlView *self)
 
static void update_semantics_cb (FlEngine *engine, const FlutterSemanticsUpdate2 *update, gpointer user_data)
 
static void on_pre_engine_restart_cb (FlEngine *engine, gpointer user_data)
 
static FlPluginRegistrar * fl_view_get_registrar_for_plugin (FlPluginRegistry *registry, const gchar *name)
 
static gboolean button_press_event_cb (FlView *self, GdkEventButton *button_event)
 
static gboolean button_release_event_cb (FlView *self, GdkEventButton *button_event)
 
static gboolean scroll_event_cb (FlView *self, GdkEventScroll *event)
 
static gboolean motion_notify_event_cb (FlView *self, GdkEventMotion *motion_event)
 
static gboolean enter_notify_event_cb (FlView *self, GdkEventCrossing *crossing_event)
 
static gboolean leave_notify_event_cb (FlView *self, GdkEventCrossing *crossing_event)
 
static void keymap_keys_changed_cb (FlView *self)
 
static void gesture_rotation_begin_cb (FlView *self)
 
static void gesture_rotation_update_cb (FlView *self, gdouble rotation, gdouble delta)
 
static void gesture_rotation_end_cb (FlView *self)
 
static void gesture_zoom_begin_cb (FlView *self)
 
static void gesture_zoom_update_cb (FlView *self, gdouble scale)
 
static void gesture_zoom_end_cb (FlView *self)
 
static gboolean window_state_event_cb (FlView *self, GdkEvent *event)
 
static GdkGLContext * create_context_cb (FlView *self)
 
static void realize_cb (FlView *self)
 
static gboolean render_cb (FlView *self, GdkGLContext *context)
 
static void unrealize_cb (FlView *self)
 
static void size_allocate_cb (FlView *self)
 
static void fl_view_constructed (GObject *object)
 
static void fl_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 
static void fl_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 
static void fl_view_notify (GObject *object, GParamSpec *pspec)
 
static void fl_view_dispose (GObject *object)
 
static gboolean fl_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
 
static gboolean fl_view_key_release_event (GtkWidget *widget, GdkEventKey *event)
 
static void fl_view_class_init (FlViewClass *klass)
 
static void fl_view_init (FlView *self)
 
G_MODULE_EXPORT FlView * fl_view_new (FlDartProject *project)
 
G_MODULE_EXPORT FlEngine * fl_view_get_engine (FlView *self)
 
void fl_view_redraw (FlView *self)
 
GHashTable * fl_view_get_keyboard_state (FlView *self)
 

Variables

static constexpr int kMicrosecondsPerMillisecond = 1000
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kPropFlutterProject 
kPropLast 

Definition at line 77 of file fl_view.cc.

Function Documentation

◆ button_press_event_cb()

static gboolean button_press_event_cb ( FlView *  self,
GdkEventButton *  button_event 
)
static

Definition at line 386 of file fl_view.cc.

387  {
388  GdkEvent* event = reinterpret_cast<GdkEvent*>(button_event);
389 
390  // Flutter doesn't handle double and triple click events.
391  GdkEventType event_type = gdk_event_get_event_type(event);
392  if (event_type == GDK_DOUBLE_BUTTON_PRESS ||
393  event_type == GDK_TRIPLE_BUTTON_PRESS) {
394  return FALSE;
395  }
396 
398 
399  return send_pointer_button_event(self, event);
400 }

References check_pointer_inside(), event, and send_pointer_button_event().

Referenced by fl_view_init().

◆ button_release_event_cb()

static gboolean button_release_event_cb ( FlView *  self,
GdkEventButton *  button_event 
)
static

Definition at line 403 of file fl_view.cc.

404  {
405  GdkEvent* event = reinterpret_cast<GdkEvent*>(button_event);
406  return send_pointer_button_event(self, event);
407 }

References event, and send_pointer_button_event().

Referenced by fl_view_init().

◆ check_pointer_inside()

static void check_pointer_inside ( FlView *  self,
GdkEvent *  event 
)
static

Definition at line 217 of file fl_view.cc.

217  {
218  if (!self->pointer_inside) {
219  self->pointer_inside = TRUE;
220 
221  gdouble x, y;
222  if (gdk_event_get_coords(event, &x, &y)) {
223  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
224 
226  self->engine, kAdd,
227  gdk_event_get_time(event) * kMicrosecondsPerMillisecond,
228  x * scale_factor, y * scale_factor, get_device_kind(event), 0, 0,
229  self->button_state);
230  }
231  }
232 }

References event, fl_engine_send_mouse_pointer_event(), get_device_kind(), kMicrosecondsPerMillisecond, and TRUE.

Referenced by button_press_event_cb(), enter_notify_event_cb(), and motion_notify_event_cb().

◆ create_context_cb()

static GdkGLContext* create_context_cb ( FlView *  self)
static

Definition at line 552 of file fl_view.cc.

552  {
553  fl_renderer_gdk_set_window(self->renderer,
554  gtk_widget_get_parent_window(GTK_WIDGET(self)));
555 
556  // Must initialize the keymap before the keyboard.
557  self->keymap = gdk_keymap_get_for_display(gdk_display_get_default());
558  self->keymap_keys_changed_cb_id = g_signal_connect_swapped(
559  self->keymap, "keys-changed", G_CALLBACK(keymap_keys_changed_cb), self);
560 
561  // Create system channel handlers.
562  FlBinaryMessenger* messenger = fl_engine_get_binary_messenger(self->engine);
563  init_scrolling(self);
564  self->mouse_cursor_plugin = fl_mouse_cursor_plugin_new(messenger, self);
565  self->platform_plugin = fl_platform_plugin_new(messenger);
566 
567  g_autoptr(GError) error = nullptr;
568  if (!fl_renderer_gdk_create_contexts(self->renderer, &error)) {
569  gtk_gl_area_set_error(self->gl_area, error);
570  return nullptr;
571  }
572 
573  return GDK_GL_CONTEXT(
574  g_object_ref(fl_renderer_gdk_get_context(self->renderer)));
575 }

References error, fl_engine_get_binary_messenger(), fl_mouse_cursor_plugin_new(), fl_platform_plugin_new(), fl_renderer_gdk_create_contexts(), fl_renderer_gdk_get_context(), fl_renderer_gdk_set_window(), init_scrolling(), and keymap_keys_changed_cb().

Referenced by fl_view_init().

◆ enter_notify_event_cb()

static gboolean enter_notify_event_cb ( FlView *  self,
GdkEventCrossing *  crossing_event 
)
static

Definition at line 451 of file fl_view.cc.

452  {
453  GdkEvent* event = reinterpret_cast<GdkEvent*>(crossing_event);
454 
455  if (self->engine == nullptr) {
456  return FALSE;
457  }
458 
460 
461  return TRUE;
462 }

References check_pointer_inside(), event, and TRUE.

Referenced by fl_view_init().

◆ fl_view_class_init()

static void fl_view_class_init ( FlViewClass *  klass)
static

Definition at line 757 of file fl_view.cc.

757  {
758  GObjectClass* object_class = G_OBJECT_CLASS(klass);
759  object_class->constructed = fl_view_constructed;
760  object_class->set_property = fl_view_set_property;
761  object_class->get_property = fl_view_get_property;
762  object_class->notify = fl_view_notify;
763  object_class->dispose = fl_view_dispose;
764 
765  GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
766  widget_class->key_press_event = fl_view_key_press_event;
767  widget_class->key_release_event = fl_view_key_release_event;
768 
769  g_object_class_install_property(
770  G_OBJECT_CLASS(klass), kPropFlutterProject,
771  g_param_spec_object(
772  "flutter-project", "flutter-project", "Flutter project in use",
773  fl_dart_project_get_type(),
774  static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
775  G_PARAM_STATIC_STRINGS)));
776 
777  gtk_widget_class_set_accessible_type(GTK_WIDGET_CLASS(klass),
778  fl_socket_accessible_get_type());
779 }

References fl_view_constructed(), fl_view_dispose(), fl_view_get_property(), fl_view_key_press_event(), fl_view_key_release_event(), fl_view_notify(), fl_view_set_property(), and kPropFlutterProject.

◆ fl_view_constructed()

static void fl_view_constructed ( GObject *  object)
static

Definition at line 652 of file fl_view.cc.

652  {
653  FlView* self = FL_VIEW(object);
654 
655  self->renderer = fl_renderer_gdk_new();
656  self->engine = fl_engine_new(self->project, FL_RENDERER(self->renderer));
658  self, nullptr);
660  self->engine, on_pre_engine_restart_cb, self, nullptr);
661 }

References fl_engine_new(), fl_engine_set_on_pre_engine_restart_handler(), fl_engine_set_update_semantics_handler(), fl_renderer_gdk_new(), on_pre_engine_restart_cb(), and update_semantics_cb().

Referenced by fl_view_class_init().

◆ fl_view_dispose()

static void fl_view_dispose ( GObject *  object)
static

Definition at line 708 of file fl_view.cc.

708  {
709  FlView* self = FL_VIEW(object);
710 
711  if (self->engine != nullptr) {
712  fl_engine_set_update_semantics_handler(self->engine, nullptr, nullptr,
713  nullptr);
714  fl_engine_set_on_pre_engine_restart_handler(self->engine, nullptr, nullptr,
715  nullptr);
716  }
717 
718  if (self->window_state_cb_id != 0) {
719  GtkWidget* toplevel_window = gtk_widget_get_toplevel(GTK_WIDGET(self));
720  g_signal_handler_disconnect(toplevel_window, self->window_state_cb_id);
721  self->window_state_cb_id = 0;
722  }
723 
724  g_clear_object(&self->project);
725  g_clear_object(&self->renderer);
726  g_clear_object(&self->engine);
727  g_clear_object(&self->keyboard_manager);
728  if (self->keymap_keys_changed_cb_id != 0) {
729  g_signal_handler_disconnect(self->keymap, self->keymap_keys_changed_cb_id);
730  self->keymap_keys_changed_cb_id = 0;
731  }
732  g_clear_object(&self->mouse_cursor_plugin);
733  g_clear_object(&self->platform_plugin);
734  g_clear_object(&self->view_accessible);
735 
736  G_OBJECT_CLASS(fl_view_parent_class)->dispose(object);
737 }

References fl_engine_set_on_pre_engine_restart_handler(), and fl_engine_set_update_semantics_handler().

Referenced by fl_view_class_init().

◆ fl_view_get_engine()

G_MODULE_EXPORT FlEngine* fl_view_get_engine ( FlView *  view)

fl_view_get_engine: @view: an #FlView.

Gets the engine being rendered in the view.

Returns: an #FlEngine.

Definition at line 842 of file fl_view.cc.

842  {
843  g_return_val_if_fail(FL_IS_VIEW(self), nullptr);
844  return self->engine;
845 }

Referenced by fl_renderer_unblock_main_thread(), fl_renderer_wait_for_frame(), and TEST().

◆ fl_view_get_keyboard_state()

GHashTable* fl_view_get_keyboard_state ( FlView *  view)

fl_view_get_keyboard_state: @view: an #FlView.

Returns the keyboard pressed state. The hash table contains one entry per pressed keys, mapping from the logical key to the physical key.*

Definition at line 852 of file fl_view.cc.

852  {
853  g_return_val_if_fail(FL_IS_VIEW(self), nullptr);
854  return fl_keyboard_manager_get_pressed_state(self->keyboard_manager);
855 }

References fl_keyboard_manager_get_pressed_state().

Referenced by fl_view_keyboard_delegate_iface_init().

◆ fl_view_get_property()

static void fl_view_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 680 of file fl_view.cc.

683  {
684  FlView* self = FL_VIEW(object);
685 
686  switch (prop_id) {
687  case kPropFlutterProject:
688  g_value_set_object(value, self->project);
689  break;
690  default:
691  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
692  break;
693  }
694 }

References kPropFlutterProject, prop_id, pspec, and value.

Referenced by fl_view_class_init().

◆ fl_view_get_registrar_for_plugin()

static FlPluginRegistrar* fl_view_get_registrar_for_plugin ( FlPluginRegistry *  registry,
const gchar *  name 
)
static

Definition at line 279 of file fl_view.cc.

281  {
282  FlView* self = FL_VIEW(registry);
283 
284  return fl_plugin_registrar_new(self,
285  fl_engine_get_binary_messenger(self->engine),
286  fl_engine_get_texture_registrar(self->engine));
287 }

References fl_engine_get_binary_messenger(), fl_engine_get_texture_registrar(), and fl_plugin_registrar_new().

Referenced by fl_view_plugin_registry_iface_init().

◆ fl_view_init()

static void fl_view_init ( FlView *  self)
static

Definition at line 781 of file fl_view.cc.

781  {
782  gtk_widget_set_can_focus(GTK_WIDGET(self), TRUE);
783 
784  self->event_box = gtk_event_box_new();
785  gtk_widget_set_hexpand(self->event_box, TRUE);
786  gtk_widget_set_vexpand(self->event_box, TRUE);
787  gtk_container_add(GTK_CONTAINER(self), self->event_box);
788  gtk_widget_show(self->event_box);
789  gtk_widget_add_events(self->event_box,
790  GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK |
791  GDK_BUTTON_RELEASE_MASK | GDK_SCROLL_MASK |
792  GDK_SMOOTH_SCROLL_MASK);
793 
794  g_signal_connect_swapped(self->event_box, "button-press-event",
795  G_CALLBACK(button_press_event_cb), self);
796  g_signal_connect_swapped(self->event_box, "button-release-event",
797  G_CALLBACK(button_release_event_cb), self);
798  g_signal_connect_swapped(self->event_box, "scroll-event",
799  G_CALLBACK(scroll_event_cb), self);
800  g_signal_connect_swapped(self->event_box, "motion-notify-event",
801  G_CALLBACK(motion_notify_event_cb), self);
802  g_signal_connect_swapped(self->event_box, "enter-notify-event",
803  G_CALLBACK(enter_notify_event_cb), self);
804  g_signal_connect_swapped(self->event_box, "leave-notify-event",
805  G_CALLBACK(leave_notify_event_cb), self);
806  GtkGesture* zoom = gtk_gesture_zoom_new(self->event_box);
807  g_signal_connect_swapped(zoom, "begin", G_CALLBACK(gesture_zoom_begin_cb),
808  self);
809  g_signal_connect_swapped(zoom, "scale-changed",
810  G_CALLBACK(gesture_zoom_update_cb), self);
811  g_signal_connect_swapped(zoom, "end", G_CALLBACK(gesture_zoom_end_cb), self);
812  GtkGesture* rotate = gtk_gesture_rotate_new(self->event_box);
813  g_signal_connect_swapped(rotate, "begin",
814  G_CALLBACK(gesture_rotation_begin_cb), self);
815  g_signal_connect_swapped(rotate, "angle-changed",
816  G_CALLBACK(gesture_rotation_update_cb), self);
817  g_signal_connect_swapped(rotate, "end", G_CALLBACK(gesture_rotation_end_cb),
818  self);
819 
820  self->gl_area = GTK_GL_AREA(gtk_gl_area_new());
821  gtk_widget_show(GTK_WIDGET(self->gl_area));
822  gtk_container_add(GTK_CONTAINER(self->event_box), GTK_WIDGET(self->gl_area));
823 
824  g_signal_connect_swapped(self->gl_area, "create-context",
825  G_CALLBACK(create_context_cb), self);
826  g_signal_connect_swapped(self->gl_area, "realize", G_CALLBACK(realize_cb),
827  self);
828  g_signal_connect_swapped(self->gl_area, "render", G_CALLBACK(render_cb),
829  self);
830  g_signal_connect_swapped(self->gl_area, "unrealize", G_CALLBACK(unrealize_cb),
831  self);
832 
833  g_signal_connect_swapped(self, "size-allocate", G_CALLBACK(size_allocate_cb),
834  self);
835 }

References button_press_event_cb(), button_release_event_cb(), create_context_cb(), enter_notify_event_cb(), gesture_rotation_begin_cb(), gesture_rotation_end_cb(), gesture_rotation_update_cb(), gesture_zoom_begin_cb(), gesture_zoom_end_cb(), gesture_zoom_update_cb(), leave_notify_event_cb(), motion_notify_event_cb(), realize_cb(), render_cb(), scroll_event_cb(), size_allocate_cb(), TRUE, and unrealize_cb().

◆ fl_view_key_press_event()

static gboolean fl_view_key_press_event ( GtkWidget *  widget,
GdkEventKey *  event 
)
static

Definition at line 740 of file fl_view.cc.

740  {
741  FlView* self = FL_VIEW(widget);
742 
744  self->keyboard_manager, fl_key_event_new_from_gdk_event(gdk_event_copy(
745  reinterpret_cast<GdkEvent*>(event))));
746 }

References event, fl_key_event_new_from_gdk_event(), and fl_keyboard_manager_handle_event().

Referenced by fl_view_class_init().

◆ fl_view_key_release_event()

static gboolean fl_view_key_release_event ( GtkWidget *  widget,
GdkEventKey *  event 
)
static

Definition at line 749 of file fl_view.cc.

750  {
751  FlView* self = FL_VIEW(widget);
753  self->keyboard_manager, fl_key_event_new_from_gdk_event(gdk_event_copy(
754  reinterpret_cast<GdkEvent*>(event))));
755 }

References event, fl_key_event_new_from_gdk_event(), and fl_keyboard_manager_handle_event().

Referenced by fl_view_class_init().

◆ fl_view_keyboard_delegate_iface_init()

static void fl_view_keyboard_delegate_iface_init ( FlKeyboardViewDelegateInterface *  iface)
static

Definition at line 294 of file fl_view.cc.

295  {
296  iface->send_key_event =
297  [](FlKeyboardViewDelegate* view_delegate, const FlutterKeyEvent* event,
298  FlutterKeyEventCallback callback, void* user_data) {
299  FlView* self = FL_VIEW(view_delegate);
300  if (self->engine != nullptr) {
302  };
303  };
304 
305  iface->text_filter_key_press = [](FlKeyboardViewDelegate* view_delegate,
306  FlKeyEvent* event) {
307  FlView* self = FL_VIEW(view_delegate);
308  return fl_text_input_plugin_filter_keypress(self->text_input_plugin, event);
309  };
310 
311  iface->get_messenger = [](FlKeyboardViewDelegate* view_delegate) {
312  FlView* self = FL_VIEW(view_delegate);
313  return fl_engine_get_binary_messenger(self->engine);
314  };
315 
316  iface->redispatch_event = [](FlKeyboardViewDelegate* view_delegate,
317  std::unique_ptr<FlKeyEvent> in_event) {
318  FlKeyEvent* event = in_event.release();
319  GdkEventType event_type = gdk_event_get_event_type(event->origin);
320  g_return_if_fail(event_type == GDK_KEY_PRESS ||
321  event_type == GDK_KEY_RELEASE);
322  gdk_event_put(event->origin);
324  };
325 
326  iface->subscribe_to_layout_change = [](FlKeyboardViewDelegate* view_delegate,
327  KeyboardLayoutNotifier notifier) {
328  FlView* self = FL_VIEW(view_delegate);
329  self->keyboard_layout_notifier = std::move(notifier);
330  };
331 
332  iface->lookup_key = [](FlKeyboardViewDelegate* view_delegate,
333  const GdkKeymapKey* key) -> guint {
334  FlView* self = FL_VIEW(view_delegate);
335  g_return_val_if_fail(self->keymap != nullptr, 0);
336  return gdk_keymap_lookup_key(self->keymap, key);
337  };
338 
339  iface->get_keyboard_state =
340  [](FlKeyboardViewDelegate* view_delegate) -> GHashTable* {
341  FlView* self = FL_VIEW(view_delegate);
342  return fl_view_get_keyboard_state(self);
343  };
344 }

References callback, event, fl_engine_get_binary_messenger(), fl_engine_send_key_event(), fl_key_event_dispose(), fl_text_input_plugin_filter_keypress(), fl_view_get_keyboard_state(), _FlKeyEvent::origin, and user_data.

◆ fl_view_new()

G_MODULE_EXPORT FlView* fl_view_new ( FlDartProject *  project)

FlView:

#FlView is a GTK widget that is capable of displaying a Flutter application.

The following example shows how to set up a view in a GTK application: |[ FlDartProject *project = fl_dart_project_new (); FlView *view = fl_view_new (project); gtk_widget_show (GTK_WIDGET (view)); gtk_container_add (GTK_CONTAINER (parent), view);

FlBinaryMessenger *messenger = fl_engine_get_binary_messenger (fl_view_get_engine (view)); setup_channels_or_plugins (messenger); ]| fl_view_new: @project: The project to show.

Creates a widget to show Flutter application.

Returns: a new #FlView.

Definition at line 837 of file fl_view.cc.

837  {
838  return static_cast<FlView*>(
839  g_object_new(fl_view_get_type(), "flutter-project", project, nullptr));
840 }

Referenced by TEST().

◆ fl_view_notify()

static void fl_view_notify ( GObject *  object,
GParamSpec *  pspec 
)
static

Definition at line 696 of file fl_view.cc.

696  {
697  FlView* self = FL_VIEW(object);
698 
699  if (strcmp(pspec->name, "scale-factor") == 0) {
701  }
702 
703  if (G_OBJECT_CLASS(fl_view_parent_class)->notify != nullptr) {
704  G_OBJECT_CLASS(fl_view_parent_class)->notify(object, pspec);
705  }
706 }

References handle_geometry_changed(), and pspec.

Referenced by fl_view_class_init().

◆ fl_view_plugin_registry_iface_init()

static void fl_view_plugin_registry_iface_init ( FlPluginRegistryInterface *  iface)
static

Definition at line 289 of file fl_view.cc.

290  {
291  iface->get_registrar_for_plugin = fl_view_get_registrar_for_plugin;
292 }

References fl_view_get_registrar_for_plugin().

◆ fl_view_redraw()

void fl_view_redraw ( FlView *  view)

fl_view_redraw: @view: an #FlView.

Indicate the view needs to redraw.

Definition at line 847 of file fl_view.cc.

847  {
848  g_return_if_fail(FL_IS_VIEW(self));
849  gtk_widget_queue_draw(GTK_WIDGET(self->gl_area));
850 }

Referenced by fl_renderer_present_layers().

◆ fl_view_scrolling_delegate_iface_init()

static void fl_view_scrolling_delegate_iface_init ( FlScrollingViewDelegateInterface *  iface)
static

Definition at line 346 of file fl_view.cc.

347  {
348  iface->send_mouse_pointer_event =
349  [](FlScrollingViewDelegate* view_delegate, FlutterPointerPhase phase,
350  size_t timestamp, double x, double y,
351  FlutterPointerDeviceKind device_kind, double scroll_delta_x,
352  double scroll_delta_y, int64_t buttons) {
353  FlView* self = FL_VIEW(view_delegate);
354  if (self->engine != nullptr) {
355  fl_engine_send_mouse_pointer_event(self->engine, phase, timestamp, x,
356  y, device_kind, scroll_delta_x,
357  scroll_delta_y, buttons);
358  }
359  };
360  iface->send_pointer_pan_zoom_event =
361  [](FlScrollingViewDelegate* view_delegate, size_t timestamp, double x,
362  double y, FlutterPointerPhase phase, double pan_x, double pan_y,
363  double scale, double rotation) {
364  FlView* self = FL_VIEW(view_delegate);
365  if (self->engine != nullptr) {
366  fl_engine_send_pointer_pan_zoom_event(self->engine, timestamp, x, y,
367  phase, pan_x, pan_y, scale,
368  rotation);
369  };
370  };
371 }

References fl_engine_send_mouse_pointer_event(), and fl_engine_send_pointer_pan_zoom_event().

◆ fl_view_set_property()

static void fl_view_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 663 of file fl_view.cc.

666  {
667  FlView* self = FL_VIEW(object);
668 
669  switch (prop_id) {
670  case kPropFlutterProject:
671  g_set_object(&self->project,
672  static_cast<FlDartProject*>(g_value_get_object(value)));
673  break;
674  default:
675  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
676  break;
677  }
678 }

References kPropFlutterProject, prop_id, pspec, and value.

Referenced by fl_view_class_init().

◆ fl_view_text_input_delegate_iface_init()

static void fl_view_text_input_delegate_iface_init ( FlTextInputViewDelegateInterface *  iface)
static

Definition at line 373 of file fl_view.cc.

374  {
375  iface->translate_coordinates = [](FlTextInputViewDelegate* delegate,
376  gint view_x, gint view_y, gint* window_x,
377  gint* window_y) {
378  FlView* self = FL_VIEW(delegate);
379  gtk_widget_translate_coordinates(GTK_WIDGET(self),
380  gtk_widget_get_toplevel(GTK_WIDGET(self)),
381  view_x, view_y, window_x, window_y);
382  };
383 }

◆ 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  
)

Definition at line 91 of file fl_view.cc.

105  {
106  fl_platform_plugin_request_app_exit(self->platform_plugin);
107  // Stop the event from propagating.
108  return TRUE;
109 }

References fl_platform_plugin_request_app_exit(), and TRUE.

◆ gesture_rotation_begin_cb()

static void gesture_rotation_begin_cb ( FlView *  self)
static

Definition at line 504 of file fl_view.cc.

504  {
505  fl_scrolling_manager_handle_rotation_begin(self->scrolling_manager);
506 }

References fl_scrolling_manager_handle_rotation_begin().

Referenced by fl_view_init().

◆ gesture_rotation_end_cb()

static void gesture_rotation_end_cb ( FlView *  self)
static

Definition at line 515 of file fl_view.cc.

515  {
516  fl_scrolling_manager_handle_rotation_end(self->scrolling_manager);
517 }

References fl_scrolling_manager_handle_rotation_end().

Referenced by fl_view_init().

◆ gesture_rotation_update_cb()

static void gesture_rotation_update_cb ( FlView *  self,
gdouble  rotation,
gdouble  delta 
)
static

Definition at line 508 of file fl_view.cc.

510  {
511  fl_scrolling_manager_handle_rotation_update(self->scrolling_manager,
512  rotation);
513 }

References fl_scrolling_manager_handle_rotation_update().

Referenced by fl_view_init().

◆ gesture_zoom_begin_cb()

static void gesture_zoom_begin_cb ( FlView *  self)
static

Definition at line 519 of file fl_view.cc.

519  {
520  fl_scrolling_manager_handle_zoom_begin(self->scrolling_manager);
521 }

References fl_scrolling_manager_handle_zoom_begin().

Referenced by fl_view_init().

◆ gesture_zoom_end_cb()

static void gesture_zoom_end_cb ( FlView *  self)
static

Definition at line 527 of file fl_view.cc.

527  {
528  fl_scrolling_manager_handle_zoom_end(self->scrolling_manager);
529 }

References fl_scrolling_manager_handle_zoom_end().

Referenced by fl_view_init().

◆ gesture_zoom_update_cb()

static void gesture_zoom_update_cb ( FlView *  self,
gdouble  scale 
)
static

Definition at line 523 of file fl_view.cc.

523  {
524  fl_scrolling_manager_handle_zoom_update(self->scrolling_manager, scale);
525 }

References fl_scrolling_manager_handle_zoom_update().

Referenced by fl_view_init().

◆ get_device_kind()

static FlutterPointerDeviceKind get_device_kind ( GdkEvent *  event)
static

Definition at line 135 of file fl_view.cc.

135  {
136  GdkDevice* device = gdk_event_get_source_device(event);
137  GdkInputSource source = gdk_device_get_source(device);
138  switch (source) {
139  case GDK_SOURCE_PEN:
140  case GDK_SOURCE_ERASER:
141  case GDK_SOURCE_CURSOR:
142  case GDK_SOURCE_TABLET_PAD:
143  return kFlutterPointerDeviceKindStylus;
144  case GDK_SOURCE_TOUCHSCREEN:
145  return kFlutterPointerDeviceKindTouch;
146  case GDK_SOURCE_TOUCHPAD: // trackpad device type is reserved for gestures
147  case GDK_SOURCE_TRACKPOINT:
148  case GDK_SOURCE_KEYBOARD:
149  case GDK_SOURCE_MOUSE:
150  return kFlutterPointerDeviceKindMouse;
151  }
152 }

References event.

Referenced by check_pointer_inside(), leave_notify_event_cb(), motion_notify_event_cb(), and send_pointer_button_event().

◆ handle_geometry_changed()

static void handle_geometry_changed ( FlView *  self)
static

Definition at line 235 of file fl_view.cc.

235  {
236  GtkAllocation allocation;
237  gtk_widget_get_allocation(GTK_WIDGET(self), &allocation);
238  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
240  self->engine, allocation.width * scale_factor,
241  allocation.height * scale_factor, scale_factor);
242 
243  // Make sure the view has been realized and its size has been allocated before
244  // waiting for a frame. `fl_view_realize()` and `fl_view_size_allocate()` may
245  // be called in either order depending on the order in which the window is
246  // shown and the view is added to a container in the app runner.
247  //
248  // Note: `gtk_widget_init()` initializes the size allocation to 1x1.
249  if (allocation.width > 1 && allocation.height > 1 &&
250  gtk_widget_get_realized(GTK_WIDGET(self))) {
251  fl_renderer_wait_for_frame(FL_RENDERER(self->renderer),
252  allocation.width * scale_factor,
253  allocation.height * scale_factor);
254  }
255 }

References fl_engine_send_window_metrics_event(), and fl_renderer_wait_for_frame().

Referenced by fl_view_notify(), realize_cb(), and size_allocate_cb().

◆ init_keyboard()

static void init_keyboard ( FlView *  self)
static

Definition at line 112 of file fl_view.cc.

112  {
113  FlBinaryMessenger* messenger = fl_engine_get_binary_messenger(self->engine);
114 
115  GdkWindow* window =
116  gtk_widget_get_window(gtk_widget_get_toplevel(GTK_WIDGET(self)));
117  g_return_if_fail(GDK_IS_WINDOW(window));
118  g_autoptr(GtkIMContext) im_context = gtk_im_multicontext_new();
119  gtk_im_context_set_client_window(im_context, window);
120 
121  g_clear_object(&self->text_input_plugin);
122  self->text_input_plugin = fl_text_input_plugin_new(
123  messenger, im_context, FL_TEXT_INPUT_VIEW_DELEGATE(self));
124  g_clear_object(&self->keyboard_manager);
125  self->keyboard_manager =
126  fl_keyboard_manager_new(messenger, FL_KEYBOARD_VIEW_DELEGATE(self));
127 }

References fl_engine_get_binary_messenger(), fl_keyboard_manager_new(), and fl_text_input_plugin_new().

Referenced by on_pre_engine_restart_cb(), and realize_cb().

◆ init_scrolling()

static void init_scrolling ( FlView *  self)
static

Definition at line 129 of file fl_view.cc.

129  {
130  g_clear_object(&self->scrolling_manager);
131  self->scrolling_manager =
132  fl_scrolling_manager_new(FL_SCROLLING_VIEW_DELEGATE(self));
133 }

References fl_scrolling_manager_new().

Referenced by create_context_cb(), and on_pre_engine_restart_cb().

◆ keymap_keys_changed_cb()

static void keymap_keys_changed_cb ( FlView *  self)
static

Definition at line 496 of file fl_view.cc.

496  {
497  if (self->keyboard_layout_notifier == nullptr) {
498  return;
499  }
500 
501  self->keyboard_layout_notifier();
502 }

Referenced by create_context_cb().

◆ leave_notify_event_cb()

static gboolean leave_notify_event_cb ( FlView *  self,
GdkEventCrossing *  crossing_event 
)
static

Definition at line 465 of file fl_view.cc.

466  {
467  GdkEvent* event = reinterpret_cast<GdkEvent*>(crossing_event);
468 
469  guint event_time = gdk_event_get_time(event);
470  gdouble event_x = 0.0, event_y = 0.0;
471  gdk_event_get_coords(event, &event_x, &event_y);
472 
473  if (crossing_event->mode != GDK_CROSSING_NORMAL) {
474  return FALSE;
475  }
476 
477  if (self->engine == nullptr) {
478  return FALSE;
479  }
480 
481  // Don't remove pointer while button is down; In case of dragging outside of
482  // window with mouse grab active Gtk will send another leave notify on
483  // release.
484  if (self->pointer_inside && self->button_state == 0) {
485  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
487  self->engine, kRemove, event_time * kMicrosecondsPerMillisecond,
488  event_x * scale_factor, event_y * scale_factor,
489  get_device_kind((GdkEvent*)event), 0, 0, self->button_state);
490  self->pointer_inside = FALSE;
491  }
492 
493  return TRUE;
494 }

References event, fl_engine_send_mouse_pointer_event(), get_device_kind(), kMicrosecondsPerMillisecond, and TRUE.

Referenced by fl_view_init().

◆ motion_notify_event_cb()

static gboolean motion_notify_event_cb ( FlView *  self,
GdkEventMotion *  motion_event 
)
static

Definition at line 421 of file fl_view.cc.

422  {
423  GdkEvent* event = reinterpret_cast<GdkEvent*>(motion_event);
424 
425  if (self->engine == nullptr) {
426  return FALSE;
427  }
428 
429  guint event_time = gdk_event_get_time(event);
430  GdkModifierType event_state = static_cast<GdkModifierType>(0);
431  gdk_event_get_state(event, &event_state);
432  gdouble event_x = 0.0, event_y = 0.0;
433  gdk_event_get_coords(event, &event_x, &event_y);
434 
436 
437  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
438 
439  fl_keyboard_manager_sync_modifier_if_needed(self->keyboard_manager,
440  event_state, event_time);
442  self->engine, self->button_state != 0 ? kMove : kHover,
443  event_time * kMicrosecondsPerMillisecond, event_x * scale_factor,
444  event_y * scale_factor, get_device_kind((GdkEvent*)event), 0, 0,
445  self->button_state);
446 
447  return TRUE;
448 }

References check_pointer_inside(), event, fl_engine_send_mouse_pointer_event(), fl_keyboard_manager_sync_modifier_if_needed(), get_device_kind(), kMicrosecondsPerMillisecond, and TRUE.

Referenced by fl_view_init().

◆ on_pre_engine_restart_cb()

static void on_pre_engine_restart_cb ( FlEngine *  engine,
gpointer  user_data 
)
static

Definition at line 271 of file fl_view.cc.

271  {
272  FlView* self = FL_VIEW(user_data);
273 
274  init_keyboard(self);
275  init_scrolling(self);
276 }

References init_keyboard(), init_scrolling(), and user_data.

Referenced by fl_view_constructed().

◆ realize_cb()

static void realize_cb ( FlView *  self)
static

Definition at line 577 of file fl_view.cc.

577  {
578  g_autoptr(GError) error = nullptr;
579 
580  fl_renderer_make_current(FL_RENDERER(self->renderer));
581 
582  GError* gl_error = gtk_gl_area_get_error(self->gl_area);
583  if (gl_error != NULL) {
584  g_warning("Failed to initialize GLArea: %s", gl_error->message);
585  return;
586  }
587 
588  fl_renderer_setup(FL_RENDERER(self->renderer));
589 
590  // Handle requests by the user to close the application.
591  GtkWidget* toplevel_window = gtk_widget_get_toplevel(GTK_WIDGET(self));
592 
593  // Listen to window state changes.
594  self->window_state_cb_id =
595  g_signal_connect_swapped(toplevel_window, "window-state-event",
596  G_CALLBACK(window_state_event_cb), self);
597  self->window_state =
598  gdk_window_get_state(gtk_widget_get_window(toplevel_window));
599 
600  g_signal_connect_swapped(toplevel_window, "delete-event",
601  G_CALLBACK(window_delete_event_cb), self);
602 
603  init_keyboard(self);
604 
605  fl_renderer_start(FL_RENDERER(FL_RENDERER(self->renderer)), self);
606 
607  if (!fl_engine_start(self->engine, &error)) {
608  g_warning("Failed to start Flutter engine: %s", error->message);
609  return;
610  }
611 
613 
614  self->view_accessible = fl_view_accessible_new(self->engine);
616  FL_SOCKET_ACCESSIBLE(gtk_widget_get_accessible(GTK_WIDGET(self))),
617  atk_plug_get_id(ATK_PLUG(self->view_accessible)));
618 }

References error, fl_engine_start(), fl_renderer_make_current(), fl_renderer_setup(), fl_renderer_start(), fl_socket_accessible_embed(), fl_view_accessible_new(), handle_geometry_changed(), init_keyboard(), and window_state_event_cb().

Referenced by fl_view_init().

◆ render_cb()

static gboolean render_cb ( FlView *  self,
GdkGLContext *  context 
)
static

Definition at line 620 of file fl_view.cc.

620  {
621  if (gtk_gl_area_get_error(self->gl_area) != NULL) {
622  return FALSE;
623  }
624 
625  int width = gtk_widget_get_allocated_width(GTK_WIDGET(self->gl_area));
626  int height = gtk_widget_get_allocated_height(GTK_WIDGET(self->gl_area));
627  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self->gl_area));
628  fl_renderer_render(FL_RENDERER(self->renderer), width * scale_factor,
629  height * scale_factor);
630 
631  return TRUE;
632 }

References fl_renderer_render(), height, TRUE, and width.

Referenced by fl_view_init().

◆ scroll_event_cb()

static gboolean scroll_event_cb ( FlView *  self,
GdkEventScroll *  event 
)
static

Definition at line 410 of file fl_view.cc.

410  {
411  // TODO(robert-ancell): Update to use GtkEventControllerScroll when we can
412  // depend on GTK 3.24.
413 
415  self->scrolling_manager, event,
416  gtk_widget_get_scale_factor(GTK_WIDGET(self)));
417  return TRUE;
418 }

References event, fl_scrolling_manager_handle_scroll_event(), and TRUE.

Referenced by fl_view_init().

◆ send_pointer_button_event()

static gboolean send_pointer_button_event ( FlView *  self,
GdkEvent *  event 
)
static

Definition at line 155 of file fl_view.cc.

155  {
156  guint event_time = gdk_event_get_time(event);
157  GdkEventType event_type = gdk_event_get_event_type(event);
158  GdkModifierType event_state = static_cast<GdkModifierType>(0);
159  gdk_event_get_state(event, &event_state);
160  guint event_button = 0;
161  gdk_event_get_button(event, &event_button);
162  gdouble event_x = 0.0, event_y = 0.0;
163  gdk_event_get_coords(event, &event_x, &event_y);
164 
165  int64_t button;
166  switch (event_button) {
167  case 1:
168  button = kFlutterPointerButtonMousePrimary;
169  break;
170  case 2:
171  button = kFlutterPointerButtonMouseMiddle;
172  break;
173  case 3:
174  button = kFlutterPointerButtonMouseSecondary;
175  break;
176  default:
177  return FALSE;
178  }
179  int old_button_state = self->button_state;
180  FlutterPointerPhase phase = kMove;
181  if (event_type == GDK_BUTTON_PRESS) {
182  // Drop the event if Flutter already thinks the button is down.
183  if ((self->button_state & button) != 0) {
184  return FALSE;
185  }
186  self->button_state ^= button;
187 
188  phase = old_button_state == 0 ? kDown : kMove;
189  } else if (event_type == GDK_BUTTON_RELEASE) {
190  // Drop the event if Flutter already thinks the button is up.
191  if ((self->button_state & button) == 0) {
192  return FALSE;
193  }
194  self->button_state ^= button;
195 
196  phase = self->button_state == 0 ? kUp : kMove;
197  }
198 
199  if (self->engine == nullptr) {
200  return FALSE;
201  }
202 
203  gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(self));
205  self->scrolling_manager, event_x * scale_factor, event_y * scale_factor);
206  fl_keyboard_manager_sync_modifier_if_needed(self->keyboard_manager,
207  event_state, event_time);
209  self->engine, phase, event_time * kMicrosecondsPerMillisecond,
210  event_x * scale_factor, event_y * scale_factor,
211  get_device_kind((GdkEvent*)event), 0, 0, self->button_state);
212 
213  return TRUE;
214 }

References event, fl_engine_send_mouse_pointer_event(), fl_keyboard_manager_sync_modifier_if_needed(), fl_scrolling_manager_set_last_mouse_position(), get_device_kind(), kMicrosecondsPerMillisecond, and TRUE.

Referenced by button_press_event_cb(), and button_release_event_cb().

◆ size_allocate_cb()

static void size_allocate_cb ( FlView *  self)
static

Definition at line 648 of file fl_view.cc.

648  {
650 }

References handle_geometry_changed().

Referenced by fl_view_init().

◆ unrealize_cb()

static void unrealize_cb ( FlView *  self)
static

Definition at line 634 of file fl_view.cc.

634  {
635  g_autoptr(GError) error = nullptr;
636 
637  fl_renderer_make_current(FL_RENDERER(self->renderer));
638 
639  GError* gl_error = gtk_gl_area_get_error(self->gl_area);
640  if (gl_error != NULL) {
641  g_warning("Failed to uninitialize GLArea: %s", gl_error->message);
642  return;
643  }
644 
645  fl_renderer_cleanup(FL_RENDERER(self->renderer));
646 }

References error, fl_renderer_cleanup(), and fl_renderer_make_current().

Referenced by fl_view_init().

◆ update_semantics_cb()

static void update_semantics_cb ( FlEngine *  engine,
const FlutterSemanticsUpdate2 *  update,
gpointer  user_data 
)
static

Definition at line 258 of file fl_view.cc.

260  {
261  FlView* self = FL_VIEW(user_data);
262 
263  fl_view_accessible_handle_update_semantics(self->view_accessible, update);
264 }

References fl_view_accessible_handle_update_semantics(), and user_data.

Referenced by fl_view_constructed().

◆ window_state_event_cb()

static gboolean window_state_event_cb ( FlView *  self,
GdkEvent *  event 
)
static

Definition at line 531 of file fl_view.cc.

531  {
532  g_return_val_if_fail(FL_IS_ENGINE(self->engine), FALSE);
533 
534  GdkWindowState state = event->window_state.new_window_state;
535  GdkWindowState previous_state = self->window_state;
536  self->window_state = state;
537  bool was_visible = !((previous_state & GDK_WINDOW_STATE_WITHDRAWN) ||
538  (previous_state & GDK_WINDOW_STATE_ICONIFIED));
539  bool is_visible = !((state & GDK_WINDOW_STATE_WITHDRAWN) ||
540  (state & GDK_WINDOW_STATE_ICONIFIED));
541  bool was_focused = (previous_state & GDK_WINDOW_STATE_FOCUSED);
542  bool is_focused = (state & GDK_WINDOW_STATE_FOCUSED);
543  if (was_visible != is_visible || was_focused != is_focused) {
544  if (self->engine != nullptr) {
545  fl_engine_send_window_state_event(FL_ENGINE(self->engine), is_visible,
546  is_focused);
547  }
548  }
549  return FALSE;
550 }

References fl_engine_send_window_state_event(), and state.

Referenced by realize_cb().

Variable Documentation

◆ kMicrosecondsPerMillisecond

constexpr int kMicrosecondsPerMillisecond = 1000
staticconstexpr
prop_id
guint prop_id
Definition: fl_standard_method_codec.cc:31
gesture_rotation_update_cb
static void gesture_rotation_update_cb(FlView *self, gdouble rotation, gdouble delta)
Definition: fl_view.cc:508
fl_renderer_wait_for_frame
void fl_renderer_wait_for_frame(FlRenderer *self, int target_width, int target_height)
Definition: fl_renderer.cc:211
fl_renderer_gdk_set_window
void fl_renderer_gdk_set_window(FlRendererGdk *self, GdkWindow *window)
Definition: fl_renderer_gdk.cc:88
fl_view_get_property
static void fl_view_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
Definition: fl_view.cc:680
enter_notify_event_cb
static gboolean enter_notify_event_cb(FlView *self, GdkEventCrossing *crossing_event)
Definition: fl_view.cc:451
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
leave_notify_event_cb
static gboolean leave_notify_event_cb(FlView *self, GdkEventCrossing *crossing_event)
Definition: fl_view.cc:465
fl_scrolling_manager_handle_zoom_end
void fl_scrolling_manager_handle_zoom_end(FlScrollingManager *self)
Definition: fl_scrolling_manager.cc:208
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:863
fl_key_event_new_from_gdk_event
FlKeyEvent * fl_key_event_new_from_gdk_event(GdkEvent *event)
Definition: fl_key_event.cc:7
kMicrosecondsPerMillisecond
static constexpr int kMicrosecondsPerMillisecond
Definition: fl_view.cc:33
fl_scrolling_manager_handle_scroll_event
void fl_scrolling_manager_handle_scroll_event(FlScrollingManager *self, GdkEventScroll *scroll_event, gint scale_factor)
Definition: fl_scrolling_manager.cc:74
fl_view_accessible_handle_update_semantics
void fl_view_accessible_handle_update_semantics(FlViewAccessible *self, const FlutterSemanticsUpdate2 *update)
Definition: fl_view_accessible.cc:142
fl_text_input_plugin_filter_keypress
gboolean fl_text_input_plugin_filter_keypress(FlTextInputPlugin *self, FlKeyEvent *event)
Definition: fl_text_input_plugin.cc:776
init_scrolling
static void init_scrolling(FlView *self)
Definition: fl_view.cc:129
fl_renderer_gdk_get_context
GdkGLContext * fl_renderer_gdk_get_context(FlRendererGdk *self)
Definition: fl_renderer_gdk.cc:125
create_context_cb
static GdkGLContext * create_context_cb(FlView *self)
Definition: fl_view.cc:552
get_device_kind
static FlutterPointerDeviceKind get_device_kind(GdkEvent *event)
Definition: fl_view.cc:135
fl_view_get_registrar_for_plugin
static FlPluginRegistrar * fl_view_get_registrar_for_plugin(FlPluginRegistry *registry, const gchar *name)
Definition: fl_view.cc:279
kPropLast
@ kPropLast
Definition: fl_view.cc:77
size_allocate_cb
static void size_allocate_cb(FlView *self)
Definition: fl_view.cc:648
unrealize_cb
static void unrealize_cb(FlView *self)
Definition: fl_view.cc:634
fl_platform_plugin_request_app_exit
void fl_platform_plugin_request_app_exit(FlPlatformPlugin *self)
Definition: fl_platform_plugin.cc:418
fl_platform_plugin_new
FlPlatformPlugin * fl_platform_plugin_new(FlBinaryMessenger *messenger)
Definition: fl_platform_plugin.cc:402
user_data
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
Definition: fl_key_channel_responder.cc:121
keymap_keys_changed_cb
static void keymap_keys_changed_cb(FlView *self)
Definition: fl_view.cc:496
pspec
guint const GValue GParamSpec * pspec
Definition: fl_standard_method_codec.cc:33
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:771
realize_cb
static void realize_cb(FlView *self)
Definition: fl_view.cc:577
_FlKeyEvent::origin
GdkEvent * origin
Definition: fl_key_event.h:36
fl_view_set_property
static void fl_view_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
Definition: fl_view.cc:663
height
G_BEGIN_DECLS int height
Definition: fl_backing_store_provider.h:37
scroll_event_cb
static gboolean scroll_event_cb(FlView *self, GdkEventScroll *event)
Definition: fl_view.cc:410
fl_engine_get_binary_messenger
G_MODULE_EXPORT FlBinaryMessenger * fl_engine_get_binary_messenger(FlEngine *self)
Definition: fl_engine.cc:918
_FlKeyEvent
Definition: fl_key_event.h:22
state
AtkStateType state
Definition: fl_accessible_node.cc:10
update_semantics_cb
static void update_semantics_cb(FlEngine *engine, const FlutterSemanticsUpdate2 *update, gpointer user_data)
Definition: fl_view.cc:258
window_state_event_cb
static gboolean window_state_event_cb(FlView *self, GdkEvent *event)
Definition: fl_view.cc:531
fl_keyboard_manager_handle_event
gboolean fl_keyboard_manager_handle_event(FlKeyboardManager *self, FlKeyEvent *event)
Definition: fl_keyboard_manager.cc:638
render_cb
static gboolean render_cb(FlView *self, GdkGLContext *context)
Definition: fl_view.cc:620
fl_renderer_start
gboolean fl_renderer_start(FlRenderer *self, FlView *view)
Definition: fl_renderer.cc:129
gesture_zoom_end_cb
static void gesture_zoom_end_cb(FlView *self)
Definition: fl_view.cc:527
button_release_event_cb
static gboolean button_release_event_cb(FlView *self, GdkEventButton *button_event)
Definition: fl_view.cc:403
KeyboardLayoutNotifier
std::function< void()> KeyboardLayoutNotifier
Definition: fl_keyboard_view_delegate.h:17
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:829
fl_scrolling_manager_new
FlScrollingManager * fl_scrolling_manager_new(FlScrollingViewDelegate *view_delegate)
Definition: fl_scrolling_manager.cc:47
fl_view_key_press_event
static gboolean fl_view_key_press_event(GtkWidget *widget, GdkEventKey *event)
Definition: fl_view.cc:740
fl_engine_new
FlEngine * fl_engine_new(FlDartProject *project, FlRenderer *renderer)
Definition: fl_engine.cc:458
fl_view_key_release_event
static gboolean fl_view_key_release_event(GtkWidget *widget, GdkEventKey *event)
Definition: fl_view.cc:749
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:66
fl_view_dispose
static void fl_view_dispose(GObject *object)
Definition: fl_view.cc:708
fl_renderer_gdk_create_contexts
gboolean fl_renderer_gdk_create_contexts(FlRendererGdk *self, GError **error)
Definition: fl_renderer_gdk.cc:95
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
fl_scrolling_manager_handle_zoom_update
void fl_scrolling_manager_handle_zoom_update(FlScrollingManager *self, gdouble scale)
Definition: fl_scrolling_manager.cc:198
check_pointer_inside
static void check_pointer_inside(FlView *self, GdkEvent *event)
Definition: fl_view.cc:217
fl_view_get_keyboard_state
GHashTable * fl_view_get_keyboard_state(FlView *self)
Definition: fl_view.cc:852
fl_scrolling_manager_handle_rotation_update
void fl_scrolling_manager_handle_rotation_update(FlScrollingManager *self, gdouble rotation)
Definition: fl_scrolling_manager.cc:164
gesture_rotation_begin_cb
static void gesture_rotation_begin_cb(FlView *self)
Definition: fl_view.cc:504
fl_socket_accessible_embed
void fl_socket_accessible_embed(FlSocketAccessible *self, gchar *id)
Definition: fl_socket_accessible.cc:55
kPropFlutterProject
@ kPropFlutterProject
Definition: fl_view.cc:77
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:32
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:675
on_pre_engine_restart_cb
static void on_pre_engine_restart_cb(FlEngine *engine, gpointer user_data)
Definition: fl_view.cc:271
fl_keyboard_manager_get_pressed_state
GHashTable * fl_keyboard_manager_get_pressed_state(FlKeyboardManager *self)
Definition: fl_keyboard_manager.cc:688
handle_geometry_changed
static void handle_geometry_changed(FlView *self)
Definition: fl_view.cc:235
fl_renderer_cleanup
void fl_renderer_cleanup(FlRenderer *self)
Definition: fl_renderer.cc:392
gesture_rotation_end_cb
static void gesture_rotation_end_cb(FlView *self)
Definition: fl_view.cc:515
gesture_zoom_update_cb
static void gesture_zoom_update_cb(FlView *self, gdouble scale)
Definition: fl_view.cc:523
send_pointer_button_event
static gboolean send_pointer_button_event(FlView *self, GdkEvent *event)
Definition: fl_view.cc:155
fl_view_constructed
static void fl_view_constructed(GObject *object)
Definition: fl_view.cc:652
gesture_zoom_begin_cb
static void gesture_zoom_begin_cb(FlView *self)
Definition: fl_view.cc:519
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
fl_renderer_make_current
void fl_renderer_make_current(FlRenderer *self)
Definition: fl_renderer.cc:145
fl_mouse_cursor_plugin_new
FlMouseCursorPlugin * fl_mouse_cursor_plugin_new(FlBinaryMessenger *messenger, FlView *view)
Definition: fl_mouse_cursor_plugin.cc:163
fl_engine_set_update_semantics_handler
void fl_engine_set_update_semantics_handler(FlEngine *self, FlEngineUpdateSemanticsHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_engine.cc:624
fl_engine_send_mouse_pointer_event
void fl_engine_send_mouse_pointer_event(FlEngine *self, 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:793
fl_view_notify
static void fl_view_notify(GObject *object, GParamSpec *pspec)
Definition: fl_view.cc:696
fl_scrolling_manager_handle_rotation_end
void fl_scrolling_manager_handle_rotation_end(FlScrollingManager *self)
Definition: fl_scrolling_manager.cc:174
fl_renderer_gdk_new
FlRendererGdk * fl_renderer_gdk_new()
Definition: fl_renderer_gdk.cc:82
fl_engine_start
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition: fl_engine.cc:474
fl_renderer_render
void fl_renderer_render(FlRenderer *self, int width, int height)
Definition: fl_renderer.cc:320
fl_scrolling_manager_handle_rotation_begin
void fl_scrolling_manager_handle_rotation_begin(FlScrollingManager *self)
Definition: fl_scrolling_manager.cc:151
fl_engine_send_window_state_event
void fl_engine_send_window_state_event(FlEngine *self, gboolean visible, gboolean focused)
Definition: fl_engine.cc:759
fl_plugin_registrar_new
FlPluginRegistrar * fl_plugin_registrar_new(FlView *view, FlBinaryMessenger *messenger, FlTextureRegistrar *texture_registrar)
Definition: fl_plugin_registrar.cc:87
callback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition: fl_key_channel_responder.cc:120
motion_notify_event_cb
static gboolean motion_notify_event_cb(FlView *self, GdkEventMotion *motion_event)
Definition: fl_view.cc:421
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
fl_scrolling_manager_handle_zoom_begin
void fl_scrolling_manager_handle_zoom_begin(FlScrollingManager *self)
Definition: fl_scrolling_manager.cc:185
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
fl_view_accessible_new
FlViewAccessible * fl_view_accessible_new(FlEngine *engine)
Definition: fl_view_accessible.cc:133
init_keyboard
static void init_keyboard(FlView *self)
Definition: fl_view.cc:112
fl_engine_get_texture_registrar
G_MODULE_EXPORT FlTextureRegistrar * fl_engine_get_texture_registrar(FlEngine *self)
Definition: fl_engine.cc:934
button_press_event_cb
static gboolean button_press_event_cb(FlView *self, GdkEventButton *button_event)
Definition: fl_view.cc:386
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:641
fl_renderer_setup
void fl_renderer_setup(FlRenderer *self)
Definition: fl_renderer.cc:278