Skip to content

Window position creeps between executions on scaled monitors #4442

@avery-radmacher

Description

@avery-radmacher

Describe the bug

On monitors with a scale other than 100%, persistent windows are not recreated at the location where they were closed. In the gif below, I am running a shell script to start the demo app right after I manually close it. You can see the creep down and to the right. This screen has a 150% scaling.
egui_window_position_creep

Once the window has moved off the monitor, the program can no longer be brought back onto the screen and is very difficult to interact with.

To Reproduce

  1. You must have a monitor with a scaling other than 100%. persistence must be enabled (it is by default).
  2. Run egui_demo_app (cargo run --release)
  3. If the window is not already on the scaled monitor, drag it to the middle of the scaled monitor
    a. The further the window's top left corner is from the monitor's top left corner, the greater the effect noticed in step 6 will be.
  4. Close the program.
  5. Run egui_demo_app again.
  6. Notice that the window is in a different location.

Expected behavior

The window reappears in the same location where it was closed.

Desktop (please complete the following information):

  • OS: Windows 11 Pro
  • Browser: N/A
  • Version: rust-version = "1.76", egui: version = "0.27.2"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokennative-windowsRunning on native Windows OS

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions