Skip to content

[GUI] Open the window maximized the first time, and where it was left after that - #4452

Closed
xvcezrqpbxtpzblrt wants to merge 2 commits into
Niko1221:mainfrom
xvcezrqpbxtpzblrt:desktop/window-state-027
Closed

xvcezrqpbxtpzblrt wants to merge 2 commits into
Niko1221:mainfrom
xvcezrqpbxtpzblrt:desktop/window-state-027

Conversation

@xvcezrqpbxtpzblrt

Copy link
Copy Markdown
Contributor

Problem

The window was created at a fixed 1440x920 in the top-left corner and never remembered being maximized. On a 2560x1440 screen that is 38% of the width: every start meant maximizing by hand, and the conversation sat in a corner with the rest of the screen empty.

Result

  • The first start opens maximized.
  • After that the window reopens the way it was left: maximized, or its own size and place. window.json in the Strata data folder holds { maximized, width, height, x, y }.
  • The size and place are recorded only while the window is not maximized (a maximized window reports the screen's size, not the one to return to), at most once every 700 ms while dragging, and once more when the window closes.
  • The file is written to a temporary name and renamed into place, so a half-written file is never read; a damaged file, or a place off the screen, falls back to the default (maximized, 1440x920 in the middle).
  • Also: the crash-file test still looked for 0.2.0 and failed on every run since the version moved to 0.2.7. It now asks for the crate's own version, so the next bump does not break it again.

Validation

  • cargo test --release → 26 pass, 0 fail, including the new the_window_reopens_where_it_was_left_and_maximized_on_the_first_run (first run, left un-maximized, an unusable size and place, a damaged file).
  • Installed build, Windows 11, 2560x1440: the window opens with IsZoomed = true and a 2576x1408 outer rect; %LOCALAPPDATA%\Strata\window.json reads {"maximized": true, ...}.
  • Not run: Linux and macOS builds; a multi-monitor setup where the saved place belongs to a screen that is gone (the sanity check only rejects absurd numbers, it does not test monitor membership).

Note

Based on #4438 (the window is shown after the first paint); that one should merge first. The crash-test line is a test-only fix in the same crate, found while running the suite.

@xvcezrqpbxtpzblrt

Copy link
Copy Markdown
Contributor Author

Superseded by #4606, which carries this change with the rest of the 0.2.7 branch. Closing so the review has one place.

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