1 | use core::ffi::c_void;
|
2 | use core::ptr::NonNull;
|
3 |
|
4 | /// Raw display handle for Android.
|
5 | #[non_exhaustive ]
|
6 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
7 | pub struct AndroidDisplayHandle {}
|
8 |
|
9 | impl AndroidDisplayHandle {
|
10 | /// Create a new empty display handle.
|
11 | ///
|
12 | ///
|
13 | /// # Example
|
14 | ///
|
15 | /// ```
|
16 | /// # use raw_window_handle::AndroidDisplayHandle;
|
17 | /// let handle = AndroidDisplayHandle::new();
|
18 | /// ```
|
19 | pub fn new() -> Self {
|
20 | Self {}
|
21 | }
|
22 | }
|
23 |
|
24 | /// Raw window handle for Android NDK.
|
25 | #[non_exhaustive ]
|
26 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
27 | pub struct AndroidNdkWindowHandle {
|
28 | /// A pointer to an `ANativeWindow`.
|
29 | pub a_native_window: NonNull<c_void>,
|
30 | }
|
31 |
|
32 | impl AndroidNdkWindowHandle {
|
33 | /// Create a new handle to an `ANativeWindow`.
|
34 | ///
|
35 | ///
|
36 | /// # Example
|
37 | ///
|
38 | /// ```
|
39 | /// # use core::ptr::NonNull;
|
40 | /// # use raw_window_handle::AndroidNdkWindowHandle;
|
41 | /// # type ANativeWindow = ();
|
42 | /// #
|
43 | /// let ptr: NonNull<ANativeWindow>;
|
44 | /// # ptr = NonNull::from(&());
|
45 | /// let handle = AndroidNdkWindowHandle::new(ptr.cast());
|
46 | /// ```
|
47 | pub fn new(a_native_window: NonNull<c_void>) -> Self {
|
48 | Self { a_native_window }
|
49 | }
|
50 | }
|
51 | |