Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
fix: mulit window bugs on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
SiongSng committed Apr 16, 2022
1 parent 33a9916 commit a405e53
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
12 changes: 8 additions & 4 deletions lib/Screen/LauncherHome.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class _LauncherHomeState extends State<LauncherHome> {
navigator.pop();
}
}
return null;
return;
}),
RestartIntent: CallbackAction<RestartIntent>(
onInvoke: (RestartIntent intent) {
Expand All @@ -109,18 +109,22 @@ class _LauncherHomeState extends State<LauncherHome> {
actions: const [OkClose()],
));
});
return null;
return;
}),
FeedBackIntent: CallbackAction<FeedBackIntent>(
onInvoke: (FeedBackIntent intent) {
LauncherInfo.feedback(context);
return null;
return;
}),
FullScreenIntent: CallbackAction<FullScreenIntent>(
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) {
Expand Down
10 changes: 10 additions & 0 deletions lib/Utility/Data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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')));
Expand Down
10 changes: 4 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -29,11 +28,6 @@ Future<void> 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");

Expand Down Expand Up @@ -127,6 +121,10 @@ Future<void> run() async {
logger.info("OS Version: ${await RPMLauncherPlugin.platformVersion}");

if (LauncherInfo.autoFullScreen) {
if (LauncherInfo.multiWindow && Platform.isWindows) {
return;
}

await windowManager.setFullScreen(true);
}

Expand Down

0 comments on commit a405e53

Please sign in to comment.