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

Fix restoring window geometry #392

Merged
merged 2 commits into from
Feb 22, 2024
Merged

Commits on Feb 21, 2024

  1. Restore window geometry correctly, even in high DPI

    The coordinates returned by GetWindowPlacement() must be passed to
    SetWindowPlacement() and not SetWindowPos() as the former functions
    account correctly for non-standard DPI, while the latter one does not.
    
    Using SetWindowPlacement() also allows to remove the checks for the
    coordinates being valid because the function already checks for this and
    will always position the window inside the visible area anyhow.
    
    Fixes CobaltFusion#370.
    vadz committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    2f09796 View commit details
    Browse the repository at this point in the history
  2. Fix restoring position of maximized and minimized window too

    If the window was closed in the maximized (or, more rarely, but still
    possible, minimized) state, restore it in the same state during the next
    run.
    
    Take care to use the appropriate show command for the ShowWindow() call
    done in Main(), as using SW_SHOWMAXIMIZED with SetWindowPlacement()
    doesn't work quite as expected.
    vadz committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    86292ff View commit details
    Browse the repository at this point in the history