Fix incorrect window sizes for non-resizable windows on Wayland
Using physical window sizes leads to all kinds of fun stuff: winit always uses scale factor 1.0 on start to convert it back to logical pixels and uses these logical pixels to set min/max size for non-resizeable windows. You're supposed to adjust size after getting a scale change event if you're using physical sizes, but adjusting min/max sizes doesn't seem to work on sway, so the window is stuck with an incorrect size.
The scale factor we guessed might also be wrong even if there's only a single display since it doesn't take fractional scale into account.
TL;DR: winit actually wants logical sizes in these methods (since Wayland in general operates mostly on logical sizes) and converting them back and forth is lossy.
- Closes https://github.com/emilk/egui/issues/7095
- [x] I have followed the instructions in the PR template
Okay, I think this is ready. I wasn’t able to run all the tests locally (because some tests failed even on main branch for some reason), but it shouldn’t break anything.
Currently checking on my device....
all good here just some pixels in some images - i dont think thats because of you
@bircni Hi! Could you please direct me to my next steps here? This is my first time contributing to egui and I’m a bit confused.
I’m happy to add lint reasons and do a direct import if you prefer it, but I’m not sure if this PR is waiting on me doing that or on emilk making a decision about this lint in general.
Thanks for review either way
@GoldsteinE we are still waiting on comments from @emilk - but adding a reason would always be great!
If emilk decides to reallow the types we can do that afterwards :-)
Sure, I’ve done that.
This works beautifully on my mac ❤️
Preview available at https://egui-pr-preview.github.io/pr/7103-window-logical-size Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.
Thanks for fixing this!
Thanks for reviewing!