From dd08f98f0ebb6fb59801bfa030a56267e45a509b Mon Sep 17 00:00:00 2001 From: bbb651 Date: Fri, 4 Oct 2024 21:20:43 +0300 Subject: [PATCH] Add `window::Settings::fullscreen` 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. --- core/src/window/settings.rs | 4 ++++ winit/src/conversion.rs | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/core/src/window/settings.rs b/core/src/window/settings.rs index 13822e8200..e87fcc83dc 100644 --- a/core/src/window/settings.rs +++ b/core/src/window/settings.rs @@ -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, @@ -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, diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index e0b0569b16..e454c20844 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -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()