egui icon indicating copy to clipboard operation
egui copied to clipboard

Moving window between screens with different resolution: positioning of client area is wrong

Open hamamo opened this issue 2 years ago • 1 comments

When an egui window is moved between screens having different resolution/scaling, the client area is correctly scaled but not positioned correctly within the window. It is always correct on the screen on which it was created.

To Reproduce Steps to reproduce the behavior:

  1. Build the eframe_template project
  2. Run on a machine with multiple monitors having different resolution/scaling settings

Expected behavior Client area should be correctly positioned within window even when moving between screens.

Screenshots Correct on 100% scaled main screen: grafik Displaced on 125% scaled secondary screen: grafik

Desktop (please complete the following information):

  • OS: Windows 10

Note As the current github version does not build successfully, I've used the 0.18.0 versions of egui and eframe. The build problem would be a different issue which I'm not opening now.

hamamo avatar Jun 29 '22 11:06 hamamo

I'm not using windows, and on Mac this works well for me.

Take a look at eframe/src/native/run.rs (and egui-winit/src/lib.rs) to see what events you get (especially ScaleFactorChanged and Resized is of interest). Also native_pixels_per_point and screen_size_in_pixels in egui-winit/src/lib.rs is worth investigating.

Perhaps we need to round the window size up to the nearest integer on a ScaleFactorChanged/Resized?

emilk avatar Jul 21 '22 18:07 emilk