Added proper access to HasRawWindowHandle

This commit is contained in:
Daniel Collin 2019-12-27 13:26:41 +01:00
parent cf64bf872b
commit 745cfec45e

View file

@ -4,6 +4,8 @@
//! //!
#![deny(missing_debug_implementations)] #![deny(missing_debug_implementations)]
extern crate raw_window_handle;
use std::fmt; use std::fmt;
use std::os::raw; use std::os::raw;
@ -91,6 +93,7 @@ pub trait InputCallback {
mod error; mod error;
pub use self::error::Error; pub use self::error::Error;
pub type Result<T> = std::result::Result<T, Error>; pub type Result<T> = std::result::Result<T, Error>;
pub use raw_window_handle::HasRawWindowHandle as HasRawWindowHandle;
mod key; mod key;
pub use key::Key; pub use key::Key;
@ -134,6 +137,12 @@ impl fmt::Debug for Window {
} }
} }
unsafe impl raw_window_handle::HasRawWindowHandle for Window {
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
self.0.raw_window_handle()
}
}
pub fn clamp<T: PartialOrd>(low: T, value: T, high: T) -> T { pub fn clamp<T: PartialOrd>(low: T, value: T, high: T) -> T {
if value < low { if value < low {
low low