Web: use the word "Web" correctly and consistently (#3785)
This commit is contained in:
parent
39a7d5b738
commit
d5fd8682eb
|
@ -1,5 +1,5 @@
|
||||||
name: Web bug
|
name: Web bug
|
||||||
description: Create a web-specific bug report
|
description: Create a Web-specific bug report
|
||||||
labels:
|
labels:
|
||||||
- B - bug
|
- B - bug
|
||||||
- DS - web
|
- DS - web
|
||||||
|
|
|
@ -58,7 +58,7 @@ jobs:
|
||||||
- { name: 'macOS', target: x86_64-apple-darwin, os: macos-latest, }
|
- { name: 'macOS', target: x86_64-apple-darwin, os: macos-latest, }
|
||||||
- { name: 'iOS x86_64', target: x86_64-apple-ios, os: macos-latest, }
|
- { name: 'iOS x86_64', target: x86_64-apple-ios, os: macos-latest, }
|
||||||
- { name: 'iOS Aarch64', target: aarch64-apple-ios, os: macos-latest, }
|
- { name: 'iOS Aarch64', target: aarch64-apple-ios, os: macos-latest, }
|
||||||
- { name: 'web', target: wasm32-unknown-unknown, os: ubuntu-latest, }
|
- { name: 'Web', target: wasm32-unknown-unknown, os: ubuntu-latest, }
|
||||||
exclude:
|
exclude:
|
||||||
# Android is tested on stable-3
|
# Android is tested on stable-3
|
||||||
- toolchain: '1.73'
|
- toolchain: '1.73'
|
||||||
|
@ -68,7 +68,7 @@ jobs:
|
||||||
platform: { name: 'Android', target: aarch64-linux-android, os: ubuntu-latest, options: '--package=winit --features=android-native-activity', cmd: 'apk --' }
|
platform: { name: 'Android', target: aarch64-linux-android, os: ubuntu-latest, options: '--package=winit --features=android-native-activity', cmd: 'apk --' }
|
||||||
- toolchain: 'nightly'
|
- toolchain: 'nightly'
|
||||||
platform: {
|
platform: {
|
||||||
name: 'web Atomic',
|
name: 'Web Atomic',
|
||||||
target: wasm32-unknown-unknown,
|
target: wasm32-unknown-unknown,
|
||||||
os: ubuntu-latest,
|
os: ubuntu-latest,
|
||||||
options: '-Zbuild-std=panic_abort,std',
|
options: '-Zbuild-std=panic_abort,std',
|
||||||
|
@ -216,7 +216,7 @@ jobs:
|
||||||
- { name: 'Linux', target: x86_64-unknown-linux-gnu }
|
- { name: 'Linux', target: x86_64-unknown-linux-gnu }
|
||||||
- { name: 'macOS', target: x86_64-apple-darwin }
|
- { name: 'macOS', target: x86_64-apple-darwin }
|
||||||
- { name: 'Redox OS', target: x86_64-unknown-redox }
|
- { name: 'Redox OS', target: x86_64-unknown-redox }
|
||||||
- { name: 'web', target: wasm32-unknown-unknown }
|
- { name: 'Web', target: wasm32-unknown-unknown }
|
||||||
- { name: 'Windows', target: x86_64-pc-windows-gnu }
|
- { name: 'Windows', target: x86_64-pc-windows-gnu }
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -139,7 +139,7 @@ impl Application {
|
||||||
|
|
||||||
#[cfg(web_platform)]
|
#[cfg(web_platform)]
|
||||||
{
|
{
|
||||||
use winit::platform::web::WindowAttributesExtWebSys;
|
use winit::platform::web::WindowAttributesExtWeb;
|
||||||
window_attributes = window_attributes.with_append(true);
|
window_attributes = window_attributes.with_append(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ impl WindowState {
|
||||||
) {
|
) {
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use winit::platform::web::CustomCursorExtWebSys;
|
use winit::platform::web::CustomCursorExtWeb;
|
||||||
|
|
||||||
let cursors = vec![
|
let cursors = vec![
|
||||||
custom_cursors[0].clone(),
|
custom_cursors[0].clone(),
|
||||||
|
@ -943,7 +943,7 @@ fn decode_cursor(bytes: &[u8]) -> CustomCursorSource {
|
||||||
fn url_custom_cursor() -> CustomCursorSource {
|
fn url_custom_cursor() -> CustomCursorSource {
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
|
|
||||||
use winit::platform::web::CustomCursorExtWebSys;
|
use winit::platform::web::CustomCursorExtWeb;
|
||||||
|
|
||||||
static URL_COUNTER: AtomicU64 = AtomicU64::new(0);
|
static URL_COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ changelog entry.
|
||||||
|
|
||||||
`ApplicationHandler::resumed/suspended()` are now only emitted by iOS and Web
|
`ApplicationHandler::resumed/suspended()` are now only emitted by iOS and Web
|
||||||
and now signify actually resuming/suspending the application.
|
and now signify actually resuming/suspending the application.
|
||||||
|
- Rename `platform::web::*ExtWebSys` to `*ExtWeb`.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl From<CustomCursor> for Cursor {
|
||||||
///
|
///
|
||||||
/// #[cfg(target_family = "wasm")]
|
/// #[cfg(target_family = "wasm")]
|
||||||
/// let source = {
|
/// let source = {
|
||||||
/// use winit::platform::web::CustomCursorExtWebSys;
|
/// use winit::platform::web::CustomCursorExtWeb;
|
||||||
/// CustomCursor::from_url(String::from("http://localhost:3000/cursor.png"), 0, 0)
|
/// CustomCursor::from_url(String::from("http://localhost:3000/cursor.png"), 0, 0)
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
|
|
|
@ -224,20 +224,21 @@ impl EventLoop {
|
||||||
///
|
///
|
||||||
/// Web applications are recommended to use
|
/// Web applications are recommended to use
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
web_platform,
|
any(web_platform, docsrs),
|
||||||
doc = "[`EventLoopExtWebSys::spawn_app()`][crate::platform::web::EventLoopExtWebSys::spawn_app()]"
|
doc = " [`EventLoopExtWeb::spawn_app()`][crate::platform::web::EventLoopExtWeb::spawn_app()]"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(not(web_platform), doc = "`EventLoopExtWebSys::spawn()`")]
|
#[cfg_attr(not(any(web_platform, docsrs)), doc = " `EventLoopExtWeb::spawn_app()`")]
|
||||||
/// [^1] instead of [`run_app()`] to avoid the need
|
/// [^1] instead of [`run_app()`] to avoid the need for the Javascript exception trick, and to
|
||||||
/// for the Javascript exception trick, and to make it clearer that the event loop runs
|
/// make it clearer that the event loop runs asynchronously (via the browser's own,
|
||||||
/// asynchronously (via the browser's own, internal, event loop) and doesn't block the
|
/// internal, event loop) and doesn't block the current thread of execution like it does
|
||||||
/// current thread of execution like it does on other platforms.
|
/// on other platforms.
|
||||||
///
|
///
|
||||||
/// This function won't be available with `target_feature = "exception-handling"`.
|
/// This function won't be available with `target_feature = "exception-handling"`.
|
||||||
///
|
///
|
||||||
|
/// [^1]: `spawn_app()` is only available on the Web platform.
|
||||||
|
///
|
||||||
/// [`set_control_flow()`]: ActiveEventLoop::set_control_flow()
|
/// [`set_control_flow()`]: ActiveEventLoop::set_control_flow()
|
||||||
/// [`run_app()`]: Self::run_app()
|
/// [`run_app()`]: Self::run_app()
|
||||||
/// [^1]: `EventLoopExtWebSys::spawn_app()` is only available on Web.
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(not(all(web_platform, target_feature = "exception-handling")))]
|
#[cfg(not(all(web_platform, target_feature = "exception-handling")))]
|
||||||
pub fn run_app<A: ApplicationHandler>(self, app: &mut A) -> Result<(), EventLoopError> {
|
pub fn run_app<A: ApplicationHandler>(self, app: &mut A) -> Result<(), EventLoopError> {
|
||||||
|
@ -357,8 +358,8 @@ impl ActiveEventLoop {
|
||||||
///
|
///
|
||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
///
|
///
|
||||||
/// - **Web:** The window is created but not inserted into the web page automatically. Please
|
/// - **Web:** The window is created but not inserted into the Web page automatically. Please
|
||||||
/// see the web platform module for more information.
|
/// see the Web platform module for more information.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn create_window(&self, window_attributes: WindowAttributes) -> Result<Window, OsError> {
|
pub fn create_window(&self, window_attributes: WindowAttributes) -> Result<Window, OsError> {
|
||||||
let _span = tracing::debug_span!(
|
let _span = tracing::debug_span!(
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub(crate) struct RgbaIcon {
|
||||||
pub(crate) height: u32,
|
pub(crate) height: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For platforms which don't have window icons (e.g. web)
|
/// For platforms which don't have window icons (e.g. Web)
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub(crate) struct NoIcon;
|
pub(crate) struct NoIcon;
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ pub use smol_str::SmolStr;
|
||||||
/// haven't mapped for you yet, this lets you use use [`KeyCode`] to:
|
/// haven't mapped for you yet, this lets you use use [`KeyCode`] to:
|
||||||
///
|
///
|
||||||
/// - Correctly match key press and release events.
|
/// - Correctly match key press and release events.
|
||||||
/// - On non-web platforms, support assigning keybinds to virtually any key through a UI.
|
/// - On non-Web platforms, support assigning keybinds to virtually any key through a UI.
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub enum NativeKeyCode {
|
pub enum NativeKeyCode {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
//! will run until [`exit()`] is used, at which point [`exiting()`] is called.
|
//! will run until [`exit()`] is used, at which point [`exiting()`] is called.
|
||||||
//!
|
//!
|
||||||
//! Winit no longer uses a `EventLoop::poll_events() -> impl Iterator<Event>`-based event loop
|
//! Winit no longer uses a `EventLoop::poll_events() -> impl Iterator<Event>`-based event loop
|
||||||
//! model, since that can't be implemented properly on some platforms (e.g web, iOS) and works
|
//! model, since that can't be implemented properly on some platforms (e.g Web, iOS) and works
|
||||||
//! poorly on most other platforms. However, this model can be re-implemented to an extent with
|
//! poorly on most other platforms. However, this model can be re-implemented to an extent with
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
any(windows_platform, macos_platform, android_platform, x11_platform, wayland_platform),
|
any(windows_platform, macos_platform, android_platform, x11_platform, wayland_platform),
|
||||||
|
|
|
@ -29,9 +29,13 @@ pub trait EventLoopExtRunOnDemand {
|
||||||
/// # Caveats
|
/// # Caveats
|
||||||
/// - This extension isn't available on all platforms, since it's not always possible to return
|
/// - This extension isn't available on all platforms, since it's not always possible to return
|
||||||
/// to the caller (specifically this is impossible on iOS and Web - though with the Web
|
/// to the caller (specifically this is impossible on iOS and Web - though with the Web
|
||||||
/// backend it is possible to use `EventLoopExtWebSys::spawn()`
|
/// backend it is possible to use
|
||||||
#[cfg_attr(not(web_platform), doc = "[^1]")]
|
#[cfg_attr(
|
||||||
/// more than once instead).
|
any(web_platform, docsrs),
|
||||||
|
doc = " [`EventLoopExtWeb::spawn_app()`][crate::platform::web::EventLoopExtWeb::spawn_app()]"
|
||||||
|
)]
|
||||||
|
#[cfg_attr(not(any(web_platform, docsrs)), doc = " `EventLoopExtWeb::spawn_app()`")]
|
||||||
|
/// [^1] more than once instead).
|
||||||
/// - No [`Window`] state can be carried between separate runs of the event loop.
|
/// - No [`Window`] state can be carried between separate runs of the event loop.
|
||||||
///
|
///
|
||||||
/// You are strongly encouraged to use [`EventLoop::run_app()`] for portability, unless you
|
/// You are strongly encouraged to use [`EventLoop::run_app()`] for portability, unless you
|
||||||
|
@ -49,8 +53,8 @@ pub trait EventLoopExtRunOnDemand {
|
||||||
/// block the browser and there is nothing that can be polled to ask for new events. Events
|
/// block the browser and there is nothing that can be polled to ask for new events. Events
|
||||||
/// are delivered via callbacks based on an event loop that is internal to the browser itself.
|
/// are delivered via callbacks based on an event loop that is internal to the browser itself.
|
||||||
/// - **iOS:** It's not possible to stop and start an `UIApplication` repeatedly on iOS.
|
/// - **iOS:** It's not possible to stop and start an `UIApplication` repeatedly on iOS.
|
||||||
#[cfg_attr(not(web_platform), doc = "[^1]: `spawn()` is only available on `wasm` platforms.")]
|
///
|
||||||
#[rustfmt::skip]
|
/// [^1]: `spawn_app()` is only available on the Web platforms.
|
||||||
///
|
///
|
||||||
/// [`exit()`]: ActiveEventLoop::exit()
|
/// [`exit()`]: ActiveEventLoop::exit()
|
||||||
/// [`set_control_flow()`]: ActiveEventLoop::set_control_flow()
|
/// [`set_control_flow()`]: ActiveEventLoop::set_control_flow()
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
//! # Web
|
//! # Web
|
||||||
//!
|
//!
|
||||||
//! The officially supported browsers are Chrome, Firefox and Safari 13.1+,
|
//! Winit supports running in Browsers by compiling to WebAssembly with
|
||||||
//! though forks of these should work fine.
|
//! [`wasm-bindgen`][wasm_bindgen]. For information on using Rust on WebAssembly, check out the
|
||||||
|
//! [Rust and WebAssembly book].
|
||||||
//!
|
//!
|
||||||
//! Winit supports compiling to the `wasm32-unknown-unknown` target with
|
//! The officially supported browsers are Chrome, Firefox and Safari 13.1+, though forks of these
|
||||||
//! `web-sys`.
|
//! should work fine.
|
||||||
//!
|
//!
|
||||||
//! On the web platform, a Winit window is backed by a `<canvas>` element. You
|
//! On the Web platform, a Winit [`Window`] is backed by a [`HTMLCanvasElement`][canvas]. Winit will
|
||||||
//! can either [provide Winit with a `<canvas>` element][with_canvas], or
|
//! create that canvas for you or you can [provide your own][with_canvas]. Then you can either let
|
||||||
//! [let Winit create a `<canvas>` element which you can then retrieve][get]
|
//! Winit [insert it into the DOM for you][insert], or [retrieve the canvas][get] and insert it
|
||||||
//! and insert it into the DOM yourself.
|
//! yourself.
|
||||||
//!
|
//!
|
||||||
//! Currently, there is no example code using Winit on Web, see [#3473]. For
|
//! [canvas]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement
|
||||||
//! information on using Rust on WebAssembly, check out the [Rust and
|
//! [with_canvas]: WindowAttributesExtWeb::with_canvas
|
||||||
//! WebAssembly book].
|
//! [get]: WindowExtWeb::canvas
|
||||||
//!
|
//! [insert]: WindowAttributesExtWeb::with_append
|
||||||
//! [with_canvas]: WindowAttributesExtWebSys::with_canvas
|
#![cfg_attr(not(web_platform), doc = "[wasm_bindgen]: https://docs.rs/wasm-bindgen")]
|
||||||
//! [get]: WindowExtWebSys::canvas
|
//! [Rust and WebAssembly book]: https://rustwasm.github.io/book
|
||||||
//! [#3473]: https://github.com/rust-windowing/winit/issues/3473
|
|
||||||
//! [Rust and WebAssembly book]: https://rustwasm.github.io/book/
|
|
||||||
//!
|
//!
|
||||||
//! ## CSS properties
|
//! ## CSS properties
|
||||||
//!
|
//!
|
||||||
|
@ -65,7 +64,7 @@ use crate::window::{CustomCursor, Window, WindowAttributes};
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub struct HtmlCanvasElement;
|
pub struct HtmlCanvasElement;
|
||||||
|
|
||||||
pub trait WindowExtWebSys {
|
pub trait WindowExtWeb {
|
||||||
/// Only returns the canvas if called from inside the window context (the
|
/// Only returns the canvas if called from inside the window context (the
|
||||||
/// main thread).
|
/// main thread).
|
||||||
fn canvas(&self) -> Option<HtmlCanvasElement>;
|
fn canvas(&self) -> Option<HtmlCanvasElement>;
|
||||||
|
@ -86,7 +85,7 @@ pub trait WindowExtWebSys {
|
||||||
fn set_prevent_default(&self, prevent_default: bool);
|
fn set_prevent_default(&self, prevent_default: bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowExtWebSys for Window {
|
impl WindowExtWeb for Window {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn canvas(&self) -> Option<HtmlCanvasElement> {
|
fn canvas(&self) -> Option<HtmlCanvasElement> {
|
||||||
self.window.canvas()
|
self.window.canvas()
|
||||||
|
@ -101,11 +100,11 @@ impl WindowExtWebSys for Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait WindowAttributesExtWebSys {
|
pub trait WindowAttributesExtWeb {
|
||||||
/// Pass an [`HtmlCanvasElement`] to be used for this [`Window`]. If [`None`],
|
/// Pass an [`HtmlCanvasElement`] to be used for this [`Window`]. If [`None`],
|
||||||
/// [`WindowAttributes::default()`] will create one.
|
/// [`WindowAttributes::default()`] will create one.
|
||||||
///
|
///
|
||||||
/// In any case, the canvas won't be automatically inserted into the web page.
|
/// In any case, the canvas won't be automatically inserted into the Web page.
|
||||||
///
|
///
|
||||||
/// [`None`] by default.
|
/// [`None`] by default.
|
||||||
#[cfg_attr(not(web_platform), doc = "", doc = "[`HtmlCanvasElement`]: #only-available-on-wasm")]
|
#[cfg_attr(not(web_platform), doc = "", doc = "[`HtmlCanvasElement`]: #only-available-on-wasm")]
|
||||||
|
@ -125,13 +124,13 @@ pub trait WindowAttributesExtWebSys {
|
||||||
/// Enabled by default.
|
/// Enabled by default.
|
||||||
fn with_focusable(self, focusable: bool) -> Self;
|
fn with_focusable(self, focusable: bool) -> Self;
|
||||||
|
|
||||||
/// On window creation, append the canvas element to the web page if it isn't already.
|
/// On window creation, append the canvas element to the Web page if it isn't already.
|
||||||
///
|
///
|
||||||
/// Disabled by default.
|
/// Disabled by default.
|
||||||
fn with_append(self, append: bool) -> Self;
|
fn with_append(self, append: bool) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowAttributesExtWebSys for WindowAttributes {
|
impl WindowAttributesExtWeb for WindowAttributes {
|
||||||
fn with_canvas(mut self, canvas: Option<HtmlCanvasElement>) -> Self {
|
fn with_canvas(mut self, canvas: Option<HtmlCanvasElement>) -> Self {
|
||||||
self.platform_specific.set_canvas(canvas);
|
self.platform_specific.set_canvas(canvas);
|
||||||
self
|
self
|
||||||
|
@ -153,8 +152,8 @@ impl WindowAttributesExtWebSys for WindowAttributes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Additional methods on `EventLoop` that are specific to the web.
|
/// Additional methods on `EventLoop` that are specific to the Web.
|
||||||
pub trait EventLoopExtWebSys {
|
pub trait EventLoopExtWeb {
|
||||||
/// Initializes the winit event loop.
|
/// Initializes the winit event loop.
|
||||||
///
|
///
|
||||||
/// Unlike
|
/// Unlike
|
||||||
|
@ -208,7 +207,7 @@ pub trait EventLoopExtWebSys {
|
||||||
fn wait_until_strategy(&self) -> WaitUntilStrategy;
|
fn wait_until_strategy(&self) -> WaitUntilStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventLoopExtWebSys for EventLoop {
|
impl EventLoopExtWeb for EventLoop {
|
||||||
fn spawn_app<A: ApplicationHandler + 'static>(self, app: A) {
|
fn spawn_app<A: ApplicationHandler + 'static>(self, app: A) {
|
||||||
self.event_loop.spawn_app(app);
|
self.event_loop.spawn_app(app);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +229,7 @@ impl EventLoopExtWebSys for EventLoop {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ActiveEventLoopExtWebSys {
|
pub trait ActiveEventLoopExtWeb {
|
||||||
/// Sets the strategy for [`ControlFlow::Poll`].
|
/// Sets the strategy for [`ControlFlow::Poll`].
|
||||||
///
|
///
|
||||||
/// See [`PollStrategy`].
|
/// See [`PollStrategy`].
|
||||||
|
@ -264,7 +263,7 @@ pub trait ActiveEventLoopExtWebSys {
|
||||||
fn create_custom_cursor_async(&self, source: CustomCursorSource) -> CustomCursorFuture;
|
fn create_custom_cursor_async(&self, source: CustomCursorSource) -> CustomCursorFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveEventLoopExtWebSys for ActiveEventLoop {
|
impl ActiveEventLoopExtWeb for ActiveEventLoop {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn create_custom_cursor_async(&self, source: CustomCursorSource) -> CustomCursorFuture {
|
fn create_custom_cursor_async(&self, source: CustomCursorSource) -> CustomCursorFuture {
|
||||||
self.p.create_custom_cursor_async(source)
|
self.p.create_custom_cursor_async(source)
|
||||||
|
@ -340,7 +339,7 @@ pub enum WaitUntilStrategy {
|
||||||
Worker,
|
Worker,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait CustomCursorExtWebSys {
|
pub trait CustomCursorExtWeb {
|
||||||
/// Returns if this cursor is an animation.
|
/// Returns if this cursor is an animation.
|
||||||
fn is_animation(&self) -> bool;
|
fn is_animation(&self) -> bool;
|
||||||
|
|
||||||
|
@ -359,7 +358,7 @@ pub trait CustomCursorExtWebSys {
|
||||||
) -> Result<CustomCursorSource, BadAnimation>;
|
) -> Result<CustomCursorSource, BadAnimation>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CustomCursorExtWebSys for CustomCursor {
|
impl CustomCursorExtWeb for CustomCursor {
|
||||||
fn is_animation(&self) -> bool {
|
fn is_animation(&self) -> bool {
|
||||||
self.inner.animation
|
self.inner.animation
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::application::ApplicationHandler;
|
||||||
use crate::error::EventLoopError;
|
use crate::error::EventLoopError;
|
||||||
use crate::event::Event;
|
use crate::event::Event;
|
||||||
use crate::event_loop::ActiveEventLoop as RootActiveEventLoop;
|
use crate::event_loop::ActiveEventLoop as RootActiveEventLoop;
|
||||||
use crate::platform::web::{ActiveEventLoopExtWebSys, PollStrategy, WaitUntilStrategy};
|
use crate::platform::web::{ActiveEventLoopExtWeb, PollStrategy, WaitUntilStrategy};
|
||||||
|
|
||||||
mod proxy;
|
mod proxy;
|
||||||
pub(crate) mod runner;
|
pub(crate) mod runner;
|
||||||
|
|
|
@ -439,7 +439,7 @@ impl Shared {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init(&self) {
|
pub fn init(&self) {
|
||||||
// NB: For consistency all platforms must call `can_create_surfaces` even though web
|
// NB: For consistency all platforms must call `can_create_surfaces` even though Web
|
||||||
// applications don't themselves have a formal surface destroy/create lifecycle.
|
// applications don't themselves have a formal surface destroy/create lifecycle.
|
||||||
self.run_until_cleared(
|
self.run_until_cleared(
|
||||||
[Event::NewEvents(StartCause::Init), Event::CreateSurfaces].into_iter(),
|
[Event::NewEvents(StartCause::Init), Event::CreateSurfaces].into_iter(),
|
||||||
|
@ -604,7 +604,7 @@ impl Shared {
|
||||||
self.exit();
|
self.exit();
|
||||||
self.apply_control_flow();
|
self.apply_control_flow();
|
||||||
// We don't call `handle_loop_destroyed` here because we don't need to
|
// We don't call `handle_loop_destroyed` here because we don't need to
|
||||||
// perform cleanup when the web browser is going to destroy the page.
|
// perform cleanup when the Web browser is going to destroy the page.
|
||||||
self.handle_event(Event::LoopExiting);
|
self.handle_event(Event::LoopExiting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Brief introduction to the internals of the web backend:
|
// Brief introduction to the internals of the Web backend:
|
||||||
// The web backend used to support both wasm-bindgen and stdweb as methods of binding to the
|
// The Web backend used to support both wasm-bindgen and stdweb as methods of binding to the
|
||||||
// environment. Because they are both supporting the same underlying APIs, the actual web bindings
|
// environment. Because they are both supporting the same underlying APIs, the actual Web bindings
|
||||||
// are cordoned off into backend abstractions, which present the thinnest unifying layer possible.
|
// are cordoned off into backend abstractions, which present the thinnest unifying layer possible.
|
||||||
//
|
//
|
||||||
// When adding support for new events or interactions with the browser, first consult trusted
|
// When adding support for new events or interactions with the browser, first consult trusted
|
||||||
// documentation (such as MDN) to ensure it is well-standardised and supported across many browsers.
|
// documentation (such as MDN) to ensure it is well-standardised and supported across many browsers.
|
||||||
// Once you have decided on the relevant web APIs, add support to both backends.
|
// Once you have decided on the relevant Web APIs, add support to both backends.
|
||||||
//
|
//
|
||||||
// The backend is used by the rest of the module to implement Winit's business logic, which forms
|
// The backend is used by the rest of the module to implement Winit's business logic, which forms
|
||||||
// the rest of the code. 'device', 'error', 'monitor', and 'window' define web-specific structures
|
// the rest of the code. 'device', 'error', 'monitor', and 'window' define Web-specific structures
|
||||||
// for winit's cross-platform structures. They are all relatively simple translations.
|
// for winit's cross-platform structures. They are all relatively simple translations.
|
||||||
//
|
//
|
||||||
// The event_loop module handles listening for and processing events. 'Proxy' implements
|
// The event_loop module handles listening for and processing events. 'Proxy' implements
|
||||||
|
|
|
@ -325,7 +325,7 @@ impl Inner {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_ime_cursor_area(&self, _position: Position, _size: Size) {
|
pub fn set_ime_cursor_area(&self, _position: Position, _size: Size) {
|
||||||
// Currently a no-op as it does not seem there is good support for this on web
|
// Currently not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -1154,7 +1154,7 @@ impl Window {
|
||||||
///
|
///
|
||||||
/// Enable/disable window decorations provided by the server or Winit.
|
/// Enable/disable window decorations provided by the server or Winit.
|
||||||
/// By default this is enabled. Note that fullscreen windows and windows on
|
/// By default this is enabled. Note that fullscreen windows and windows on
|
||||||
/// mobile and web platforms naturally do not have decorations.
|
/// mobile and Web platforms naturally do not have decorations.
|
||||||
///
|
///
|
||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
///
|
///
|
||||||
|
@ -1168,7 +1168,7 @@ impl Window {
|
||||||
/// Gets the window's current decorations state.
|
/// Gets the window's current decorations state.
|
||||||
///
|
///
|
||||||
/// Returns `true` when windows are decorated (server-side or by Winit).
|
/// Returns `true` when windows are decorated (server-side or by Winit).
|
||||||
/// Also returns `true` when no decorations are required (mobile, web).
|
/// Also returns `true` when no decorations are required (mobile, Web).
|
||||||
///
|
///
|
||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue