|
| 1 | +From 7a9e6dca964518c77feb3e9b1768fca5424dbc3b Mon Sep 17 00:00:00 2001 |
| 2 | +From: BIGGASSS <timcooksgrandpa@gmail.com> |
| 3 | +Date: Thu, 26 Mar 2026 03:29:55 +0800 |
| 4 | +Subject: [PATCH] fix(linux): silent launching not working |
| 5 | + |
| 6 | +--- |
| 7 | + linux/runner/my_application.cc | 11 ++--------- |
| 8 | + 1 file changed, 2 insertions(+), 9 deletions(-) |
| 9 | + |
| 10 | +diff --git a/linux/runner/my_application.cc b/linux/runner/my_application.cc |
| 11 | +index 9745df677..beffdbb37 100644 |
| 12 | +--- a/linux/runner/my_application.cc |
| 13 | ++++ b/linux/runner/my_application.cc |
| 14 | +@@ -14,12 +14,6 @@ struct _MyApplication { |
| 15 | + |
| 16 | + G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) |
| 17 | + |
| 18 | +-// Called when first Flutter frame received. |
| 19 | +-static void first_frame_cb(MyApplication* self, FlView *view) |
| 20 | +-{ |
| 21 | +- gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); |
| 22 | +-} |
| 23 | +- |
| 24 | + // Implements GApplication::activate. |
| 25 | + static void my_application_activate(GApplication* application) { |
| 26 | + MyApplication* self = MY_APPLICATION(application); |
| 27 | +@@ -66,9 +60,8 @@ static void my_application_activate(GApplication* application) { |
| 28 | + gtk_widget_show(GTK_WIDGET(view)); |
| 29 | + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); |
| 30 | + |
| 31 | +- // Show the window when Flutter renders. |
| 32 | +- // Requires the view to be realized so we can start rendering. |
| 33 | +- g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), self); |
| 34 | ++ // Realize the view so Flutter can render even if the window stays hidden |
| 35 | ++ // until Dart startup logic explicitly shows it. |
| 36 | + gtk_widget_realize(GTK_WIDGET(view)); |
| 37 | + |
| 38 | + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); |
0 commit comments