1 | use core::ffi::c_void;
|
2 | use core::ptr::NonNull;
|
3 |
|
4 | /// Raw display handle for Haiku.
|
5 | #[non_exhaustive ]
|
6 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
7 | pub struct HaikuDisplayHandle {}
|
8 |
|
9 | impl HaikuDisplayHandle {
|
10 | /// Create a new empty display handle.
|
11 | ///
|
12 | ///
|
13 | /// # Example
|
14 | ///
|
15 | /// ```
|
16 | /// # use raw_window_handle::HaikuDisplayHandle;
|
17 | /// let handle = HaikuDisplayHandle::new();
|
18 | /// ```
|
19 | pub fn new() -> Self {
|
20 | Self {}
|
21 | }
|
22 | }
|
23 |
|
24 | /// Raw window handle for Haiku.
|
25 | #[non_exhaustive ]
|
26 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
27 | pub struct HaikuWindowHandle {
|
28 | /// A pointer to a BWindow object
|
29 | pub b_window: NonNull<c_void>,
|
30 | /// A pointer to a BDirectWindow object that might be null
|
31 | pub b_direct_window: Option<NonNull<c_void>>,
|
32 | }
|
33 |
|
34 | impl HaikuWindowHandle {
|
35 | /// Create a new handle to a window.
|
36 | ///
|
37 | ///
|
38 | /// # Example
|
39 | ///
|
40 | /// ```
|
41 | /// # use core::ptr::NonNull;
|
42 | /// # use raw_window_handle::HaikuWindowHandle;
|
43 | /// # type BWindow = ();
|
44 | /// #
|
45 | /// let b_window: NonNull<BWindow>;
|
46 | /// # b_window = NonNull::from(&());
|
47 | /// let mut handle = HaikuWindowHandle::new(b_window.cast());
|
48 | /// // Optionally set `b_direct_window`.
|
49 | /// handle.b_direct_window = None;
|
50 | /// ```
|
51 | pub fn new(b_window: NonNull<c_void>) -> Self {
|
52 | Self {
|
53 | b_window,
|
54 | b_direct_window: None,
|
55 | }
|
56 | }
|
57 | }
|
58 | |