mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 23:01:30 +11:00
Merge pull request #707 from rhoot/nswindow
Adding os::macos for accessing the underlying NSWindow
This commit is contained in:
commit
0297efb741
|
@ -690,7 +690,7 @@ impl Window {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn platform_window(&self) -> *mut libc::c_void {
|
pub fn platform_window(&self) -> *mut libc::c_void {
|
||||||
unimplemented!()
|
*self.window as *mut libc::c_void
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
19
src/os/macos.rs
Normal file
19
src/os/macos.rs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,10 @@
|
||||||
//!
|
//!
|
||||||
//! Contains the follow modules:
|
//! Contains the follow modules:
|
||||||
//!
|
//!
|
||||||
|
//! - `macos`
|
||||||
//! - `unix`
|
//! - `unix`
|
||||||
//! - `windows`
|
//! - `windows`
|
||||||
//!
|
//!
|
||||||
|
pub mod macos;
|
||||||
pub mod unix;
|
pub mod unix;
|
||||||
pub mod windows;
|
pub mod windows;
|
||||||
|
|
Loading…
Reference in a new issue