Different window resizing behavior via a Query vs via DefaultPlugins::set
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
`0.10.1`
## Relevant system information
- Os:
```
❯ cat /etc/lsb-release
DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=22.1.0
DISTRIB_CODENAME=Talos
DISTRIB_DESCRIPTION="Manjaro Linux"
```
- Adapter:
```
AdapterInfo { name: "NVIDIA GeForce RTX 3080", vendor: 4318, device: 8710, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "530.41.03", backend: Vulkan }
```
## What you did
Ran this isolated build with 2 different ways of changing the window information.
```rs
use bevy::{
prelude::*,
window::{PresentMode, WindowResolution},
};
fn setup(world: &mut World) {
/*world.query::<&mut Window>().get_single_mut(world).unwrap() = Window {
title: "test".into(),
resolution: WindowResolution::new(1920., 1080.),
present_mode: PresentMode::AutoVsync,
prevent_default_event_handling: false,
fit_canvas_to_parent: true,
resizable: false,
..default()
};*/
}
#[rustfmt::skip]
fn main() {
let mut game = App::new();
game.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "test".into(),
resolution: WindowResolution::new(1920., 1080.),
present_mode: PresentMode::AutoVsync,
prevent_default_event_handling: false,
fit_canvas_to_parent: true,
resizable: false,
..default()
}),
..default()
}))
.add_startup_system(setup)
.run();
}
```
## What went wrong
Using `DefaultPlugins::set` vs setting the window in the `setup` system on startup results in different sized windows.
## Additional information
- log with setup system
```
❯ cargo run -- --nocapture
Finished dev [unoptimized + debuginfo] target(s) in 0.10s
Running `target/debug/bevytest --nocapture`
2023-04-25T11:12:29.999183Z INFO bevy_winit::system: Creating new window "Bevy App" (0v0)
2023-04-25T11:12:29.999343Z INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.1666666666666667
2023-04-25T11:12:30.068518Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3080", vendor: 4318, device: 8710, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "530.41.03", backend: Vulkan }
2023-04-25T11:12:30.426431Z INFO gilrs_core::platform::platform::gamepad: Gamepad /dev/input/event23 (Bigben Interactive Revolution Unlimited Pro Controller) connected.
2023-04-25T11:12:30.448212Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 22.1.0 Manjaro Linux", kernel: "5.15.108-1-MANJARO", cpu: "AMD Ryzen 9 5950X 16-Core Processor", core
_count: "16", memory: "31.3 GiB" }
2023-04-25T11:12:30.504557Z INFO bevy_input::gamepad: Gamepad { id: 0 } Connected
2023-04-25T11:12:36.185035Z INFO bevy_window::system: No windows are open, exiting
2023-04-25T11:12:36.185717Z INFO bevy_winit::system: Closing window 0v0
```
- log with `DefaultPlugins::set`
```
❯ cargo run -- --nocapture
Compiling bevytest v0.1.0 (/home/yogii/Repos/bevytest)
warning: unused variable: `world`
--> src/main.rs:6:10
|
6 | fn setup(world: &mut World) {
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_world`
|
= note: `#[warn(unused_variables)]` on by default
warning: `bevytest` (bin "bevytest") generated 1 warning (run `cargo fix --bin "bevytest"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 1.08s
Running `target/debug/bevytest --nocapture`
2023-04-25T11:12:52.324696Z INFO bevy_winit::system: Creating new window "test" (0v0)
2023-04-25T11:12:52.324924Z INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.1666666666666667
2023-04-25T11:12:52.410353Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3080", vendor: 4318, device: 8710, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "530.41.03", backend: Vulkan }
2023-04-25T11:12:52.749768Z INFO gilrs_core::platform::platform::gamepad: Gamepad /dev/input/event23 (Bigben Interactive Revolution Unlimited Pro Controller) connected.
2023-04-25T11:12:52.771363Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 22.1.0 Manjaro Linux", kernel: "5.15.108-1-MANJARO", cpu: "AMD Ryzen 9 5950X 16-Core Processor", core
_count: "16", memory: "31.3 GiB" }
2023-04-25T11:12:52.826548Z INFO bevy_input::gamepad: Gamepad { id: 0 } Connected
2023-04-25T11:13:00.401158Z INFO bevy_window::system: No windows are open, exiting
https://user-images.githubusercontent.com/83026177/234262291-1466fbdc-52e0-479a-aefb-d73d0b897921.mp4
2023-04-25T11:13:00.402037Z INFO bevy_winit::system: Closing window 0v0
```
- Video demonstrating issue https://cdn.discordapp.com/attachments/691052431974465548/1100382205336891422/window_bug.mp4
Contributor guide
Assessment
This issue has not been assessed yet.