Skip to content

Restore window position without default instance#3878

Merged
HebaruSan merged 1 commit into
KSP-CKAN:masterfrom
HebaruSan:fix/gui-config-load
Aug 11, 2023
Merged

Restore window position without default instance#3878
HebaruSan merged 1 commit into
KSP-CKAN:masterfrom
HebaruSan:fix/gui-config-load

Conversation

@HebaruSan
Copy link
Copy Markdown
Member

Problem

If you don't have a default game instance, the GUI window will always appear in its default location as if you have never run CKAN before. This can be annoying if you have a strong preference for having appear in a particular spot on the screen or at a particular size.

Cause

The window geometry is saved per-instance, and as of #3829 and #3863, we display the GUI window as early as possible, and if there's no default instance, then the window appears before you choose an instance. There was no clearly best way to load the geometry without an instance.

Changes

Now if you have no default instance, we scan your (valid) instances to find the one with the most recently written CKAN/GUIConfig.xml file, and then we load that configuration. This way the window will appear wherever it was when you most recently closed CKAN, even with no default instance. If you have no instances at all (or if all of your instances are corrupted), we fall back to the baseline defaults.

Fixes #3870.

@HebaruSan HebaruSan added Bug Something is not working as intended Easy This is easy to fix GUI Issues affecting the interactive GUI labels Aug 10, 2023
@HebaruSan HebaruSan requested a review from techman83 August 10, 2023 18:32
Copy link
Copy Markdown
Member

@techman83 techman83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, I like that logic! Thanks @HebaruSan

@HebaruSan HebaruSan merged commit 399d82f into KSP-CKAN:master Aug 11, 2023
@HebaruSan HebaruSan deleted the fix/gui-config-load branch August 11, 2023 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working as intended Easy This is easy to fix GUI Issues affecting the interactive GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [1.33.2] CKAN does not remember the last window position

2 participants