Repository navigation
fix(window): build the launch window with its shadow on, so restored sizes stop shrinking - #1079
Merged
Merged
Conversation
…sizes stop shrinking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withset_shadow(true). window-state restores the saved size insidebuild()(on_window_ready), so it ran while the window had no shadow. tao'sset_inner_sizeonly 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 madeWM_NCCALCSIZEinset the client by the resize frame: 8px left, right and bottom, 1px top on Windows 11. The plugin savesinner_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_windowalready builds secondary windows, and the lateset_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), andsrc/lib/bindings.tsunchanged.