aboutsummaryrefslogtreecommitdiffstats
path: root/src/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/os')
-rw-r--r--src/os/macos.rs19
-rw-r--r--src/os/mod.rs2
2 files changed, 21 insertions, 0 deletions
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;