Added winit accessor

I originally removed this API to ensure no Cushy widgets were using
winit directly, but I've reintroduced it so that third party widgets can
still interact with winit if needed.
This commit is contained in:
Jonathan Johnson 2024-04-03 09:13:36 -07:00
parent 44759d4812
commit beede55f0a
No known key found for this signature in database
GPG key ID: A66D6A34D6620579
2 changed files with 7 additions and 3 deletions

View file

@ -428,9 +428,6 @@ where
}
}
/// A [`Animate`] implementor that has been boxed as a trait object.
pub struct BoxedAnimation(Box<dyn Animate>);
/// An animation that can be spawned.
pub trait Spawn {
/// Spawns the animation, returning a handle that tracks the animation.

View file

@ -245,6 +245,9 @@ pub trait PlatformWindow {
fn set_min_inner_size(&self, min_size: Option<Size<UPx>>);
/// Sets the window's maximum inner size.
fn set_max_inner_size(&self, max_size: Option<Size<UPx>>);
/// Returns a handle to the underlying winit window, if available.
fn winit(&self) -> Option<&winit::window::Window>;
}
/// A currently running Cushy window.
@ -436,6 +439,10 @@ where
fn set_ime_location(&self, location: Rect<Px>) {
self.window.set_ime_location(location);
}
fn winit(&self) -> Option<&winit::window::Window> {
self.window.winit()
}
}
/// The attributes of a Cushy window.