Fix compilation errors

This commit is contained in:
Ryan Goldstein 2019-09-24 19:39:13 -04:00
parent 3e8669ea7f
commit 6732fa731d
5 changed files with 54 additions and 8 deletions

View file

@ -25,7 +25,7 @@ libc = "0.2"
log = "0.4" log = "0.4"
serde = { version = "1", optional = true, features = ["serde_derive"] } serde = { version = "1", optional = true, features = ["serde_derive"] }
derivative = "1.0.2" derivative = "1.0.2"
raw-window-handle = "0.1" raw-window-handle = { git = "https://github.com/ryanisaacg/raw-window-handle", branch = "add-web-support" }
[dev-dependencies] [dev-dependencies]
image = "0.21" image = "0.21"

View file

@ -2,8 +2,7 @@ use super::runner;
use crate::event::Event; use crate::event::Event;
use crate::event_loop::EventLoopClosed; use crate::event_loop::EventLoopClosed;
#[derive(Clone)] pub struct Proxy<T: 'static>{
pub struct Proxy<T: 'static> {
runner: runner::Shared<T>, runner: runner::Shared<T>,
} }
@ -17,3 +16,11 @@ impl<T: 'static> Proxy<T> {
Ok(()) Ok(())
} }
} }
impl<T: 'static> Clone for Proxy<T> {
fn clone(&self) -> Self {
Proxy {
runner: self.runner.clone()
}
}
}

View file

@ -21,7 +21,9 @@ pub use self::error::OsError;
pub use self::event_loop::{ pub use self::event_loop::{
EventLoop, Proxy as EventLoopProxy, WindowTarget as EventLoopWindowTarget, EventLoop, Proxy as EventLoopProxy, WindowTarget as EventLoopWindowTarget,
}; };
pub use self::monitor::Handle as MonitorHandle; pub use self::monitor::{
Handle as MonitorHandle, Mode as VideoMode
};
pub use self::window::{ pub use self::window::{
Id as WindowId, PlatformSpecificBuilderAttributes as PlatformSpecificWindowBuilderAttributes, Id as WindowId, PlatformSpecificBuilderAttributes as PlatformSpecificWindowBuilderAttributes,
Window, Window,

View file

@ -1,5 +1,5 @@
use crate::dpi::{PhysicalPosition, PhysicalSize}; use crate::dpi::{PhysicalPosition, PhysicalSize};
use crate::monitor::VideoMode; use crate::monitor::{MonitorHandle, VideoMode};
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Handle; pub struct Handle;
@ -26,3 +26,28 @@ impl Handle {
std::iter::empty() std::iter::empty()
} }
} }
#[derive(Derivative)]
#[derivative(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Mode;
impl Mode {
pub fn size(&self) -> PhysicalSize {
unimplemented!();
}
pub fn bit_depth(&self) -> u16 {
unimplemented!();
}
pub fn refresh_rate(&self) -> u16 {
32
}
pub fn monitor(&self) -> MonitorHandle {
MonitorHandle {
inner: Handle
}
}
}

View file

@ -2,7 +2,9 @@ use crate::dpi::{LogicalPosition, LogicalSize};
use crate::error::{ExternalError, NotSupportedError, OsError as RootOE}; use crate::error::{ExternalError, NotSupportedError, OsError as RootOE};
use crate::icon::Icon; use crate::icon::Icon;
use crate::monitor::MonitorHandle as RootMH; use crate::monitor::MonitorHandle as RootMH;
use crate::window::{CursorIcon, WindowAttributes, WindowId as RootWI}; use crate::window::{CursorIcon, Fullscreen, WindowAttributes, WindowId as RootWI};
use raw_window_handle::{RawWindowHandle, web::WebHandle};
use super::{backend, monitor, EventLoopWindowTarget}; use super::{backend, monitor, EventLoopWindowTarget};
@ -203,13 +205,13 @@ impl Window {
} }
#[inline] #[inline]
pub fn fullscreen(&self) -> Option<RootMH> { pub fn fullscreen(&self) -> Option<Fullscreen> {
// TODO: should there be a maximization / fullscreen API? // TODO: should there be a maximization / fullscreen API?
None None
} }
#[inline] #[inline]
pub fn set_fullscreen(&self, _monitor: Option<RootMH>) { pub fn set_fullscreen(&self, _monitor: Option<Fullscreen>) {
// TODO: should there be a maximization / fullscreen API? // TODO: should there be a maximization / fullscreen API?
} }
@ -254,6 +256,16 @@ impl Window {
pub fn id(&self) -> Id { pub fn id(&self) -> Id {
return self.id; return self.id;
} }
#[inline]
pub fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
let handle = WebHandle {
id: self.id.0,
..WebHandle::empty()
};
raw_window_handle::RawWindowHandle::Web(handle)
}
} }
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]