8 #ifdef GDK_WINDOWING_X11
22 #define FL_APPLICATION_GET_PRIVATE(app) \
23 ((FlApplicationPrivate*)fl_application_get_instance_private( \
33 G_ADD_PRIVATE(FlApplication))
36 static GtkWindow* create_window_cb(FlApplication* self, FlView*
view) {
46 GtkWidget*
window = gtk_widget_get_toplevel(GTK_WIDGET(
view));
50 gtk_window_present(GTK_WINDOW(
window));
56 FlPluginRegistry* registry) {}
61 GtkApplicationWindow*
window =
62 GTK_APPLICATION_WINDOW(gtk_application_window_new(GTK_APPLICATION(
self)));
71 gboolean use_header_bar =
TRUE;
72 #ifdef GDK_WINDOWING_X11
73 GdkScreen* screen = gtk_window_get_screen(GTK_WINDOW(
window));
74 if (GDK_IS_X11_SCREEN(screen)) {
75 const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
76 if (g_strcmp0(wm_name,
"GNOME Shell") != 0) {
77 use_header_bar = FALSE;
82 GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
83 gtk_widget_show(GTK_WIDGET(header_bar));
84 gtk_header_bar_set_show_close_button(header_bar,
TRUE);
85 gtk_window_set_titlebar(GTK_WINDOW(
window), GTK_WIDGET(header_bar));
88 gtk_container_add(GTK_CONTAINER(
window), GTK_WIDGET(
view));
95 FlApplication*
self = FL_APPLICATION(application);
100 project,
priv->dart_entrypoint_arguments);
105 gtk_widget_show(GTK_WIDGET(
view));
107 FlWindowingHandler* windowing_handler =
109 g_signal_connect_swapped(windowing_handler,
"create_window",
110 G_CALLBACK(create_window_cb),
self);
118 gtk_widget_realize(GTK_WIDGET(
view));
121 FL_PLUGIN_REGISTRY(
view));
128 FlApplication*
self = FL_APPLICATION(application);
132 priv->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
134 g_autoptr(GError)
error =
nullptr;
135 if (!g_application_register(application,
nullptr, &
error)) {
136 g_warning(
"Failed to register: %s",
error->message);
143 g_application_activate(application);
151 FlApplication*
self = FL_APPLICATION(
object);
154 g_clear_pointer(&
priv->dart_entrypoint_arguments, g_strfreev);
156 G_OBJECT_CLASS(fl_application_parent_class)->dispose(
object);
161 G_APPLICATION_CLASS(klass)->local_command_line =
169 "register-plugins", fl_application_get_type(), G_SIGNAL_RUN_LAST,
170 G_STRUCT_OFFSET(FlApplicationClass, register_plugins),
nullptr,
nullptr,
171 nullptr, G_TYPE_NONE, 1, fl_plugin_registry_get_type());
173 "create-window", fl_application_get_type(), G_SIGNAL_RUN_LAST,
174 G_STRUCT_OFFSET(FlApplicationClass, create_window),
175 g_signal_accumulator_first_wins,
nullptr,
nullptr, GTK_TYPE_WINDOW, 1,
183 GApplicationFlags
flags) {
184 return FL_APPLICATION(g_object_new(fl_application_get_type(),
185 "application-id", application_id,
"flags",