X11 bug around fullscreen when app startup/init
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
0.7.0
## Relevant system information
- cargo 1.62.1
- rustc 1.62.1 (stable)
operating system:
Ubuntu 22.04 LTS (X11)
```ignore
winit::platform_impl::platform::x11::window: Guessed window scale factor: 1
```
```ignore
`AdapterInfo { name: "NVIDIA GeForce RTX 3080", vendor: 4318, device: 8714, device_type: DiscreteGpu, backend: Vulkan }`
```
## What you did
works:
```
use bevy::prelude::*;
use bevy::window::WindowMode;
fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(0.4, 0.4, 0.4)))
.insert_resource(WindowDescriptor {
mode: WindowMode::Windowed,
width: 0.0,
height: 0.0,
..Default::default()
})
.add_plugins(DefaultPlugins)
.add_system(fullscreeen)
.run();
}
fn fullscreeen(
input: Res>,
mut windows: ResMut,
) {
let window = windows
.get_primary_mut()
.unwrap();
if input.pressed(KeyCode::LAlt) && input.just_pressed(KeyCode::Return) {
if window.mode() == WindowMode::Windowed {
println!("Changing to fullscreen");
window.set_mode(WindowMode::Fullscreen);
} else {
println!("Changing to windowed");
window.set_mode(WindowMode::Windowed);
}
}
}
```
not working:
```
use bevy::prelude::*;
use bevy::window::WindowMode;
fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(0.4, 0.4, 0.4)))
.insert_resource(WindowDescriptor {
mode: WindowMode::Fullscreen,
width: 0.0,
height: 0.0,
..Default::default()
})
.add_plugins(DefaultPlugins)
.add_system(fullscreeen)
.run();
}
fn fullscreeen(
input: Res>,
mut windows: ResMut,
) {
let window = windows
.get_primary_mut()
.unwrap();
if input.pressed(KeyCode::LAlt) && input.just_pressed(KeyCode::Return) {
if window.mode() == WindowMode::Windowed {
println!("Changing to fullscreen");
window.set_mode(WindowMode::Fullscreen);
} else {
println!("Changing to windowed");
window.set_mode(WindowMode::Windowed);
}
}
}
```
## What went wrong
only changes are what mode app start in. **Fullscreen** or **Windowed**
if i run desktop in **x11** and try startup app with **Fullscreen** (from start) it crash.
```ignore
thread 'main' panicked at 'Error in Surface::configure: parent device is lost', /home/*****/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:214:9
```
if i run desktop in **Wayland** - it work fine.
if i run desktop in **x11** and startup app with "Windowed" mode. it work fine and can easy change to Fullscreen after...
sorry if my english is **bad**.
Contributor guide
Assessment
This issue has not been assessed yet.