forked from rust-windowing/raw-window-handle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows.rs
49 lines (45 loc) · 1.11 KB
/
windows.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use core::ffi::c_void;
use core::ptr::NonNull;
/// Raw window handle for Windows.
///
/// ## Construction
/// ```
/// # use raw_window_handle::windows::WindowsHandle;
/// let mut handle = WindowsHandle::empty();
/// /* set fields */
/// ```
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct WindowsHandle {
/// A Win32 HWND handle.
pub hwnd: Option<NonNull<c_void>>,
/// The HINSTANCE associated with this type's HWND.
pub hinstance: Option<NonNull<c_void>>,
}
impl WindowsHandle {
pub fn empty() -> WindowsHandle {
WindowsHandle {
hwnd: None,
hinstance: None,
}
}
}
/// 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<NonNull<c_void>>,
}
impl WinRTHandle {
pub fn empty() -> WinRTHandle {
WinRTHandle { core_window: None }
}
}