From 82fd05f40b89aa66aae3a1b2a56138cab8556010 Mon Sep 17 00:00:00 2001 From: Nathan Voglsam Date: Wed, 10 Feb 2021 20:29:24 +1100 Subject: [PATCH 1/2] Add WinRT core window handle --- src/lib.rs | 4 ++++ src/windows.rs | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 49b0fca..85ac5fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -189,6 +189,10 @@ pub enum RawWindowHandle { #[cfg_attr(not(feature = "nightly-docs"), cfg(target_os = "windows"))] Windows(windows::WindowsHandle), + #[cfg_attr(feature = "nightly-docs", doc(cfg(target_os = "windows")))] + #[cfg_attr(not(feature = "nightly-docs"), cfg(target_os = "windows"))] + WinRT(windows::WinRTHandle), + #[cfg_attr(feature = "nightly-docs", doc(cfg(target_arch = "wasm32")))] #[cfg_attr(not(feature = "nightly-docs"), cfg(target_arch = "wasm32"))] Web(web::WebHandle), diff --git a/src/windows.rs b/src/windows.rs index f297872..cbb2eb8 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -26,3 +26,26 @@ impl WindowsHandle { } } } + +/// Raw window handle for WinRT. +/// +/// ## Construction +/// ``` +/// # use raw_window_handle::windows::WinRTHandle; +/// let mut handle = WinRTHandle::empty(); +/// /* set fields */ +/// ``` +#[non_exhaustive] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct WinRTHandle { + /// A WinRT CoreWindow handle. + pub core_window: Option>, +} + +impl WinRTHandle { + pub fn empty() -> WinRTHandle { + WinRTHandle { + core_window: None, + } + } +} From a437a902bb60da86b6b1552c426dcb80647c8b98 Mon Sep 17 00:00:00 2001 From: Nathan Voglsam Date: Wed, 10 Feb 2021 21:00:20 +1100 Subject: [PATCH 2/2] cargo fmt --- src/windows.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/windows.rs b/src/windows.rs index cbb2eb8..20c9af6 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -44,8 +44,6 @@ pub struct WinRTHandle { impl WinRTHandle { pub fn empty() -> WinRTHandle { - WinRTHandle { - core_window: None, - } + WinRTHandle { core_window: None } } }