Skip to content

Commit

Permalink
add haiku support (#88)
Browse files Browse the repository at this point in the history
* add haiku support

* run cargo fmt

* update note on BDirectWindow

Co-authored-by: Al Hoang <3811822-hoanga@users.noreply.gitlab.com>
  • Loading branch information
hoanga and Al Hoang authored Mar 29, 2022
1 parent f27cb2d commit 0aff15b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
28 changes: 28 additions & 0 deletions src/haiku.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use core::ffi::c_void;
use core::ptr;

/// Raw window handle for Haiku.
///
/// ## Construction
/// ```
/// # use raw_window_handle::HaikuHandle;
/// let mut handle = HaikuHandle::empty();
/// /* set fields */
/// ```
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct HaikuHandle {
/// A pointer to a BWindow object
pub b_window: *mut c_void,
/// A pointer to a BDirectWindow object that might be null
pub b_direct_window: *mut c_void,
}

impl HaikuHandle {
pub fn empty() -> Self {
Self {
b_window: ptr::null_mut(),
b_direct_window: ptr::null_mut(),
}
}
}
8 changes: 7 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![no_std]

#![cfg_attr(docsrs, feature(doc_cfg))]

//! Interoperability library for Rust Windowing applications.
Expand All @@ -25,6 +24,7 @@ extern crate alloc;

mod android;
mod appkit;
mod haiku;
mod redox;
mod uikit;
mod unix;
Expand All @@ -33,6 +33,7 @@ mod windows;

pub use android::AndroidNdkHandle;
pub use appkit::AppKitHandle;
pub use haiku::HaikuHandle;
pub use redox::OrbitalHandle;
pub use uikit::UiKitHandle;
pub use unix::{WaylandHandle, XcbHandle, XlibHandle};
Expand Down Expand Up @@ -154,4 +155,9 @@ pub enum RawWindowHandle {
/// ## Availability Hints
/// This variant is used on Android targets.
AndroidNdk(AndroidNdkHandle),
/// A raw window handle for Haiku.
///
/// ## Availability Hints
/// This variant is used on HaikuOS.
Haiku(HaikuHandle),
}

0 comments on commit 0aff15b

Please sign in to comment.