From c71b14afb9709aef36477a3eab0a816a3f972cd8 Mon Sep 17 00:00:00 2001 From: Johan Sköld Date: Sat, 16 Jan 2016 15:12:21 -0800 Subject: Adding os::macos. Also implements platform_window() for cocoa. --- src/os/macos.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/os/macos.rs (limited to 'src/os/macos.rs') 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 + } +} -- cgit v1.2.3