Flutter Linux Embedder
fl_window_monitor.h File Reference
#include <gtk/gtk.h>

Go to the source code of this file.

Functions

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (FlWindowMonitor, fl_window_monitor, FL, WINDOW_MONITOR, GObject)
 
FlWindowMonitor * fl_window_monitor_new (GtkWindow *window, void(*on_configure)(void), void(*on_state_changed)(void), void(*on_is_active_notify)(void), void(*on_title_notify)(void), void(*on_moved_to_rect)(int, int, int, int), void(*on_close)(void), void(*on_destroy)(void))
 

Function Documentation

◆ fl_window_monitor_new()

FlWindowMonitor* fl_window_monitor_new ( GtkWindow *  window,
void(*)(void)  on_configure,
void(*)(void)  on_state_changed,
void(*)(void)  on_is_active_notify,
void(*)(void)  on_title_notify,
void(*)(int, int, int, int)  on_moved_to_rect,
void(*)(void)  on_close,
void(*)(void)  on_destroy 
)

fl_window_monitor_new: @window: the window being monitored. @on_configure: the function to call when the window changes size, position or stacking. @on_state_changed: the function to call when the window state changes. @on_is_active_notify: the function to call when the is-active property changes. @on_moved_to_rect: the function to call when a popup window is moved to a new position. @on_close: the function to call when the user requests the window to be closed. @on_destroy: the function to call when the window is destroyed.

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

Returns: a new #FlWindowMonitor.

Definition at line 94 of file fl_window_monitor.cc.

102  {
103  FlWindowMonitor* self =
104  FL_WINDOW_MONITOR(g_object_new(fl_window_monitor_get_type(), nullptr));
105 
106  self->window = GTK_WINDOW(g_object_ref(window));
107  self->isolate = flutter::Isolate::Current();
108  self->on_configure = on_configure;
109  self->on_state_changed = on_state_changed;
110  self->on_is_active_notify = on_is_active_notify;
111  self->on_title_notify = on_title_notify;
112  self->on_moved_to_rect = on_moved_to_rect;
113  self->on_close = on_close;
114  self->on_destroy = on_destroy;
115  g_signal_connect_object(window, "configure-event",
116  G_CALLBACK(configure_event_cb), self,
117  G_CONNECT_SWAPPED);
118  g_signal_connect_object(window, "window-state-event",
119  G_CALLBACK(window_state_event_cb), self,
120  G_CONNECT_SWAPPED);
121  g_signal_connect_object(window, "notify::is-active",
122  G_CALLBACK(is_active_notify_cb), self,
123  G_CONNECT_SWAPPED);
124  g_signal_connect_object(window, "notify::title", G_CALLBACK(title_notify_cb),
125  self, G_CONNECT_SWAPPED);
126  g_signal_connect_object(gtk_widget_get_window(GTK_WIDGET(window)),
127  "moved-to-rect", G_CALLBACK(moved_to_rect_cb), self,
128  G_CONNECT_SWAPPED);
129  g_signal_connect_object(window, "delete-event", G_CALLBACK(delete_event_cb),
130  self, G_CONNECT_SWAPPED);
131  g_signal_connect_object(window, "destroy", G_CALLBACK(destroy_cb), self,
132  G_CONNECT_SWAPPED);
133 
134  return self;
135 }
static Isolate Current()
Definition: isolate_scope.cc:9
static void destroy_cb(FlWindowMonitor *self)
static void is_active_notify_cb(FlWindowMonitor *self)
static void title_notify_cb(FlWindowMonitor *self)
static void moved_to_rect_cb(FlWindowMonitor *self, GdkRectangle *flipped_rect, GdkRectangle *final_rect, gboolean flipped_x, gboolean flipped_y)
static gboolean configure_event_cb(FlWindowMonitor *self, GdkEventConfigure *event)
static gboolean window_state_event_cb(FlWindowMonitor *self, GdkEventWindowState *event)
static gboolean delete_event_cb(FlWindowMonitor *self, GdkEvent *event)

References configure_event_cb(), flutter::Isolate::Current(), delete_event_cb(), destroy_cb(), is_active_notify_cb(), moved_to_rect_cb(), title_notify_cb(), and window_state_event_cb().

◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE ( FlWindowMonitor  ,
fl_window_monitor  ,
FL  ,
WINDOW_MONITOR  ,
GObject   
)