fix: macos titlebar

This commit is contained in:
kingtous 2022-11-22 23:01:42 +08:00
parent 9bbe2919a1
commit 0643227154
2 changed files with 38 additions and 4 deletions

View File

@ -42,7 +42,9 @@ Future<void> main(List<String> args) async {
if (args.isNotEmpty && args.first == 'multi_window') {
windowId = int.parse(args[1]);
stateGlobal.setWindowId(windowId!);
if (!Platform.isMacOS) {
WindowController.fromWindowId(windowId!).showTitleBar(false);
}
final argument = args[2].isEmpty
? <String, dynamic>{}
: jsonDecode(args[2]) as Map<String, dynamic>;
@ -168,7 +170,8 @@ void runMultiWindow(
);
switch (appType) {
case kAppTypeDesktopRemote:
await restoreWindowPosition(WindowType.RemoteDesktop, windowId: windowId!);
await restoreWindowPosition(WindowType.RemoteDesktop,
windowId: windowId!);
break;
case kAppTypeDesktopFileTransfer:
await restoreWindowPosition(WindowType.FileTransfer, windowId: windowId!);

View File

@ -1,7 +1,22 @@
import Cocoa
import FlutterMacOS
import desktop_multi_window
// import bitsdojo_window_macos
import desktop_drop
import device_info_plus_macos
import flutter_custom_cursor
import package_info_plus_macos
import path_provider_macos
import screen_retriever
import sqflite
import tray_manager
import uni_links_desktop
import url_launcher_macos
import wakelock_macos
import window_manager
import window_size
class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
if (!rustdesk_core_main()){
@ -15,6 +30,22 @@ class MainFlutterWindow: NSWindow {
RegisterGeneratedPlugins(registry: flutterViewController)
FlutterMultiWindowPlugin.setOnWindowCreatedCallback { controller in
// Register the plugin which you want access from other isolate.
// DesktopLifecyclePlugin.register(with: controller.registrar(forPlugin: "DesktopLifecyclePlugin"))
DesktopDropPlugin.register(with: controller.registrar(forPlugin: "DesktopDropPlugin"))
DeviceInfoPlusMacosPlugin.register(with: controller.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FlutterCustomCursorPlugin.register(with: controller.registrar(forPlugin: "FlutterCustomCursorPlugin"))
FLTPackageInfoPlusPlugin.register(with: controller.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: controller.registrar(forPlugin: "PathProviderPlugin"))
SqflitePlugin.register(with: controller.registrar(forPlugin: "SqflitePlugin"))
TrayManagerPlugin.register(with: controller.registrar(forPlugin: "TrayManagerPlugin"))
UniLinksDesktopPlugin.register(with: controller.registrar(forPlugin: "UniLinksDesktopPlugin"))
UrlLauncherPlugin.register(with: controller.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockMacosPlugin.register(with: controller.registrar(forPlugin: "WakelockMacosPlugin"))
WindowSizePlugin.register(with: controller.registrar(forPlugin: "WindowSizePlugin"))
}
super.awakeFromNib()
}