winit-core: cleanup event loop docs
This commit is contained in:
parent
c0b737de4a
commit
276597e009
2 changed files with 8 additions and 18 deletions
|
|
@ -7,16 +7,6 @@ use crate::window::WindowId;
|
||||||
pub mod macos;
|
pub mod macos;
|
||||||
|
|
||||||
/// The handler of application-level events.
|
/// The handler of application-level events.
|
||||||
///
|
|
||||||
/// See [the top-level docs] for example usage, and [`EventLoop::run_app`] for an overview of when
|
|
||||||
/// events are delivered.
|
|
||||||
///
|
|
||||||
/// This is [dropped] when the event loop is shut down. Note that this only works if you're passing
|
|
||||||
/// the entire state to [`EventLoop::run_app`] (passing `&mut app` won't work).
|
|
||||||
///
|
|
||||||
/// [the top-level docs]: crate
|
|
||||||
/// [`EventLoop::run_app`]: crate::event_loop::EventLoop::run_app
|
|
||||||
/// [dropped]: std::ops::Drop
|
|
||||||
pub trait ApplicationHandler {
|
pub trait ApplicationHandler {
|
||||||
/// Emitted when new events arrive from the OS to be processed.
|
/// Emitted when new events arrive from the OS to be processed.
|
||||||
///
|
///
|
||||||
|
|
@ -211,9 +201,7 @@ pub trait ApplicationHandler {
|
||||||
|
|
||||||
/// Emitted when the OS sends an event to a device.
|
/// Emitted when the OS sends an event to a device.
|
||||||
///
|
///
|
||||||
/// For this to be called, it must be enabled with [`EventLoop::listen_device_events`].
|
/// Whether device events are delivered depends on the backend in use.
|
||||||
///
|
|
||||||
/// [`EventLoop::listen_device_events`]: crate::event_loop::EventLoop::listen_device_events
|
|
||||||
fn device_event(
|
fn device_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
event_loop: &dyn ActiveEventLoop,
|
event_loop: &dyn ActiveEventLoop,
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ pub trait ActiveEventLoop: AsAny + fmt::Debug {
|
||||||
/// [qa1561]: https://developer.apple.com/library/archive/qa/qa1561/_index.html
|
/// [qa1561]: https://developer.apple.com/library/archive/qa/qa1561/_index.html
|
||||||
fn exit(&self);
|
fn exit(&self);
|
||||||
|
|
||||||
/// Returns whether the [`EventLoop`] is about to stop.
|
/// Returns whether the [`ActiveEventLoop`] is about to stop.
|
||||||
///
|
///
|
||||||
/// Set by [`exit()`][Self::exit].
|
/// Set by [`exit()`][Self::exit].
|
||||||
fn exiting(&self) -> bool;
|
fn exiting(&self) -> bool;
|
||||||
|
|
@ -131,14 +131,15 @@ impl HasDisplayHandle for dyn ActiveEventLoop + '_ {
|
||||||
|
|
||||||
impl_dyn_casting!(ActiveEventLoop);
|
impl_dyn_casting!(ActiveEventLoop);
|
||||||
|
|
||||||
/// Control the [`EventLoop`], possibly from a different thread, without referencing it directly.
|
/// Control the [`ActiveEventLoop`], possibly from a different thread, without referencing it
|
||||||
|
/// directly.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct EventLoopProxy {
|
pub struct EventLoopProxy {
|
||||||
pub(crate) proxy: Arc<dyn EventLoopProxyProvider>,
|
pub(crate) proxy: Arc<dyn EventLoopProxyProvider>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventLoopProxy {
|
impl EventLoopProxy {
|
||||||
/// Wake up the [`EventLoop`], resulting in [`ApplicationHandler::proxy_wake_up()`] being
|
/// Wake up the [`ActiveEventLoop`], resulting in [`ApplicationHandler::proxy_wake_up()`] being
|
||||||
/// called.
|
/// called.
|
||||||
///
|
///
|
||||||
/// Calls to this method are coalesced into a single call to [`proxy_wake_up`], see the
|
/// Calls to this method are coalesced into a single call to [`proxy_wake_up`], see the
|
||||||
|
|
@ -146,7 +147,8 @@ impl EventLoopProxy {
|
||||||
///
|
///
|
||||||
/// If the event loop is no longer running, this is a no-op.
|
/// If the event loop is no longer running, this is a no-op.
|
||||||
///
|
///
|
||||||
/// [`proxy_wake_up`]: ApplicationHandler::proxy_wake_up
|
/// [`proxy_wake_up`]: crate::application::ApplicationHandler::proxy_wake_up
|
||||||
|
/// [`ApplicationHandler::proxy_wake_up()`]: crate::application::ApplicationHandler::proxy_wake_up
|
||||||
///
|
///
|
||||||
/// # Platform-specific
|
/// # Platform-specific
|
||||||
///
|
///
|
||||||
|
|
@ -171,7 +173,7 @@ pub trait EventLoopProxyProvider: Send + Sync + Debug {
|
||||||
///
|
///
|
||||||
/// The purpose of this type is to provide a cheaply cloneable handle to the underlying
|
/// The purpose of this type is to provide a cheaply cloneable handle to the underlying
|
||||||
/// display handle. This is often used by graphics APIs to connect to the underlying APIs.
|
/// display handle. This is often used by graphics APIs to connect to the underlying APIs.
|
||||||
/// It is difficult to keep a handle to the [`EventLoop`] type or the [`ActiveEventLoop`]
|
/// It is difficult to keep a handle to the underlying event loop type or the [`ActiveEventLoop`]
|
||||||
/// type. In contrast, this type involves no lifetimes and can be persisted for as long as
|
/// type. In contrast, this type involves no lifetimes and can be persisted for as long as
|
||||||
/// needed.
|
/// needed.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue