Skip to content

Commit

Permalink
Merge pull request #2627 from bbb651/more-window-settings
Browse files Browse the repository at this point in the history
Add `maximized` and `fullscreen` to `window::Settings`
  • Loading branch information
hecrj authored Jan 6, 2025
2 parents b156087 + dd08f98 commit 6343655
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/window/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions winit/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 6343655

Please sign in to comment.