Skip to content
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

Merged
merged 35 commits into from
Oct 4, 2024

Conversation

atavism
Copy link
Contributor

@atavism atavism commented Oct 3, 2024

  • 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

@atavism atavism marked this pull request as draft October 3, 2024 15:18
})
authClient = auth.NewClient(fmt.Sprintf("https://%s", common.DFBaseUrl), userConfig)

a = app.NewApp(flags, cdir, proClient, ss)
Copy link
Contributor Author

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

LanternFFI.exit();
onClick: (item) async {
await trayManager.destroy();
await LanternFFI.exit();
Copy link
Contributor Author

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

windowManager.waitUntilReadyToShow(windowOptions, () async {

await windowManager.setPreventClose(true);
await windowManager.setResizable(false);
Copy link
Contributor Author

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();
Copy link
Contributor Author

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

@atavism atavism changed the title DPI Scaling on Windows and immediately exit after cleanup Update sequence we clean up resources when exiting the app Oct 3, 2024
await windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
Copy link
Contributor Author

@atavism atavism Oct 3, 2024

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),
);
});
Copy link
Contributor Author

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.

@atavism atavism changed the title Update sequence we clean up resources when exiting the app Temporary workaround for Windows layout distortion and some other updates Oct 4, 2024
@atavism atavism marked this pull request as ready for review October 4, 2024 01:17
@atavism
Copy link
Contributor Author

atavism commented Oct 4, 2024

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

@atavism
Copy link
Contributor Author

atavism commented Oct 4, 2024

@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!

@atavism atavism merged commit cfff37e into main Oct 4, 2024
1 check passed
@atavism atavism deleted the atavism/update-onwindowclose branch October 4, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant