From beede55f0aea764824cc24513ee695f19da69f76 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Wed, 3 Apr 2024 09:13:36 -0700 Subject: [PATCH] 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. --- src/animation.rs | 3 --- src/window.rs | 7 +++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/animation.rs b/src/animation.rs index f3594b2..536b92f 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -428,9 +428,6 @@ where } } -/// A [`Animate`] implementor that has been boxed as a trait object. -pub struct BoxedAnimation(Box); - /// An animation that can be spawned. pub trait Spawn { /// Spawns the animation, returning a handle that tracks the animation. diff --git a/src/window.rs b/src/window.rs index 7734c65..02c04f5 100644 --- a/src/window.rs +++ b/src/window.rs @@ -245,6 +245,9 @@ pub trait PlatformWindow { fn set_min_inner_size(&self, min_size: Option>); /// Sets the window's maximum inner size. fn set_max_inner_size(&self, max_size: Option>); + + /// 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) { self.window.set_ime_location(location); } + + fn winit(&self) -> Option<&winit::window::Window> { + self.window.winit() + } } /// The attributes of a Cushy window.