From f0a857ddde7cf4739c1acde57e8df502e983a254 Mon Sep 17 00:00:00 2001 From: hatoo Date: Sat, 30 Nov 2019 20:38:32 +0900 Subject: Add `decorations` to Setting --- src/settings.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index 2556c51b..c9ece5ef 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -19,6 +19,9 @@ pub struct Window { /// Whether the window should be resizable or not. pub resizable: bool, + + /// Whether the window should have a border, a title bar, etc. + pub decorations: bool, } impl Default for Window { @@ -26,6 +29,7 @@ impl Default for Window { Window { size: (1024, 768), resizable: true, + decorations: true, } } } @@ -37,6 +41,7 @@ impl From for iced_winit::Settings { window: iced_winit::settings::Window { size: settings.window.size, resizable: settings.window.resizable, + decorations: settings.window.decorations, }, } } -- cgit From 5077f1dc6a6aca5ab84dd89296fb70489393cf57 Mon Sep 17 00:00:00 2001 From: hatoo Date: Sat, 30 Nov 2019 21:32:46 +0900 Subject: Add platform specific settings --- src/settings.rs | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 src/settings.rs (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs deleted file mode 100644 index c9ece5ef..00000000 --- a/src/settings.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! Configure your application. - -/// The settings of an application. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub struct Settings { - /// The [`Window`] settings. - /// - /// They will be ignored on the Web. - /// - /// [`Window`]: struct.Window.html - pub window: Window, -} - -/// The window settings of an application. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub struct Window { - /// The size of the window. - pub size: (u32, u32), - - /// Whether the window should be resizable or not. - pub resizable: bool, - - /// Whether the window should have a border, a title bar, etc. - pub decorations: bool, -} - -impl Default for Window { - fn default() -> Window { - Window { - size: (1024, 768), - resizable: true, - decorations: true, - } - } -} - -#[cfg(not(target_arch = "wasm32"))] -impl From for iced_winit::Settings { - fn from(settings: Settings) -> iced_winit::Settings { - iced_winit::Settings { - window: iced_winit::settings::Window { - size: settings.window.size, - resizable: settings.window.resizable, - decorations: settings.window.decorations, - }, - } - } -} -- cgit From a33f49ff4b1c11e467ec492a96e1e05e4d32d6aa Mon Sep 17 00:00:00 2001 From: hatoo Date: Sun, 1 Dec 2019 14:55:05 +0900 Subject: Remove platform-specific logic from iced Make Window.platform_specific use iced_winit::settings::PlatformSpecific --- src/settings.rs | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/settings.rs (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs new file mode 100644 index 00000000..a5820d87 --- /dev/null +++ b/src/settings.rs @@ -0,0 +1,53 @@ +//! Configure your application. + +/// The settings of an application. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub struct Settings { + /// The [`Window`] settings. + /// + /// They will be ignored on the Web. + /// + /// [`Window`]: struct.Window.html + pub window: Window, +} + +/// The window settings of an application. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Window { + /// The size of the window. + pub size: (u32, u32), + + /// Whether the window should be resizable or not. + pub resizable: bool, + + /// Whether the window should have a border, a title bar, etc. + pub decorations: bool, + + /// Platform specific Setting. + pub platform_specific: iced_winit::settings::PlatformSpecific, +} + +impl Default for Window { + fn default() -> Window { + Window { + size: (1024, 768), + resizable: true, + decorations: true, + platform_specific: Default::default(), + } + } +} + +#[cfg(not(target_arch = "wasm32"))] +impl From for iced_winit::Settings { + fn from(settings: Settings) -> iced_winit::Settings { + iced_winit::Settings { + window: iced_winit::settings::Window { + size: settings.window.size, + resizable: settings.window.resizable, + decorations: settings.window.decorations, + platform_specific: settings.window.platform_specific, + }, + } + } +} -- cgit From 97f1f3dcf4af8325fd24fbd70c13dbde307fce72 Mon Sep 17 00:00:00 2001 From: hatoo Date: Mon, 2 Dec 2019 21:57:07 +0900 Subject: Modify src/settings.rs to keep original API --- src/settings.rs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index a5820d87..bd13dcaa 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -19,12 +19,6 @@ pub struct Window { /// Whether the window should be resizable or not. pub resizable: bool, - - /// Whether the window should have a border, a title bar, etc. - pub decorations: bool, - - /// Platform specific Setting. - pub platform_specific: iced_winit::settings::PlatformSpecific, } impl Default for Window { @@ -32,8 +26,6 @@ impl Default for Window { Window { size: (1024, 768), resizable: true, - decorations: true, - platform_specific: Default::default(), } } } @@ -41,13 +33,9 @@ impl Default for Window { #[cfg(not(target_arch = "wasm32"))] impl From for iced_winit::Settings { fn from(settings: Settings) -> iced_winit::Settings { - iced_winit::Settings { - window: iced_winit::settings::Window { - size: settings.window.size, - resizable: settings.window.resizable, - decorations: settings.window.decorations, - platform_specific: settings.window.platform_specific, - }, - } + let mut iced_winit_settings = iced_winit::settings::Settings::default(); + iced_winit_settings.window.size = settings.window.size; + iced_winit_settings.window.resizable = settings.window.resizable; + iced_winit_settings } } -- cgit From 369ed9bc2e3c09666458bd0a0c0834a402239b3f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 3 Dec 2019 07:08:12 +0100 Subject: Add `decorations` to `settings::Window` --- src/settings.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/settings.rs') diff --git a/src/settings.rs b/src/settings.rs index bd13dcaa..62a1a614 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -19,6 +19,9 @@ pub struct Window { /// Whether the window should be resizable or not. pub resizable: bool, + + /// Whether the window should have a border, a title bar, etc. or not. + pub decorations: bool, } impl Default for Window { @@ -26,6 +29,7 @@ impl Default for Window { Window { size: (1024, 768), resizable: true, + decorations: true, } } } @@ -33,9 +37,13 @@ impl Default for Window { #[cfg(not(target_arch = "wasm32"))] impl From for iced_winit::Settings { fn from(settings: Settings) -> iced_winit::Settings { - let mut iced_winit_settings = iced_winit::settings::Settings::default(); - iced_winit_settings.window.size = settings.window.size; - iced_winit_settings.window.resizable = settings.window.resizable; - iced_winit_settings + iced_winit::Settings { + window: iced_winit::settings::Window { + size: settings.window.size, + resizable: settings.window.resizable, + decorations: settings.window.decorations, + platform_specific: Default::default(), + }, + } } } -- cgit