Remove platform-specific logic from iced
Make Window.platform_specific use iced_winit::settings::PlatformSpecific
This commit is contained in:
parent
5077f1dc6a
commit
a33f49ff4b
3 changed files with 2 additions and 47 deletions
|
|
@ -1,15 +1,5 @@
|
||||||
//! Configure your application.
|
//! 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.
|
/// The settings of an application.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
|
|
@ -34,7 +24,7 @@ pub struct Window {
|
||||||
pub decorations: bool,
|
pub decorations: bool,
|
||||||
|
|
||||||
/// Platform specific Setting.
|
/// Platform specific Setting.
|
||||||
pub platform_specific: PlatformSpecific,
|
pub platform_specific: iced_winit::settings::PlatformSpecific,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Window {
|
impl Default for Window {
|
||||||
|
|
@ -56,7 +46,7 @@ impl From<Settings> for iced_winit::Settings {
|
||||||
size: settings.window.size,
|
size: settings.window.size,
|
||||||
resizable: settings.window.resizable,
|
resizable: settings.window.resizable,
|
||||||
decorations: settings.window.decorations,
|
decorations: settings.window.decorations,
|
||||||
platform_specific: settings.window.platform_specific.into(),
|
platform_specific: settings.window.platform_specific,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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 {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue