Skip to content

fix(window): build the launch window with its shadow on, so restored sizes stop shrinking - #1079

Merged
PathGao merged 1 commit into
masterfrom
fix/window-size-drift
Nov 11, 2026
Merged

PathGao merged 1 commit into
masterfrom
fix/window-size-drift

Conversation

@PathGao

@PathGao PathGao commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #1077, reported by @nebster9k on Windows 11 at 100% scaling: every relaunch the window came back 16px narrower and 9px shorter.

Mechanism

The launch window was built with .shadow(false) and given its shadow afterwards with set_shadow(true). window-state restores the saved size inside build() (on_window_ready), so it ran while the window had no shadow. tao's set_inner_size only adds the hidden frame of an undecorated shadowed window when the shadow is already on, so the outer size was set to the saved inner size. set_shadow(true) then made WM_NCCALCSIZE inset the client by the resize frame: 8px left, right and bottom, 1px top on Windows 11. The plugin saves inner_size(), so each launch saved 16x9 less than it restored.

The window is now built with its shadow on, which is tao's default and how build_viewer_window already builds secondary windows, and the late set_shadow(true) is gone. The final state is the same on every platform. macOS ends with a shadow as before, and Linux ignores it.

Side effect: a first launch with no saved state now gets the intended 900x650 client area instead of 884x641. A maximized window's restored size no longer loses the 16x9 either.

.shadow(false) dates from 5254b46, when the window was also .transparent(true). That flag is gone.

Verification

  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo test --locked (249 passed), and src/lib/bindings.ts unchanged.
  • Built a macOS test bundle. The main window still has its shadow and restores its size.
  • Not run on Windows. The fix follows from the tao 0.37.1 and tauri-plugin-window-state 2.5.0 code paths above.

@PathGao
PathGao merged commit 9a9eb39 into master Nov 11, 2026
2 of 4 checks passed
@PathGao
PathGao deleted the fix/window-size-drift branch November 11, 2026 16:33
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.

Window shrinks by 16px width / 9px height on every launch (regression of #98, still present in 2.9.2)

1 participant