Skip to content

Commit

Permalink
Add window::Settings::fullscreen
Browse files Browse the repository at this point in the history
Corresponds to `winit::window::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.
  • Loading branch information
bbb651 committed Oct 4, 2024
1 parent 13c6498 commit dd08f98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/window/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub struct Settings {
/// Whether the window should start maximized.
pub maximized: bool,

/// Whether the window should start fullscreen.
pub fullscreen: bool,

/// The initial position of the window.
pub position: Position,

Expand Down Expand Up @@ -83,6 +86,7 @@ impl Default for Settings {
Self {
size: Size::new(1024.0, 768.0),
maximized: false,
fullscreen: false,
position: Position::default(),
min_size: None,
max_size: None,
Expand Down
5 changes: 5 additions & 0 deletions winit/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ pub fn window_attributes(
height: settings.size.height,
})
.with_maximized(settings.maximized)
.with_fullscreen(
settings
.fullscreen
.then_some(winit::window::Fullscreen::Borderless(None)),
)
.with_resizable(settings.resizable)
.with_enabled_buttons(if settings.resizable {
winit::window::WindowButtons::all()
Expand Down

0 comments on commit dd08f98

Please sign in to comment.