From f7ef8a3915a833a7ae4bb973f2981d934a38c56a Mon Sep 17 00:00:00 2001 From: Noo6 <2746419228@qq.com> Date: Fri, 16 Aug 2024 16:19:58 +0800 Subject: [PATCH] opt: hidden at launch on linux and macos --- linux/my_application.cc | 2 +- macos/Runner/MainFlutterWindow.swift | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/linux/my_application.cc b/linux/my_application.cc index 8bf67faf6..52b01a742 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -48,7 +48,7 @@ static void my_application_activate(GApplication* application) { } gtk_window_set_default_size(window, 400, 777); - gtk_widget_show(GTK_WIDGET(window)); + gtk_widget_realize(GTK_WIDGET(window)); g_autoptr(FlDartProject) project = fl_dart_project_new(); fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift index 6715bce33..eb2cf72f6 100644 --- a/macos/Runner/MainFlutterWindow.swift +++ b/macos/Runner/MainFlutterWindow.swift @@ -1,5 +1,6 @@ import Cocoa import FlutterMacOS +import window_manager class MainFlutterWindow: NSWindow { override func awakeFromNib() { @@ -18,4 +19,9 @@ class MainFlutterWindow: NSWindow { super.awakeFromNib() } + + override public func order(_ place: NSWindow.OrderingMode, relativeTo otherWin: Int) { + super.order(place, relativeTo: otherWin) + hiddenWindowAtLaunch() + } }