Adding os::macos.

Also implements platform_window() for cocoa.
This commit is contained in:
Johan Sköld 2016-01-16 15:12:21 -08:00
parent 3e0f6adec4
commit c71b14afb9
3 changed files with 22 additions and 1 deletions

View file

@ -690,7 +690,7 @@ impl Window {
#[inline]
pub fn platform_window(&self) -> *mut libc::c_void {
unimplemented!()
*self.window as *mut libc::c_void
}
#[inline]

19
src/os/macos.rs Normal file
View file

@ -0,0 +1,19 @@
#![cfg(target_os = "macos")]
use std::os::raw::c_void;
use Window;
/// Additional methods on `Window` that are specific to MacOS.
pub trait WindowExt {
/// Returns a pointer to the cocoa `NSWindow` that is used by this window.
///
/// The pointer will become invalid when the glutin `Window` is destroyed.
fn get_nswindow(&self) -> *mut c_void;
}
impl WindowExt for Window {
#[inline]
fn get_nswindow(&self) -> *mut c_void {
self.window.platform_window() as *mut c_void
}
}

View file

@ -2,8 +2,10 @@
//!
//! Contains the follow modules:
//!
//! - `macos`
//! - `unix`
//! - `windows`
//!
pub mod macos;
pub mod unix;
pub mod windows;