Remove platform-specific logic from iced

Make Window.platform_specific use iced_winit::settings::PlatformSpecific
This commit is contained in:
hatoo 2019-12-01 14:55:05 +09:00
parent 5077f1dc6a
commit a33f49ff4b
3 changed files with 2 additions and 47 deletions

View File

@ -1,15 +1,5 @@
//! Configure your application.
#[cfg(target_os = "windows")]
#[path = "windows.rs"]
pub mod platform;
#[cfg(not(target_os = "windows"))]
#[path = "not_windows.rs"]
pub mod platform;
pub use platform::PlatformSpecific;
/// The settings of an application.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct Settings {
@ -34,7 +24,7 @@ pub struct Window {
pub decorations: bool,
/// Platform specific Setting.
pub platform_specific: PlatformSpecific,
pub platform_specific: iced_winit::settings::PlatformSpecific,
}
impl Default for Window {
@ -56,7 +46,7 @@ impl From<Settings> for iced_winit::Settings {
size: settings.window.size,
resizable: settings.window.resizable,
decorations: settings.window.decorations,
platform_specific: settings.window.platform_specific.into(),
platform_specific: settings.window.platform_specific,
},
}
}

View File

@ -1,14 +0,0 @@
#![cfg(not(target_os = "windows"))]
//! Platform specific settings for not Windows.
/// The platform specific window settings of an application.
#[cfg(not(target_os = "windows"))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct PlatformSpecific {}
#[cfg(not(target_os = "windows"))]
impl From<PlatformSpecific> for iced_winit::settings::PlatformSpecific {
fn from(_: PlatformSpecific) -> iced_winit::settings::PlatformSpecific {
iced_winit::settings::PlatformSpecific {}
}
}

View File

@ -1,21 +0,0 @@
#![cfg(target_os = "windows")]
//! Platform specific settings for Windows.
/// The platform specific window settings of an application.
#[cfg(target_os = "windows")]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct PlatformSpecific {
/// Parent Window
pub parent: Option<winapi::shared::windef::HWND>,
}
#[cfg(target_os = "windows")]
impl From<PlatformSpecific> for iced_winit::settings::PlatformSpecific {
fn from(
platform_specific: PlatformSpecific,
) -> iced_winit::settings::PlatformSpecific {
iced_winit::settings::PlatformSpecific {
parent: platform_specific.parent,
}
}
}