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

Closed
opened 2026-11-07 16:32:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4452
Author: @xvcezrqpbxtpzblrt
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: desktop/window-state-027


📝 Commits (2)

  • 557e09f [GUI] Show the window when the page has painted, not while it is still blank
  • e43914c [GUI] Open the window maximized the first time, and where it was left after that

📊 Changes

4 files changed (+247 additions, -10 deletions)

View changed files

📝 apps/desktop/src-tauri/src/desktoplog.rs (+2 -1)
📝 apps/desktop/src-tauri/src/main.rs (+174 -7)
📝 apps/desktop/src-tauri/tauri.conf.json (+19 -1)
📝 apps/host/src/main.tsx (+52 -1)

📄 Description

## 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4452 **Author:** [@xvcezrqpbxtpzblrt](https://github.com/xvcezrqpbxtpzblrt) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `desktop/window-state-027` --- ### 📝 Commits (2) - [`557e09f`](https://github.com/Niko1221/Strata/commit/557e09fc80eae9a96836646cecd269d7d69c1475) [GUI] Show the window when the page has painted, not while it is still blank - [`e43914c`](https://github.com/Niko1221/Strata/commit/e43914c82ea8cfedb021b25353770833f71bb013) [GUI] Open the window maximized the first time, and where it was left after that ### 📊 Changes **4 files changed** (+247 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `apps/desktop/src-tauri/src/desktoplog.rs` (+2 -1) 📝 `apps/desktop/src-tauri/src/main.rs` (+174 -7) 📝 `apps/desktop/src-tauri/tauri.conf.json` (+19 -1) 📝 `apps/host/src/main.tsx` (+52 -1) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:32:19 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5052
No description provided.