Implement size_limits for winit
This commit is contained in:
parent
0299878508
commit
ca1469a6b2
2 changed files with 8 additions and 3 deletions
|
|
@ -123,6 +123,14 @@ pub(crate) fn iced_settings<App: Application>(
|
||||||
}
|
}
|
||||||
iced.window.decorations = !settings.client_decorations;
|
iced.window.decorations = !settings.client_decorations;
|
||||||
iced.window.size = settings.size;
|
iced.window.size = settings.size;
|
||||||
|
let min_size = settings.size_limits.min();
|
||||||
|
if min_size != iced::Size::ZERO {
|
||||||
|
iced.window.min_size = Some(min_size);
|
||||||
|
}
|
||||||
|
let max_size = settings.size_limits.max();
|
||||||
|
if max_size != iced::Size::INFINITY {
|
||||||
|
iced.window.max_size = Some(max_size);
|
||||||
|
}
|
||||||
iced.window.transparent = settings.transparent;
|
iced.window.transparent = settings.transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
//! Configure a new COSMIC application.
|
//! Configure a new COSMIC application.
|
||||||
|
|
||||||
use crate::{font, Theme};
|
use crate::{font, Theme};
|
||||||
#[cfg(feature = "wayland")]
|
|
||||||
use iced_core::layout::Limits;
|
use iced_core::layout::Limits;
|
||||||
use iced_core::Font;
|
use iced_core::Font;
|
||||||
|
|
||||||
|
|
@ -51,7 +50,6 @@ pub struct Settings {
|
||||||
pub(crate) size: iced::Size,
|
pub(crate) size: iced::Size,
|
||||||
|
|
||||||
/// Limitations of the window size
|
/// Limitations of the window size
|
||||||
#[cfg(feature = "wayland")]
|
|
||||||
pub(crate) size_limits: Limits,
|
pub(crate) size_limits: Limits,
|
||||||
|
|
||||||
/// The theme to apply to the application.
|
/// The theme to apply to the application.
|
||||||
|
|
@ -92,7 +90,6 @@ impl Default for Settings {
|
||||||
.and_then(|scale| scale.parse::<f32>().ok())
|
.and_then(|scale| scale.parse::<f32>().ok())
|
||||||
.unwrap_or(1.0),
|
.unwrap_or(1.0),
|
||||||
size: iced::Size::new(1024.0, 768.0),
|
size: iced::Size::new(1024.0, 768.0),
|
||||||
#[cfg(feature = "wayland")]
|
|
||||||
size_limits: Limits::NONE.min_height(1.0).min_width(1.0),
|
size_limits: Limits::NONE.min_height(1.0).min_width(1.0),
|
||||||
theme: crate::theme::system_preference(),
|
theme: crate::theme::system_preference(),
|
||||||
transparent: true,
|
transparent: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue