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

Save restore position when minimized #2725

Merged
merged 2 commits into from
Apr 20, 2019

Conversation

HebaruSan
Copy link
Member

Problem

If you:

  1. Open CKAN with the tray icon enabled
  2. Minimize it
  3. Right click the tray icon
  4. Exit

... then the following is saved to GUIConfig.xml:

config

And the next time CKAN runs, its window will not appear.

Cause

Apparently Windows moves minimized windows to (-32000,-32000).

https://stackoverflow.com/questions/1478765/location-coordinates-on-computer-showing-x-32000-y-32000

So when we exit and save the Location property while minimized, we're saving that value.

Changes

Now we ignore Location if the window state isn't normal (i.e., we're minimized or maximized), and instead we check RestoreBounds.Location, which is where the window's former location to which it will be returned lives. This mirrors how we handle the window size on the next line of code (though in that case the problem was with maximization).

Fixes #2717.

@HebaruSan HebaruSan added Bug Easy This is easy to fix GUI Issues affecting the interactive GUI Pull request labels Apr 11, 2019
Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

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

Works as intended

@HebaruSan HebaruSan added the In progress We're still working on this label Apr 13, 2019
@HebaruSan
Copy link
Member Author

I'm thinking it should also recover from the issue once the file already has -32000 in it. Please hold off on merging till that's added.

@HebaruSan
Copy link
Member Author

Updated to default to center of screen when the saved position isn't on any of the known screens.

@HebaruSan HebaruSan removed the In progress We're still working on this label Apr 17, 2019
@HebaruSan HebaruSan merged commit 72eea01 into KSP-CKAN:master Apr 20, 2019
HebaruSan added a commit that referenced this pull request Apr 20, 2019
@HebaruSan HebaruSan deleted the fix/min-exit-saved-pos branch April 21, 2019 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Window opens offscreen if previously closed while minimized
3 participants