Clarified some window builder documentation

Really the functions should be renamed -- see #155
This commit is contained in:
Jonathan Johnson 2024-05-17 15:00:24 -07:00
parent 3da08bca62
commit 8c8dca63ba
No known key found for this signature in database
GPG key ID: A66D6A34D6620579
4 changed files with 8 additions and 6 deletions

View file

@ -11,8 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed a panic that could occur when removing some deeply nested hierarchies - Fixed a panic that could occur when removing certain nested hierarchies from a
from a window. window.
### Added ### Added

View file

@ -919,7 +919,8 @@ pub trait MakeWidget: Sized {
Window::new(self.make_widget()) Window::new(self.make_widget())
} }
/// Returns a builder for a [`VirtualWindow`](crate::window::VirtualWindow). /// Returns a builder for a [`VirtualWindow`](crate::window::VirtualWindow)
/// or a [`CushyWindow`](crate::window::CushyWindow).
fn build_virtual_window(self) -> CushyWindowBuilder { fn build_virtual_window(self) -> CushyWindowBuilder {
CushyWindowBuilder::new(self) CushyWindowBuilder::new(self)
} }

View file

@ -54,7 +54,8 @@ impl WrapperWidget for Switcher {
available_space: Size<ConstraintLimit>, available_space: Size<ConstraintLimit>,
context: &mut LayoutContext<'_, '_, '_, '_>, context: &mut LayoutContext<'_, '_, '_, '_>,
) -> Size<ConstraintLimit> { ) -> Size<ConstraintLimit> {
if self.source.has_updated() { let current_source = self.source.get_tracking_invalidate(context);
if &current_source != self.child.widget() {
self.child.unmount_in(context); self.child.unmount_in(context);
self.child = WidgetRef::new(self.source.get()); self.child = WidgetRef::new(self.source.get());
} }

View file

@ -2474,7 +2474,7 @@ impl PlatformWindowImplementation for &mut VirtualState {
} }
} }
/// A builder for a [`VirtualWindow`]. /// A builder for a [`VirtualWindow`] or a [`CushyWindow`].
pub struct CushyWindowBuilder { pub struct CushyWindowBuilder {
widget: WidgetInstance, widget: WidgetInstance,
multisample_count: NonZeroU32, multisample_count: NonZeroU32,
@ -2484,7 +2484,7 @@ pub struct CushyWindowBuilder {
} }
impl CushyWindowBuilder { impl CushyWindowBuilder {
/// Returns a new builder for a Cushy window that contains `contents`. /// Returns a new builder for a standalone window that contains `contents`.
#[must_use] #[must_use]
pub fn new(contents: impl MakeWidget) -> Self { pub fn new(contents: impl MakeWidget) -> Self {
Self { Self {