winit/src/platform/macos/mod.rs

39 lines
1.1 KiB
Rust
Raw Normal View History

2015-04-24 09:51:23 +02:00
#![cfg(target_os = "macos")]
pub use self::events_loop::EventsLoop;
2016-10-31 17:08:55 +01:00
pub use self::monitor::{MonitorId, get_available_monitors, get_primary_monitor};
pub use self::window::{Id as WindowId, PlatformSpecificWindowBuilderAttributes, Window};
2016-10-31 17:08:55 +01:00
use {CreationError};
2016-10-31 17:08:55 +01:00
pub struct Window2 {
pub window: ::std::sync::Arc<Window>,
2016-10-31 17:08:55 +01:00
}
impl ::std::ops::Deref for Window2 {
type Target = Window;
2016-10-31 17:08:55 +01:00
#[inline]
fn deref(&self) -> &Window {
&*self.window
2016-10-31 17:08:55 +01:00
}
}
impl Window2 {
2016-10-31 17:08:55 +01:00
pub fn new(events_loop: ::std::sync::Arc<EventsLoop>,
attributes: &::WindowAttributes,
pl_attribs: &PlatformSpecificWindowBuilderAttributes) -> Result<Self, CreationError>
2016-10-31 17:08:55 +01:00
{
let weak_events_loop = ::std::sync::Arc::downgrade(&events_loop);
let window = ::std::sync::Arc::new(try!(Window::new(weak_events_loop, attributes, pl_attribs)));
let weak_window = ::std::sync::Arc::downgrade(&window);
events_loop.windows.lock().unwrap().push(weak_window);
Ok(Window2 { window: window })
2016-10-31 17:08:55 +01:00
}
}
mod events_loop;
mod monitor;
mod window;