use core::ffi::{c_int, c_ulong, c_void};
use core::num::NonZeroU32;
use core::ptr::NonNull;
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct XlibDisplayHandle {
pub display: Option<NonNull<c_void>>,
pub screen: c_int,
}
impl XlibDisplayHandle {
pub fn new(display: Option<NonNull<c_void>>, screen: c_int) -> Self {
Self { display, screen }
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct XlibWindowHandle {
pub window: c_ulong,
pub visual_id: c_ulong,
}
impl XlibWindowHandle {
pub fn new(window: c_ulong) -> Self {
Self {
window,
visual_id: 0,
}
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct XcbDisplayHandle {
pub connection: Option<NonNull<c_void>>,
pub screen: c_int,
}
impl XcbDisplayHandle {
pub fn new(connection: Option<NonNull<c_void>>, screen: c_int) -> Self {
Self { connection, screen }
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct XcbWindowHandle {
pub window: NonZeroU32, pub visual_id: Option<NonZeroU32>,
}
impl XcbWindowHandle {
pub fn new(window: NonZeroU32) -> Self {
Self {
window,
visual_id: None,
}
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct WaylandDisplayHandle {
pub display: NonNull<c_void>,
}
impl WaylandDisplayHandle {
pub fn new(display: NonNull<c_void>) -> Self {
Self { display }
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct WaylandWindowHandle {
pub surface: NonNull<c_void>,
}
impl WaylandWindowHandle {
pub fn new(surface: NonNull<c_void>) -> Self {
Self { surface }
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct DrmDisplayHandle {
pub fd: i32,
}
impl DrmDisplayHandle {
pub fn new(fd: i32) -> Self {
Self { fd }
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct DrmWindowHandle {
pub plane: u32,
}
impl DrmWindowHandle {
pub fn new(plane: u32) -> Self {
Self { plane }
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct GbmDisplayHandle {
pub gbm_device: NonNull<c_void>,
}
impl GbmDisplayHandle {
pub fn new(gbm_device: NonNull<c_void>) -> Self {
Self { gbm_device }
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct GbmWindowHandle {
pub gbm_surface: NonNull<c_void>,
}
impl GbmWindowHandle {
pub fn new(gbm_surface: NonNull<c_void>) -> Self {
Self { gbm_surface }
}
}