Add window::Settings::fullscreen
Corresponds to `winit:🪟:WindowAttributes::with_fullscreen`.
Currently only allows to set `Fullscreen::Borderless(None)` meaning
borderless on the current monitor, exclusive fullscreen does not
make sense for a GUI and iced does not expose monitors yet.
This commit is contained in:
parent
13c649881e
commit
dd08f98f0e
2 changed files with 9 additions and 0 deletions
|
|
@ -37,6 +37,9 @@ pub struct Settings {
|
||||||
/// Whether the window should start maximized.
|
/// Whether the window should start maximized.
|
||||||
pub maximized: bool,
|
pub maximized: bool,
|
||||||
|
|
||||||
|
/// Whether the window should start fullscreen.
|
||||||
|
pub fullscreen: bool,
|
||||||
|
|
||||||
/// The initial position of the window.
|
/// The initial position of the window.
|
||||||
pub position: Position,
|
pub position: Position,
|
||||||
|
|
||||||
|
|
@ -83,6 +86,7 @@ impl Default for Settings {
|
||||||
Self {
|
Self {
|
||||||
size: Size::new(1024.0, 768.0),
|
size: Size::new(1024.0, 768.0),
|
||||||
maximized: false,
|
maximized: false,
|
||||||
|
fullscreen: false,
|
||||||
position: Position::default(),
|
position: Position::default(),
|
||||||
min_size: None,
|
min_size: None,
|
||||||
max_size: None,
|
max_size: None,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,11 @@ pub fn window_attributes(
|
||||||
height: settings.size.height,
|
height: settings.size.height,
|
||||||
})
|
})
|
||||||
.with_maximized(settings.maximized)
|
.with_maximized(settings.maximized)
|
||||||
|
.with_fullscreen(
|
||||||
|
settings
|
||||||
|
.fullscreen
|
||||||
|
.then_some(winit::window::Fullscreen::Borderless(None)),
|
||||||
|
)
|
||||||
.with_resizable(settings.resizable)
|
.with_resizable(settings.resizable)
|
||||||
.with_enabled_buttons(if settings.resizable {
|
.with_enabled_buttons(if settings.resizable {
|
||||||
winit::window::WindowButtons::all()
|
winit::window::WindowButtons::all()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue