8 #ifdef GDK_WINDOWING_X11
21 #define FL_APPLICATION_GET_PRIVATE(app) \
22 ((FlApplicationPrivate*)fl_application_get_instance_private( \
32 G_ADD_PRIVATE(FlApplication))
36 GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(
view));
39 if (window !=
nullptr && GTK_IS_WINDOW(window)) {
40 gtk_window_present(GTK_WINDOW(window));
46 FlPluginRegistry* registry) {}
51 GtkApplicationWindow* window =
52 GTK_APPLICATION_WINDOW(gtk_application_window_new(GTK_APPLICATION(
self)));
61 gboolean use_header_bar =
TRUE;
62 #ifdef GDK_WINDOWING_X11
63 GdkScreen* screen = gtk_window_get_screen(GTK_WINDOW(window));
64 if (GDK_IS_X11_SCREEN(screen)) {
65 const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
66 if (g_strcmp0(wm_name,
"GNOME Shell") != 0) {
67 use_header_bar = FALSE;
72 GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
73 gtk_widget_show(GTK_WIDGET(header_bar));
74 gtk_header_bar_set_show_close_button(header_bar,
TRUE);
75 gtk_window_set_titlebar(GTK_WINDOW(window), GTK_WIDGET(header_bar));
78 gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(
view));
80 return GTK_WINDOW(window);
85 FlApplication*
self = FL_APPLICATION(application);
90 project,
priv->dart_entrypoint_arguments);
95 gtk_widget_show(GTK_WIDGET(
view));
103 gtk_widget_realize(GTK_WIDGET(
view));
106 FL_PLUGIN_REGISTRY(
view));
113 FlApplication*
self = FL_APPLICATION(application);
117 priv->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
119 g_autoptr(GError)
error =
nullptr;
120 if (!g_application_register(application,
nullptr, &
error)) {
121 g_warning(
"Failed to register: %s",
error->message);
128 g_application_activate(application);
136 FlApplication*
self = FL_APPLICATION(
object);
139 g_clear_pointer(&
priv->dart_entrypoint_arguments, g_strfreev);
141 G_OBJECT_CLASS(fl_application_parent_class)->dispose(
object);
146 G_APPLICATION_CLASS(klass)->local_command_line =
154 "register-plugins", fl_application_get_type(), G_SIGNAL_RUN_LAST,
155 G_STRUCT_OFFSET(FlApplicationClass, register_plugins),
nullptr,
nullptr,
156 nullptr, G_TYPE_NONE, 1, fl_plugin_registry_get_type());
158 "create-window", fl_application_get_type(), G_SIGNAL_RUN_LAST,
159 G_STRUCT_OFFSET(FlApplicationClass, create_window),
160 g_signal_accumulator_first_wins,
nullptr,
nullptr, GTK_TYPE_WINDOW, 1,
168 GApplicationFlags
flags) {
169 return FL_APPLICATION(g_object_new(fl_application_get_type(),
170 "application-id", application_id,
"flags",