Skip to content

Commit

Permalink
WindowConfig min_size: replace Option<Size> with Size
Browse files Browse the repository at this point in the history
  • Loading branch information
colinfruit committed Nov 30, 2020
1 parent 1c2565d commit 0b87e4e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions druid/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct AppLauncher<T> {
/// It does not include anything related to app data.
pub struct WindowConfig {
pub(crate) size: Option<Size>,
pub(crate) min_size: Option<Size>,
pub(crate) min_size: Size,
pub(crate) position: Option<Point>,
pub(crate) resizable: Option<bool>,
pub(crate) show_titlebar: Option<bool>,
Expand Down Expand Up @@ -189,7 +189,7 @@ impl Default for WindowConfig {
fn default() -> Self {
WindowConfig {
size: None,
min_size: Some(WINDOW_MIN_SIZE),
min_size: WINDOW_MIN_SIZE,
position: None,
resizable: None,
show_titlebar: None,
Expand Down Expand Up @@ -233,7 +233,7 @@ impl WindowConfig {
/// [`window_size`]: #method.window_size
/// [display points]: struct.Scale.html
pub fn with_min_size(mut self, size: impl Into<Size>) -> Self {
self.min_size = Some(size.into());
self.min_size = size.into();
self
}

Expand Down Expand Up @@ -287,9 +287,6 @@ impl WindowConfig {
if let Some(size) = self.size {
builder.set_size(size);
}
if let Some(min_size) = self.min_size {
builder.set_min_size(min_size);
}

if let Some(position) = self.position {
builder.set_position(position);
Expand All @@ -302,6 +299,8 @@ impl WindowConfig {
if let Some(state) = self.state {
builder.set_window_state(state);
}

builder.set_min_size(self.min_size);
}

/// Apply this window configuration to the passed in WindowHandle
Expand Down

0 comments on commit 0b87e4e

Please sign in to comment.