diff options
author | 2021-07-21 18:59:24 +0700 | |
---|---|---|
committer | 2021-07-21 18:59:24 +0700 | |
commit | 72b3bf95de3f11812b1541fe2ffea76a515aee79 (patch) | |
tree | 12e353e37b9a1313872edadd64207fe2c1e4ce9f /src/window/settings.rs | |
parent | 6793a7e00dc96425ae720309182ec8b03c076111 (diff) | |
download | iced-72b3bf95de3f11812b1541fe2ffea76a515aee79.tar.gz iced-72b3bf95de3f11812b1541fe2ffea76a515aee79.tar.bz2 iced-72b3bf95de3f11812b1541fe2ffea76a515aee79.zip |
Improve `window::Position` API
Diffstat (limited to '')
-rw-r--r-- | src/window/settings.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/window/settings.rs b/src/window/settings.rs index 59654edc..ec6c3071 100644 --- a/src/window/settings.rs +++ b/src/window/settings.rs @@ -1,4 +1,4 @@ -use crate::window::Icon; +use crate::window::{Icon, Position}; /// The window settings of an application. #[derive(Debug, Clone)] @@ -7,13 +7,7 @@ pub struct Settings { pub size: (u32, u32), /// The initial position of the window. - /// - /// When the decorations of the window are enabled, Windows 10 will add some - /// invisible padding to the window. This padding gets included in the - /// position. So if you have decorations enabled and want the window to be - /// at (0, 0) you would have to set the position to - /// `(PADDING_X, PADDING_Y)`. - pub position: (i32, i32), + pub position: Position, /// The minimum size of the window. pub min_size: Option<(u32, u32)>, @@ -41,7 +35,7 @@ impl Default for Settings { fn default() -> Settings { Settings { size: (1024, 768), - position: (100, 100), + position: Position::default(), min_size: None, max_size: None, resizable: true, @@ -58,7 +52,7 @@ impl From<Settings> for iced_winit::settings::Window { fn from(settings: Settings) -> Self { Self { size: settings.size, - position: settings.position, + position: iced_winit::Position::from(settings.position), min_size: settings.min_size, max_size: settings.max_size, resizable: settings.resizable, |