Repository navigation
Conversation
While the window is in a live move, apply the rect suggested by WM_DPICHANGED instead of the conservative rect. The conservative rect can land back on the monitor being left, which sends another WM_DPICHANGED and grows the window on every crossing. Same approach as rust-windowing#4341 (merged) and rust-windowing#4694. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Friendly ping: a second user has hit this downstream in OpenCADStudio (HakanSeven12/OpenCADStudio#2858, after rust-windowing#2363). The window gets stuck or bounces when dragged between a high-DPI laptop panel and a 1080p external monitor on Windows. The app is waiting for this fix to land here before it moves its winit pin. Happy to rebase or change anything that would make this easier to review. |
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.
Problem
On Windows with two monitors at different scale factors, dragging an iced window from one monitor to the other makes it flip back and forth between the two monitors and grow on every crossing. Releasing the mouse and grabbing it again puts it back on the monitor it came from, or part way between.
In
WM_DPICHANGED, winit ignores the rect Windows suggests and builds its own "conservative" rect, then checks it againstMonitorFromWindow. During a drag that still answers with the monitor being left, so the window is nudged back onto it. That move sends anotherWM_DPICHANGED, which rescales the size again, and the two feed each other while the drag lasts.This is upstream rust-windowing#3040 / rust-windowing#4041; upstream fixed it in rust-windowing#4341 (merged, Windows 11 uses the suggested rect), and rust-windowing#4694 (open) does the same for live drags. The
2026-10-02branch still has the old code.Fix
While the window is in a live move/resize (
MARKER_IN_SIZE_MOVE), use the rect suggested byWM_DPICHANGEDas is. Outside a drag, the existing conservative rect and monitor nudge are unchanged. One file, 9 lines added and 5 removed.Test
05b8ff17(the rev iced 0.15-dev pinned until recently); this branch has the same change on2026-10-02.cargo checkandcargo clippyonx86_64-pc-windows-msvc: clean (the first version used a late-initialisedlet, which clippy rejects; this one is alet … = if … else …).