2015-04-24 09:51:23 +02:00
|
|
|
#![cfg(target_os = "macos")]
|
|
|
|
|
|
2017-02-03 23:05:57 +11:00
|
|
|
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};
|
2017-02-03 23:05:57 +11:00
|
|
|
pub use self::window::{Id as WindowId, PlatformSpecificWindowBuilderAttributes, Window};
|
2016-10-31 17:08:55 +01:00
|
|
|
|
2017-02-03 23:05:57 +11:00
|
|
|
use {CreationError};
|
2016-10-31 17:08:55 +01:00
|
|
|
|
2017-02-03 23:05:57 +11:00
|
|
|
pub struct Window2 {
|
|
|
|
|
pub window: ::std::sync::Arc<Window>,
|
2016-10-31 17:08:55 +01:00
|
|
|
}
|
|
|
|
|
|
2017-02-03 23:05:57 +11:00
|
|
|
impl ::std::ops::Deref for Window2 {
|
|
|
|
|
type Target = Window;
|
2016-10-31 17:08:55 +01:00
|
|
|
#[inline]
|
2017-02-03 23:05:57 +11:00
|
|
|
fn deref(&self) -> &Window {
|
|
|
|
|
&*self.window
|
2016-10-31 17:08:55 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-03 23:05:57 +11:00
|
|
|
impl Window2 {
|
2016-10-31 17:08:55 +01:00
|
|
|
|
2017-02-03 23:05:57 +11: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
|
|
|
{
|
2017-02-03 23:05:57 +11: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)));
|
2017-03-19 18:19:24 +11:00
|
|
|
let weak_window = ::std::sync::Arc::downgrade(&window);
|
|
|
|
|
events_loop.windows.lock().unwrap().push(weak_window);
|
2017-02-03 23:05:57 +11:00
|
|
|
Ok(Window2 { window: window })
|
2016-10-31 17:08:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-03 23:05:57 +11:00
|
|
|
mod events_loop;
|
|
|
|
|
mod monitor;
|
|
|
|
|
mod window;
|