diff --git a/lib/Screen/LauncherHome.dart b/lib/Screen/LauncherHome.dart index 0687cded..abba2ced 100644 --- a/lib/Screen/LauncherHome.dart +++ b/lib/Screen/LauncherHome.dart @@ -95,7 +95,7 @@ class _LauncherHomeState extends State { navigator.pop(); } } - return null; + return; }), RestartIntent: CallbackAction( onInvoke: (RestartIntent intent) { @@ -109,18 +109,22 @@ class _LauncherHomeState extends State { actions: const [OkClose()], )); }); - return null; + return; }), FeedBackIntent: CallbackAction( onInvoke: (FeedBackIntent intent) { LauncherInfo.feedback(context); - return null; + return; }), FullScreenIntent: CallbackAction( onInvoke: (FullScreenIntent intent) async { + if (LauncherInfo.multiWindow && Platform.isWindows) { + return; + } + bool isFullScreen = await windowManager.isFullScreen(); await windowManager.setFullScreen(!isFullScreen); - return null; + return; }), }, builder: (BuildContext context, Widget? widget) { diff --git a/lib/Utility/Data.dart b/lib/Utility/Data.dart index 4a3e80a0..2b480136 100644 --- a/lib/Utility/Data.dart +++ b/lib/Utility/Data.dart @@ -16,6 +16,8 @@ import 'package:rpmlauncher/Utility/LauncherInfo.dart'; import 'package:rpmlauncher/Utility/Logger.dart'; import 'package:rpmlauncher/Utility/RPMPath.dart'; import 'package:rpmtw_dart_common_library/rpmtw_dart_common_library.dart'; +import 'package:window_manager/window_manager.dart'; +import 'package:window_size/window_size.dart'; late bool isInit; late Analytics googleAnalytics; @@ -38,8 +40,16 @@ class Data { argsInit(); await RPMPath.init(); await I18n.init(); + if (!kTestMode) { + setWindowMinSize(const Size(960.0, 640.0)); + setWindowMaxSize(Size.infinite); + } if (!LauncherInfo.multiWindow) { + if (!(LauncherInfo.multiWindow && Platform.isWindows)) { + await windowManager.ensureInitialized(); + } + DiscordRPC discordRPC = DiscordRPC( applicationId: 903883530822627370, libTempPath: Directory(join(dataHome.path, 'discord-rpc-library'))); diff --git a/lib/main.dart b/lib/main.dart index 31b787da..cbdf5884 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,6 @@ import 'package:system_info/system_info.dart'; import 'package:rpmlauncher/Model/Account/Account.dart'; import 'package:rpmlauncher_plugin/rpmlauncher_plugin.dart'; import 'package:window_manager/window_manager.dart'; -import 'package:window_size/window_size.dart'; import 'Utility/Config.dart'; import 'Utility/Data.dart'; @@ -29,11 +28,6 @@ Future run() async { LauncherInfo.startTime = DateTime.now(); LauncherInfo.isDebugMode = kDebugMode; WidgetsFlutterBinding.ensureInitialized(); - await windowManager.ensureInitialized(); - if (!kTestMode) { - setWindowMinSize(const Size(960.0, 640.0)); - setWindowMaxSize(Size.infinite); - } await Data.init(); logger.info("Starting"); @@ -127,6 +121,10 @@ Future run() async { logger.info("OS Version: ${await RPMLauncherPlugin.platformVersion}"); if (LauncherInfo.autoFullScreen) { + if (LauncherInfo.multiWindow && Platform.isWindows) { + return; + } + await windowManager.setFullScreen(true); }