2015-04-24 09:51:23 +02:00
|
|
|
#![cfg(target_os = "macos")]
|
|
|
|
|
|
2019-02-05 10:30:33 -05:00
|
|
|
pub use self::event_loop::{EventLoop, Proxy as EventLoopProxy};
|
|
|
|
|
pub use self::monitor::MonitorHandle;
|
2017-09-06 17:32:24 +02:00
|
|
|
pub use self::window::{Id as WindowId, PlatformSpecificWindowBuilderAttributes, Window2};
|
2017-06-09 22:13:30 +10:00
|
|
|
use std::sync::Arc;
|
2016-10-31 17:08:55 +01:00
|
|
|
|
2017-04-22 13:52:35 -07:00
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
|
|
|
pub struct DeviceId;
|
|
|
|
|
|
2018-12-21 09:51:48 -07:00
|
|
|
impl DeviceId {
|
|
|
|
|
pub unsafe fn dummy() -> Self {
|
|
|
|
|
DeviceId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-03 23:05:57 +11:00
|
|
|
use {CreationError};
|
2016-10-31 17:08:55 +01:00
|
|
|
|
2017-09-06 17:32:24 +02:00
|
|
|
pub struct Window {
|
|
|
|
|
pub window: Arc<Window2>,
|
2016-10-31 17:08:55 +01:00
|
|
|
}
|
|
|
|
|
|
2017-09-06 17:32:24 +02:00
|
|
|
impl ::std::ops::Deref for Window {
|
|
|
|
|
type Target = Window2;
|
2016-10-31 17:08:55 +01:00
|
|
|
#[inline]
|
2017-09-06 17:32:24 +02:00
|
|
|
fn deref(&self) -> &Window2 {
|
2017-02-03 23:05:57 +11:00
|
|
|
&*self.window
|
2016-10-31 17:08:55 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-06 17:32:24 +02:00
|
|
|
impl Window {
|
2016-10-31 17:08:55 +01:00
|
|
|
|
2019-02-05 10:30:33 -05:00
|
|
|
pub fn new(event_loop: &EventLoop,
|
2018-05-07 17:36:21 -04:00
|
|
|
attributes: ::WindowAttributes,
|
|
|
|
|
pl_attribs: PlatformSpecificWindowBuilderAttributes) -> Result<Self, CreationError>
|
2016-10-31 17:08:55 +01:00
|
|
|
{
|
2019-02-05 10:30:33 -05:00
|
|
|
let weak_shared = Arc::downgrade(&event_loop.shared);
|
2017-09-06 17:32:24 +02:00
|
|
|
let window = Arc::new(try!(Window2::new(weak_shared, attributes, pl_attribs)));
|
2017-06-09 22:13:30 +10:00
|
|
|
let weak_window = Arc::downgrade(&window);
|
2019-02-05 10:30:33 -05:00
|
|
|
event_loop.shared.windows.lock().unwrap().push(weak_window);
|
2017-09-06 17:32:24 +02:00
|
|
|
Ok(Window { window: window })
|
2016-10-31 17:08:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-05 10:30:33 -05:00
|
|
|
mod event_loop;
|
2018-05-17 21:28:30 -04:00
|
|
|
mod ffi;
|
2017-02-03 23:05:57 +11:00
|
|
|
mod monitor;
|
2018-05-17 21:28:30 -04:00
|
|
|
mod util;
|
|
|
|
|
mod view;
|
2017-02-03 23:05:57 +11:00
|
|
|
mod window;
|