Merge branch 'web' into merge-master-to-web

This commit is contained in:
Ryan Goldstein 2019-09-24 19:41:59 -04:00
commit 86bafdc104
10 changed files with 61 additions and 19 deletions

View file

@ -2,7 +2,7 @@ use super::runner;
use crate::event::Event;
use crate::event_loop::EventLoopClosed;
pub struct Proxy<T: 'static>{
pub struct Proxy<T: 'static> {
runner: runner::Shared<T>,
}
@ -20,7 +20,7 @@ impl<T: 'static> Proxy<T> {
impl<T: 'static> Clone for Proxy<T> {
fn clone(&self) -> Self {
Proxy {
runner: self.runner.clone()
runner: self.runner.clone(),
}
}
}

View file

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

View file

@ -10,19 +10,21 @@ impl Handle {
}
pub fn position(&self) -> PhysicalPosition {
unimplemented!();
PhysicalPosition { x: 0.0, y: 0.0 }
}
pub fn name(&self) -> Option<String> {
unimplemented!();
None
}
pub fn size(&self) -> PhysicalSize {
unimplemented!();
PhysicalSize {
width: 0.0,
height: 0.0,
}
}
pub fn video_modes(&self) -> impl Iterator<Item = VideoMode> {
// TODO: is this possible ?
std::iter::empty()
}
}
@ -45,9 +47,6 @@ impl Mode {
}
pub fn monitor(&self) -> MonitorHandle {
MonitorHandle {
inner: Handle
}
MonitorHandle { inner: Handle }
}
}

View file

@ -4,7 +4,7 @@ use crate::icon::Icon;
use crate::monitor::MonitorHandle as RootMH;
use crate::window::{CursorIcon, Fullscreen, WindowAttributes, WindowId as RootWI};
use raw_window_handle::{RawWindowHandle, web::WebHandle};
use raw_window_handle::web::WebHandle;
use super::{backend, monitor, EventLoopWindowTarget};
@ -179,13 +179,13 @@ impl Window {
#[inline]
pub fn set_cursor_position(&self, _position: LogicalPosition) -> Result<(), ExternalError> {
// TODO: pointer capture
// Intentionally a no-op, as the web does not support setting cursor positions
Ok(())
}
#[inline]
pub fn set_cursor_grab(&self, _grab: bool) -> Result<(), ExternalError> {
// TODO: pointer capture
// Intentionally a no-op, as the web does not (properly) support grabbing the cursor
Ok(())
}
@ -201,7 +201,7 @@ impl Window {
#[inline]
pub fn set_maximized(&self, _maximized: bool) {
// TODO: should there be a maximization / fullscreen API?
// Intentionally a no-op, as canvases cannot be 'maximized'
}
#[inline]
@ -232,7 +232,7 @@ impl Window {
#[inline]
pub fn set_ime_position(&self, _position: LogicalPosition) {
// TODO: what is this?
// Currently a no-op as it does not seem there is good support for this on web
}
#[inline]