opt: ui & cursor

- opt: win7 frameless
- opt: disable cursor output & macos free cache
- opt: main window, set location before show/hide
This commit is contained in:
Kingtous
2022-11-29 23:03:16 +08:00
parent da88d5c0b8
commit 8a4f8e202d
7 changed files with 65 additions and 18 deletions

View File

@@ -118,17 +118,20 @@ void runMainApp(bool startService) async {
gFFI.serverModel.startService();
}
runApp(App());
// restore the location of the main window before window hide or show
await restoreWindowPosition(WindowType.Main);
// check the startup argument, if we successfully handle the argument, we keep the main window hidden.
if (checkArguments()) {
windowManager.hide();
} else {
windowManager.show();
windowManager.focus();
// move registration of active main window here to prevent async visible check.
rustDeskWinManager.registerActiveWindow(kWindowMainId);
}
// set window option
WindowOptions windowOptions = getHiddenTitleBarWindowOptions();
windowManager.waitUntilReadyToShow(windowOptions, () async {
restoreWindowPosition(WindowType.Main);
windowManager.setOpacity(1);
});
}
@@ -173,6 +176,11 @@ void runMultiWindow(
widget,
MyTheme.currentThemeMode(),
);
// we do not hide titlebar on win7 because of the frame overflow.
if (Platform.isWindows &&
const [WindowsTarget.w7].contains(windowsBuildNumber.windowsVersion)) {
WindowController.fromWindowId(windowId!).showTitleBar(true);
}
switch (appType) {
case kAppTypeDesktopRemote:
await restoreWindowPosition(WindowType.RemoteDesktop,
@@ -273,12 +281,18 @@ void runInstallPage() async {
}
WindowOptions getHiddenTitleBarWindowOptions({Size? size}) {
var defaultTitleBarStyle = TitleBarStyle.hidden;
// we do not hide titlebar on win7 because of the frame overflow.
if (Platform.isWindows &&
const [WindowsTarget.w7].contains(windowsBuildNumber.windowsVersion)) {
defaultTitleBarStyle = TitleBarStyle.normal;
}
return WindowOptions(
size: size,
center: false,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.hidden,
titleBarStyle: defaultTitleBarStyle,
);
}