Fix resize issues on windows

This commit is contained in:
qianlifeng 2024-10-22 10:10:34 +08:00
parent 65122ab324
commit 8efb76becc
2 changed files with 5 additions and 8 deletions

View File

@ -153,7 +153,11 @@ class _WoxAppState extends State<WoxApp> with WindowListener, ProtocolListener {
windowManager.addListener(this);
// notify server that ui is ready
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
launcherController.resizeHeight();
await windowManager.focus();
launcherController.queryBoxFocusNode.requestFocus();
WoxApi.instance.onUIReady();
});
}

View File

@ -636,13 +636,6 @@ class WoxLauncherController extends GetxController {
}
final totalHeight = WoxThemeUtil.instance.getQueryBoxHeight() + resultHeight;
//if the window height is same as the total height, then no need to resize
var currentSize = await windowManager.getSize();
if (currentSize.height == totalHeight) {
if (LoggerSwitch.enableSizeAndPositionLog) Logger.instance.info(const UuidV4().generate(), "Resize: want to resize but the height is same as current height");
return;
}
if (Platform.isWindows) {
// on windows, if I set screen ratio to 2.0, then the window height should add more 4.5 pixel, otherwise it will show render error
// still don't know why. here is the test result: ratio -> additional window height