summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor <hector@hecrj.dev>2025-01-06 23:05:32 +0100
committerLibravatar GitHub <noreply@github.com>2025-01-06 23:05:32 +0100
commit634365564ea2bb2284561e8d300cf77a6f7db565 (patch)
treed9478965bbcb80632c6e5c2891036b616b3b8682
parentb156087fcf10011b2ee53c74198ba9fc443a1caa (diff)
parentdd08f98f0ebb6fb59801bfa030a56267e45a509b (diff)
downloadiced-634365564ea2bb2284561e8d300cf77a6f7db565.tar.gz
iced-634365564ea2bb2284561e8d300cf77a6f7db565.tar.bz2
iced-634365564ea2bb2284561e8d300cf77a6f7db565.zip
Merge pull request #2627 from bbb651/more-window-settings
Add `maximized` and `fullscreen` to `window::Settings`
-rw-r--r--core/src/window/settings.rs8
-rw-r--r--winit/src/conversion.rs6
2 files changed, 14 insertions, 0 deletions
diff --git a/core/src/window/settings.rs b/core/src/window/settings.rs
index c1f36a6c..9432eaaa 100644
--- a/core/src/window/settings.rs
+++ b/core/src/window/settings.rs
@@ -35,6 +35,12 @@ pub struct Settings {
/// The initial logical dimensions of the window.
pub size: Size,
+ /// 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,
@@ -80,6 +86,8 @@ impl Default for Settings {
fn default() -> Self {
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 8e6f7aae..01c6abc8 100644
--- a/winit/src/conversion.rs
+++ b/winit/src/conversion.rs
@@ -23,6 +23,12 @@ pub fn window_attributes(
width: settings.size.width,
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()