Remove api_transition macro (#279)

* Remove api_transition macro

* Rename Window2 to Window

* Try fix X11 code
This commit is contained in:
tomaka 2017-09-06 17:32:24 +02:00 committed by GitHub
parent 0ada6c15ea
commit 342d5d8587
13 changed files with 97 additions and 247 deletions

View file

@ -2,7 +2,7 @@
pub use self::events_loop::{EventsLoop, Proxy as EventsLoopProxy};
pub use self::monitor::MonitorId;
pub use self::window::{Id as WindowId, PlatformSpecificWindowBuilderAttributes, Window};
pub use self::window::{Id as WindowId, PlatformSpecificWindowBuilderAttributes, Window2};
use std::sync::Arc;
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -10,29 +10,29 @@ pub struct DeviceId;
use {CreationError};
pub struct Window2 {
pub window: Arc<Window>,
pub struct Window {
pub window: Arc<Window2>,
}
impl ::std::ops::Deref for Window2 {
type Target = Window;
impl ::std::ops::Deref for Window {
type Target = Window2;
#[inline]
fn deref(&self) -> &Window {
fn deref(&self) -> &Window2 {
&*self.window
}
}
impl Window2 {
impl Window {
pub fn new(events_loop: &EventsLoop,
attributes: &::WindowAttributes,
pl_attribs: &PlatformSpecificWindowBuilderAttributes) -> Result<Self, CreationError>
{
let weak_shared = Arc::downgrade(&events_loop.shared);
let window = Arc::new(try!(Window::new(weak_shared, attributes, pl_attribs)));
let window = Arc::new(try!(Window2::new(weak_shared, attributes, pl_attribs)));
let weak_window = Arc::downgrade(&window);
events_loop.shared.windows.lock().unwrap().push(weak_window);
Ok(Window2 { window: window })
Ok(Window { window: window })
}
}