Skip to content

Fix runaway resizing during mixed-DPI window drags - #4694

Open
LunaticGhoulPiano wants to merge 1 commit into
rust-windowing:v0.30.xfrom
LunaticGhoulPiano:fix/windows-mixed-dpi-drag
Open

LunaticGhoulPiano wants to merge 1 commit into
rust-windowing:v0.30.xfrom
LunaticGhoulPiano:fix/windows-mixed-dpi-drag

Conversation

@LunaticGhoulPiano

Copy link
Copy Markdown

Fixes #4600.

Problem

On Windows 11 24H2 with mixed-DPI monitors, dragging a maximized window from a 125% scaled monitor to a 100% scaled monitor can repeatedly enlarge the restored window and keep it attached to the original monitor.

The conservative rectangle adjustment performed during WM_DPICHANGED can move the window back to the previous monitor, causing another DPI transition and creating a resize feedback loop.

Fix

While the window is inside a live move/resize operation, apply the rectangle suggested by WM_DPICHANGED directly.

Outside a live move/resize operation, retain the existing conservative DPI adjustment and monitor-nudge behavior.

Testing

  • cargo +nightly fmt --all -- --check

  • cargo check --lib

  • Tested by repeatedly dragging a winit application between monitors with different DPI scale factors

  • Verified with TS Analyzer through eframe

  • Confirmed that the window moves to the target monitor without uncontrolled growth

  • Tested on all platforms changed

  • Added an entry to the changelog module

  • Documentation changes are not applicable

  • No example changes are required

  • No feature-matrix changes are required

Use the WM_DPICHANGED suggested rectangle while a window is being dragged. This prevents conservative DPI adjustment from moving the window back to the previous monitor and triggering repeated growth.
@LunaticGhoulPiano

Copy link
Copy Markdown
Author

The CI failures appear unrelated to this PR.

All affected jobs fail during the shared Generate lockfile step before building or testing this change:

error: specification `syn` is ambiguous
help: re-run this command with one of the following specifications
  syn@2.0.119
  syn@3.0.5

The workflow currently runs:

cargo update -p syn --precise 2.0.114

I reproduced the failure locally. Qualifying the package by major version works:

cargo update -p syn@2 --precise 2.0.114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant