Create window with physical resolution
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
I'm writing a frontend for Visual Pinball. The Visual Pinball windows are defined in an ini file in physical resolution, at a physical location. For the frontend I need to also create windows at the same locations with the same size.
_To make things more tricky, the windows are defined in logical resolution on mac. And their position is also defined as logical resolution. I think this is some SDL quirk._
_I'm also confused by the window resolution api, but that is already covered in #11066_
## What solution would you like?
A way to tell that I want a window created with physical resolution.
## What alternative(s) have you considered?
Resizing after creation.
## Additional context
Linux
Two monitors at 200%
I think `XWayland` as I run Wayland and I saw `2025-01-27T15:58:48.901599Z INFO winit::platform_impl::linux::x11::window: Guessed window scale factor: 2`
Tried many things, none convince me, also cross-os / windowing systems compatibility is tricky here.
- Tried listening to the `WindowCreated` events and resizing windows there using `window.resolution.set_physical_resolution(width, height)`.
- I tried a `Startup` system that resizes windows, however only the primary window had the `scale_factor` set correctly, the other windows still had the default 1.0 instead of 2.0
- I thought of accessing the `WinitMonitors` resource before creating the windows and recalculating the `requested` window resolution but those resources in bevy are private.
- I don't want any windows visually resizing during startup
## Workaround
Currently on linux my best workaround is creating all windows with a very small resolution to avoid repositioning because they are bigger than the screen. On the created callback correctly sizing them.
Contributor guide
Assessment
This issue has not been assessed yet.