Skip to content

Improper resizing when dragging windows between monitors with different DPI scaling #7648

@willtoth

Description

@willtoth

This looks similar, but not quite the same as #4918 and #1775

Describe the bug
When dragging a window between two monitors with different resolutions and scale factors, the window resizes on the correct event, however depending on where your mouse is located, the window will resize in that direction. The result is the window may snap back to the previous resolution screen, and the window size will be smaller/bigger.

For example, going from a 1.0 scale --> 1.75 scale, with the mouse on the right side of the top bar, the window resizes at the correct time, but the mouse moves back to the 1.0 scale monitor, with the window now smaller. If I drag with the mouse on the left size of the bar, the resizing works correctly.

If I go the other direction, from the 1.75 scale --> 1.0 scale the problem is far worse, as the mouse moves towards the 1.0 resolution screen but the bulk of the window remains on the 1.75, but with a much larger window.

In the problematic cases, the mouse position is also wrong.

Adding some simple debugging to the scale factor event, the change from 1 to 1.75 happen in quick succession as you can see based on time stamps

videos.zip

[2025-10-17T18:51:48Z DEBUG egui_glow::painter]
    opengl version: 3.3.0 Core Profile Context 25.9.1.250822
    opengl renderer: AMD Radeon RX 6900 XT
    opengl vendor: ATI Technologies Inc.
[2025-10-17T18:51:48Z DEBUG egui_glow::shader_version] Shader version: Gl140 ("4.60").
[2025-10-17T18:51:48Z DEBUG egui_glow::painter] Shader header: "#version 140\n".
[2025-10-17T18:51:48Z DEBUG egui_glow::painter] SRGB framebuffer Support: true
[2025-10-17T18:51:48Z DEBUG egui_glow::vao] GL version: "3.3.0 Core Profile Context 25.9.1.250822".
[2025-10-17T18:51:48Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:52:05Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:52:11Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:52:11Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:52:17Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:52:17Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:52:22Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:52:22Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:52:25Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:52:25Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:52:29Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:52:29Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:25Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:25Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:27Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:28Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:30Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:30Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:35Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:35Z DEBUG egui_winit] Scale factor changed to 1
[2025-10-17T18:53:37Z DEBUG egui_winit] Scale factor changed to 1.75
[2025-10-17T18:53:37Z DEBUG egui_winit] Scale factor changed to 1

To Reproduce

  1. Build any app, or download a native egui app (e.g. https://aspectron.org/en/projects/kaspa-ng.html)
  2. Have two monitors of different resolutions and scale factors
  3. Drag the window from one to the other, keeping the mouse at a few different positions on the top bar

Expected behavior
Correct re-scaling

Screenshots
Video included in the problem description

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Native
  • Version 0.33.1 bf5604b

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions