29 G_DEFINE_TYPE(FlWindowMonitor, fl_window_monitor, G_TYPE_OBJECT)
32 GdkEventConfigure* event) {
40 GdkEventWindowState* event) {
42 self->on_state_changed();
49 self->on_is_active_notify();
54 self->on_title_notify();
58 GdkRectangle* flipped_rect,
59 GdkRectangle* final_rect,
65 if (final_rect ==
nullptr) {
70 self->on_moved_to_rect(final_rect->x, final_rect->y, final_rect->width,
78 GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(self->window));
79 if (window ==
nullptr) {
82 g_signal_connect_object(window,
"moved-to-rect", G_CALLBACK(
moved_to_rect_cb),
83 self, G_CONNECT_SWAPPED);
100 FlWindowMonitor*
self = FL_WINDOW_MONITOR(
object);
102 g_clear_object(&self->window);
104 G_OBJECT_CLASS(fl_window_monitor_parent_class)->dispose(
object);
115 void (*on_configure)(
void),
116 void (*on_state_changed)(
void),
117 void (*on_is_active_notify)(
void),
118 void (*on_title_notify)(
void),
119 void (*on_moved_to_rect)(
int,
int,
int,
int),
120 void (*on_close)(
void),
121 void (*on_destroy)(
void)) {
122 FlWindowMonitor*
self =
123 FL_WINDOW_MONITOR(g_object_new(fl_window_monitor_get_type(),
nullptr));
125 self->window = GTK_WINDOW(g_object_ref(window));
129 if (Dart_CurrentIsolate() !=
nullptr) {
132 self->on_configure = on_configure;
133 self->on_state_changed = on_state_changed;
134 self->on_is_active_notify = on_is_active_notify;
135 self->on_title_notify = on_title_notify;
136 self->on_moved_to_rect = on_moved_to_rect;
137 self->on_close = on_close;
138 self->on_destroy = on_destroy;
139 g_signal_connect_object(window,
"configure-event",
142 g_signal_connect_object(window,
"window-state-event",
145 g_signal_connect_object(window,
"notify::is-active",
148 g_signal_connect_object(window,
"notify::title", G_CALLBACK(
title_notify_cb),
149 self, G_CONNECT_SWAPPED);
150 g_signal_connect_object(window,
"realize", G_CALLBACK(
realize_cb),
self,
152 if (gtk_widget_get_realized(GTK_WIDGET(window))) {
155 g_signal_connect_object(window,
"delete-event", G_CALLBACK(
delete_event_cb),
156 self, G_CONNECT_SWAPPED);
157 g_signal_connect_object(window,
"destroy", G_CALLBACK(
destroy_cb),
self,
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
static void destroy_cb(FlWindowMonitor *self)
static void is_active_notify_cb(FlWindowMonitor *self)
static void fl_window_monitor_dispose(GObject *object)
static void fl_window_monitor_class_init(FlWindowMonitorClass *klass)
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 void realize_cb(FlWindowMonitor *self)
static gboolean configure_event_cb(FlWindowMonitor *self, GdkEventConfigure *event)
static gboolean window_state_event_cb(FlWindowMonitor *self, GdkEventWindowState *event)
G_MODULE_EXPORT 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))
static void fl_window_monitor_init(FlWindowMonitor *self)
static gboolean delete_event_cb(FlWindowMonitor *self, GdkEvent *event)
void(* on_title_notify)(void)
void(* on_state_changed)(void)
void(* on_is_active_notify)(void)
void(* on_configure)(void)
void(* on_moved_to_rect)(int, int, int, int)