Flutter Linux Embedder
fl_view_monitor.cc File Reference

Go to the source code of this file.

Classes

struct  _FlViewMonitor
 

Functions

static void first_frame_cb (FlViewMonitor *self)
 
static void fl_view_monitor_dispose (GObject *object)
 
static void fl_view_monitor_class_init (FlViewMonitorClass *klass)
 
static void fl_view_monitor_init (FlViewMonitor *self)
 
G_MODULE_EXPORT FlViewMonitor * fl_view_monitor_new (FlView *view, void(*on_first_frame)(void))
 

Function Documentation

◆ first_frame_cb()

static void first_frame_cb ( FlViewMonitor *  self)
static

Definition at line 25 of file fl_view_monitor.cc.

25  {
26  flutter::IsolateScope scope(self->isolate);
27  if (self->on_first_frame) {
28  self->on_first_frame();
29  }
30 }

Referenced by fl_application_activate(), and fl_view_monitor_new().

◆ fl_view_monitor_class_init()

static void fl_view_monitor_class_init ( FlViewMonitorClass *  klass)
static

Definition at line 43 of file fl_view_monitor.cc.

43  {
44  G_OBJECT_CLASS(klass)->dispose = fl_view_monitor_dispose;
45 }
static void fl_view_monitor_dispose(GObject *object)

References fl_view_monitor_dispose().

◆ fl_view_monitor_dispose()

static void fl_view_monitor_dispose ( GObject *  object)
static

Definition at line 32 of file fl_view_monitor.cc.

32  {
33  FlViewMonitor* self = FL_VIEW_MONITOR(object);
34 
35  // Disconnect all handlers using data. If we try and disconnect them
36  // individually they generate warnings after the widget has been destroyed.
37  g_signal_handlers_disconnect_by_data(self->view, self);
38  g_clear_object(&self->view);
39 
40  G_OBJECT_CLASS(fl_view_monitor_parent_class)->dispose(object);
41 }

Referenced by fl_view_monitor_class_init().

◆ fl_view_monitor_init()

static void fl_view_monitor_init ( FlViewMonitor *  self)
static

Definition at line 47 of file fl_view_monitor.cc.

47 {}

◆ fl_view_monitor_new()

G_MODULE_EXPORT FlViewMonitor* fl_view_monitor_new ( FlView *  view,
void(*)(void)  on_first_frame 
)

fl_view_monitor_new: @view: the view being monitored. @on_first_frame: the function to call when the first frame is rendered.

Helper class to allow the Flutter engine to monitor a FlView using FFI. Callbacks are called in the isolate this class was created with.

Returns: a new #FlViewMonitor.

Definition at line 49 of file fl_view_monitor.cc.

51  {
52  FlViewMonitor* self =
53  FL_VIEW_MONITOR(g_object_new(fl_view_monitor_get_type(), nullptr));
54 
55  self->view = FL_VIEW(g_object_ref(view));
56  self->isolate = flutter::Isolate::Current();
57  self->on_first_frame = on_first_frame;
58  g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb),
59  self);
60 
61  return self;
62 }
static Isolate Current()
Definition: isolate_scope.cc:9
FlView * view
static void first_frame_cb(FlViewMonitor *self)

References flutter::Isolate::Current(), first_frame_cb(), and view.