diff --git a/crates/bevy_window/src/event.rs b/crates/bevy_window/src/event.rs index 2a5250ab75359..ffc0939cbef94 100644 --- a/crates/bevy_window/src/event.rs +++ b/crates/bevy_window/src/event.rs @@ -313,7 +313,7 @@ pub struct WindowMoved { pub position: IVec2, } -/// An event sent when system changed window theme. +/// An event sent when the system theme changes for a window. /// /// This event is only sent when the window is relying on the system theme to control its appearance. /// i.e. It is only sent when [`Window::window_theme`](crate::window::Window::window_theme) is `None` and the system theme changes. @@ -325,6 +325,8 @@ pub struct WindowMoved { reflect(Serialize, Deserialize) )] pub struct WindowThemeChanged { + /// Window for which the system theme has changed. pub window: Entity, + /// The new system theme. pub theme: WindowTheme, } diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index 174f8c11be0a8..e62f8bedc655a 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -1,6 +1,12 @@ #![allow(clippy::type_complexity)] +#![warn(missing_docs)] +//! `bevy_window` provides a platform-agnostic interface for windowing in Bevy. +//! +//! This crate contains types for window management and events, +//! used by windowing implementors such as `bevy_winit`. +//! The [`WindowPlugin`] sets up some global window-related parameters and +//! is part of the [`DefaultPlugins`](https://docs.rs/bevy/latest/bevy/struct.DefaultPlugins.html). -#[warn(missing_docs)] mod cursor; mod event; mod raw_handle; @@ -14,6 +20,7 @@ pub use event::*; pub use system::*; pub use window::*; +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_window/src/raw_handle.rs b/crates/bevy_window/src/raw_handle.rs index 6c535605991f0..06b36ee9ceb6a 100644 --- a/crates/bevy_window/src/raw_handle.rs +++ b/crates/bevy_window/src/raw_handle.rs @@ -10,7 +10,9 @@ use raw_window_handle::{ /// thread-safe. #[derive(Debug, Clone, Component)] pub struct RawHandleWrapper { + /// Raw handle to a window. pub window_handle: RawWindowHandle, + /// Raw handle to the display server. pub display_handle: RawDisplayHandle, } @@ -24,14 +26,6 @@ impl RawHandleWrapper { pub unsafe fn get_handle(&self) -> ThreadLockedRawWindowHandleWrapper { ThreadLockedRawWindowHandleWrapper(self.clone()) } - - pub fn get_display_handle(&self) -> RawDisplayHandle { - self.display_handle - } - - pub fn get_window_handle(&self) -> RawWindowHandle { - self.window_handle - } } // SAFETY: [`RawHandleWrapper`] is just a normal "raw pointer", which doesn't impl Send/Sync. However the pointer is only @@ -59,7 +53,7 @@ pub struct ThreadLockedRawWindowHandleWrapper(RawHandleWrapper); // and so exposing a safe method to get a [`RawWindowHandle`] directly would be UB. unsafe impl HasRawWindowHandle for ThreadLockedRawWindowHandleWrapper { fn raw_window_handle(&self) -> RawWindowHandle { - self.0.get_window_handle() + self.0.window_handle } } @@ -71,6 +65,6 @@ unsafe impl HasRawWindowHandle for ThreadLockedRawWindowHandleWrapper { // and so exposing a safe method to get a [`RawDisplayHandle`] directly would be UB. unsafe impl HasRawDisplayHandle for ThreadLockedRawWindowHandleWrapper { fn raw_display_handle(&self) -> RawDisplayHandle { - self.0.get_display_handle() + self.0.display_handle } }