Repository navigation
fix(window): recover a too-small window when several monitors are left - #2732
Draft
cheng-block wants to merge 3 commits into
Draft
cheng-block wants to merge 3 commits into
cheng-block wants to merge 3 commits into
Conversation
Replace the single-monitor special case with one rule: a monitor only holds the saved rect if the saved size meets the minimum at that monitor's scale. A smaller size was saved at a lower scale, so with two 2x monitors left after unplugging a 1x external the window is now relocated with the default size instead of opening clamped. (cherry picked from commit 7de4895, resolved onto the restructured restore_request / reachable_client from block#2405) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Cheng Peng <cheng@block.xyz> (cherry picked from commit 55d8657)
Keep header visibility geometric again and check the minimum separately: at least one monitor under the header must have a scale at which the saved size fits. A 1x window spanning onto a 2x laptop stays where it was. (cherry picked from commit 7e2393e, resolved onto the restructured restore_request / reachable_client from block#2405; its minimum rounding part is already in block#2405) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Cheng Peng <cheng@block.xyz> (cherry picked from commit 6f018b1)
The saved size comes from the scale of the monitor that held most of the window, which need not hold the header. Count a monitor whose scale fits the saved size when it intersects the saved client, not only when it holds a header corner. A window hanging below a 2x monitor onto a 1x one, or spanning a 1x monitor between two 2x ones, now stays put. Header visibility is main's check again. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Cheng Peng <cheng@block.xyz>
This branch has not been deployed
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.
Why
Use a 2x laptop, a second 2x monitor, and a 1x external to the right of the laptop. Quit Buzz on the external, unplug it, and relaunch. The window opens at half size, at or below the 480x400 minimum. The fix in #2405 covers this only when one monitor is left.
On macOS a monitor's physical rect is its point rect times its scale. So the rect saved on the 1x external can fall inside the 2x laptop.
reachable_client(src-tauri/src/window_state.rs) sees the header on screen and keeps that rect. It replaces a too-small size only when one monitor is left, where the scale is certain.What
The saved rect is now kept only if a monitor under the window could have saved that size at its own scale.
How
restore_requestruns the existing minimum check at each monitor's scale, Windows shadow insets included. This replaces the one-monitor special case.main. The state file, the plugin version and onboarding geometry are unchanged.Risk
Only window restore at launch changes, and only when the saved size is below the minimum at some monitor's scale.
main:onboarding_snapshot_is_kept_until_next_launch_restoresegfaults on macOS, because it callsns_window()on the fake view fromMockRuntime.Testing
No manual testing beyond the in-app check.
In-app check
Pending. It needs a 2x laptop, a second 2x monitor and a 1x external to the right of the laptop.