-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Temporary workaround for Windows layout distortion and some other updates #1204
Conversation
atavism
commented
Oct 3, 2024
•
edited
Loading
edited
- Temporary fix for Windows layout distortion
- Updates to immediately exit the app after cleanup
- Move initialization code to Run() to have more control over when and how it is invoked and to avoid relaying on globals
}) | ||
authClient = auth.NewClient(fmt.Sprintf("https://%s", common.DFBaseUrl), userConfig) | ||
|
||
a = app.NewApp(flags, cdir, proClient, ss) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm moving the initialization code here to Run() to have more control over when and how it is invoked and to avoid relaying on globals
lib/features/home/home.dart
Outdated
LanternFFI.exit(); | ||
onClick: (item) async { | ||
await trayManager.destroy(); | ||
await LanternFFI.exit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are waiting for Lantern to finish running clean up functions and immediately exiting after now
lib/features/home/home.dart
Outdated
windowManager.waitUntilReadyToShow(windowOptions, () async { | ||
|
||
await windowManager.setPreventClose(true); | ||
await windowManager.setResizable(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling setResizable before the window is ready to show now
onClick: (item) async { | ||
LanternFFI.exit(); | ||
await trayManager.destroy(); | ||
await windowManager.destroy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the sequence that we use to clean up and destroy resources when exiting the app
await windowManager.waitUntilReadyToShow(windowOptions, () async { | ||
await windowManager.show(); | ||
await windowManager.focus(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the window initialization back to main after I noticed there were issues where the window would randomly re-position itself on start, among other issues. This makes sure the window is properly set up before rendering any widgets, and the home widget is still using a WindowListener. I added some comments for future reference.
windowManager.setSize( | ||
ui.Size(value.width + 1, value.height + 1), | ||
); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the primary fix for the broken UI on Windows which is a temporary workaround until a new version of window_manager is released.
The latest Windows build seems to be working well for me with the temporary workaround to resize the window after loading the UI; however, I'm still seeing the distorted layout on occasion and trying to figure out what's triggering it. Except for that issue, the window, especially the system tray interaction, is working well on every platform. In addition, the updates to the initialization sequence have improved startup times and the app exits immediately after cleanup now |
@jigar-f I'm going to pull in these changes just to put out another build with the improvements, but please let me know if you have any comments or suggestions for improvements on this one. Happy to circle back! |