diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2016-01-17 16:51:46 +0100 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2016-01-17 16:51:46 +0100 |
commit | 0297efb7411c9d45aacebd1e3f52601d7b4fa961 (patch) | |
tree | 8d8544fcf14fcff684e909e2d2850641c56e159c /src | |
parent | 3e0f6adec42428b42fded2e4f5d659b5e6d21358 (diff) | |
parent | c71b14afb9709aef36477a3eab0a816a3f972cd8 (diff) | |
download | glutin-0297efb7411c9d45aacebd1e3f52601d7b4fa961.tar.gz glutin-0297efb7411c9d45aacebd1e3f52601d7b4fa961.zip |
Merge pull request #707 from rhoot/nswindow
Adding os::macos for accessing the underlying NSWindow
Diffstat (limited to 'src')
-rw-r--r-- | src/api/cocoa/mod.rs | 2 | ||||
-rw-r--r-- | src/os/macos.rs | 19 | ||||
-rw-r--r-- | src/os/mod.rs | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index a720a51..2fc1baf 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -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] diff --git a/src/os/macos.rs b/src/os/macos.rs new file mode 100644 index 0000000..16ffe33 --- /dev/null +++ b/src/os/macos.rs @@ -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 + } +} diff --git a/src/os/mod.rs b/src/os/mod.rs index 251a8d4..04e82c2 100644 --- a/src/os/mod.rs +++ b/src/os/mod.rs @@ -2,8 +2,10 @@ //! //! Contains the follow modules: //! +//! - `macos` //! - `unix` //! - `windows` //! +pub mod macos; pub mod unix; pub mod windows; |