egui
egui copied to clipboard
Moving window between screens with different resolution: positioning of client area is wrong
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:
- Build the eframe_template project
- 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:
Displaced on 125% scaled secondary screen:
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.
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
?