bevyengine / bevyengine/bevy

WindowMode::Windowed to WindowMode::Fullscreen when resizable is false (ubuntu x11)

Open
#5,487 8 comments 0 reactions 0 assignees View on GitHub
A-Windowing C-Bug S-Ready-For-Implementation
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
work:
```
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 {
resizable: true,
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 {
resizable: false,
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);
}
}
}
```
## What went wrong
only change between them is **resizable** **true** or **false**.
if false app will jump around between two places on my **screen**. (if you will see what i mean with jump https://www.youtube.com/watch?v=Lplo9Nq3WVw)
if true **fullscreen** work fine

## What you expected to happen
i expected app resizable icons and user not can resize app longer - if **resizable** is **false**. i expected app to easy change to **fullscreen** - not funny jumps ;-)

sorry if my english is bad.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.