11use core:: ffi:: c_void;
2- use core:: num:: NonZeroIsize ;
32use core:: ptr:: NonNull ;
43
54use super :: DisplayHandle ;
@@ -51,9 +50,9 @@ impl DisplayHandle<'static> {
5150#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
5251pub struct Win32WindowHandle {
5352 /// A Win32 `HWND` handle.
54- pub hwnd : NonZeroIsize ,
53+ pub hwnd : NonNull < c_void > ,
5554 /// The `GWLP_HINSTANCE` associated with this type's `HWND`.
56- pub hinstance : Option < NonZeroIsize > ,
55+ pub hinstance : Option < NonNull < c_void > > ,
5756}
5857
5958impl Win32WindowHandle {
@@ -67,20 +66,21 @@ impl Win32WindowHandle {
6766 /// # Example
6867 ///
6968 /// ```
70- /// # use core::num::NonZeroIsize;
69+ /// # use core::ffi::c_void;
70+ /// # use core::ptr::NonNull;
7171 /// # use raw_window_handle::Win32WindowHandle;
72- /// # struct HWND(isize );
72+ /// # struct HWND(*mut c_void );
7373 /// #
7474 /// let window: HWND;
75- /// # window = HWND(1);
76- /// let mut handle = Win32WindowHandle::new(NonZeroIsize ::new(window.0).unwrap());
75+ /// # window = HWND(1 as *mut c_void );
76+ /// let mut handle = Win32WindowHandle::new(NonNull ::new(window.0).unwrap());
7777 /// // Optionally set the GWLP_HINSTANCE.
7878 /// # #[cfg(only_for_showcase)]
79- /// let hinstance = NonZeroIsize ::new(unsafe { GetWindowLongPtrW(window, GWLP_HINSTANCE) }).unwrap();
79+ /// let hinstance = NonNull ::new(unsafe { GetWindowLongPtrW(window, GWLP_HINSTANCE) }).unwrap();
8080 /// # let hinstance = None;
8181 /// handle.hinstance = hinstance;
8282 /// ```
83- pub fn new ( hwnd : NonZeroIsize ) -> Self {
83+ pub fn new ( hwnd : NonNull < c_void > ) -> Self {
8484 Self {
8585 hwnd,
8686 hinstance : None ,
0 commit comments