diff options
Diffstat (limited to 'winit')
-rw-r--r-- | winit/src/application.rs | 20 | ||||
-rw-r--r-- | winit/src/application/state.rs | 9 | ||||
-rw-r--r-- | winit/src/multi_window.rs | 27 | ||||
-rw-r--r-- | winit/src/multi_window/state.rs | 11 | ||||
-rw-r--r-- | winit/src/multi_window/window_manager.rs | 10 |
5 files changed, 34 insertions, 43 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index 09bf63cc..21a985e8 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -39,7 +39,7 @@ use std::sync::Arc; /// can be toggled by pressing `F12`. pub trait Application: Program where - <Self::Renderer as core::Renderer>::Theme: StyleSheet, + Self::Theme: StyleSheet, { /// The data needed to initialize your [`Application`]. type Flags; @@ -61,12 +61,10 @@ where fn title(&self) -> String; /// Returns the current `Theme` of the [`Application`]. - fn theme(&self) -> <Self::Renderer as core::Renderer>::Theme; + fn theme(&self) -> Self::Theme; /// Returns the `Style` variation of the `Theme`. - fn style( - &self, - ) -> <<Self::Renderer as core::Renderer>::Theme as StyleSheet>::Style { + fn style(&self) -> <Self::Theme as StyleSheet>::Style { Default::default() } @@ -107,7 +105,7 @@ where A: Application + 'static, E: Executor + 'static, C: Compositor<Renderer = A::Renderer> + 'static, - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { use futures::task; use futures::Future; @@ -258,7 +256,7 @@ async fn run_instance<A, E, C>( A: Application + 'static, E: Executor + 'static, C: Compositor<Renderer = A::Renderer> + 'static, - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { use futures::stream::StreamExt; use winit::event; @@ -579,9 +577,9 @@ pub fn build_user_interface<'a, A: Application>( renderer: &mut A::Renderer, size: Size, debug: &mut Debug, -) -> UserInterface<'a, A::Message, A::Renderer> +) -> UserInterface<'a, A::Message, A::Theme, A::Renderer> where - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { debug.view_started(); let view = application.view(); @@ -612,7 +610,7 @@ pub fn update<A: Application, C, E: Executor>( window: &winit::window::Window, ) where C: Compositor<Renderer = A::Renderer> + 'static, - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { for message in messages.drain(..) { debug.log_message(&message); @@ -663,7 +661,7 @@ pub fn run_command<A, C, E>( A: Application, E: Executor, C: Compositor<Renderer = A::Renderer> + 'static, - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { use crate::runtime::command; use crate::runtime::system; diff --git a/winit/src/application/state.rs b/winit/src/application/state.rs index 8c9b20e0..c17a3bcc 100644 --- a/winit/src/application/state.rs +++ b/winit/src/application/state.rs @@ -1,6 +1,5 @@ use crate::application::{self, StyleSheet as _}; use crate::conversion; -use crate::core; use crate::core::mouse; use crate::core::{Color, Size}; use crate::graphics::Viewport; @@ -15,7 +14,7 @@ use winit::window::Window; #[allow(missing_debug_implementations)] pub struct State<A: Application> where - <A::Renderer as core::Renderer>::Theme: application::StyleSheet, + A::Theme: application::StyleSheet, { title: String, scale_factor: f64, @@ -23,14 +22,14 @@ where viewport_version: usize, cursor_position: Option<winit::dpi::PhysicalPosition<f64>>, modifiers: winit::keyboard::ModifiersState, - theme: <A::Renderer as core::Renderer>::Theme, + theme: A::Theme, appearance: application::Appearance, application: PhantomData<A>, } impl<A: Application> State<A> where - <A::Renderer as core::Renderer>::Theme: application::StyleSheet, + A::Theme: application::StyleSheet, { /// Creates a new [`State`] for the provided [`Application`] and window. pub fn new(application: &A, window: &Window) -> Self { @@ -107,7 +106,7 @@ where } /// Returns the current theme of the [`State`]. - pub fn theme(&self) -> &<A::Renderer as core::Renderer>::Theme { + pub fn theme(&self) -> &A::Theme { &self.theme } diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs index 3f0ba056..1c45ce37 100644 --- a/winit/src/multi_window.rs +++ b/winit/src/multi_window.rs @@ -40,7 +40,7 @@ use std::time::Instant; /// can be toggled by pressing `F12`. pub trait Application: Program where - <Self::Renderer as core::Renderer>::Theme: StyleSheet, + Self::Theme: StyleSheet, { /// The data needed to initialize your [`Application`]. type Flags; @@ -62,15 +62,10 @@ where fn title(&self, window: window::Id) -> String; /// Returns the current `Theme` of the [`Application`]. - fn theme( - &self, - window: window::Id, - ) -> <Self::Renderer as core::Renderer>::Theme; + fn theme(&self, window: window::Id) -> Self::Theme; /// Returns the `Style` variation of the `Theme`. - fn style( - &self, - ) -> <<Self::Renderer as core::Renderer>::Theme as StyleSheet>::Style { + fn style(&self) -> <Self::Theme as StyleSheet>::Style { Default::default() } @@ -112,7 +107,7 @@ where A: Application + 'static, E: Executor + 'static, C: Compositor<Renderer = A::Renderer> + 'static, - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { use winit::event_loop::EventLoopBuilder; @@ -325,7 +320,7 @@ async fn run_instance<A, E, C>( A: Application + 'static, E: Executor + 'static, C: Compositor<Renderer = A::Renderer> + 'static, - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { use winit::event; use winit::event_loop::ControlFlow; @@ -793,9 +788,9 @@ fn build_user_interface<'a, A: Application>( size: Size, debug: &mut Debug, id: window::Id, -) -> UserInterface<'a, A::Message, A::Renderer> +) -> UserInterface<'a, A::Message, A::Theme, A::Renderer> where - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { debug.view_started(); let view = application.view(id); @@ -823,7 +818,7 @@ fn update<A: Application, C, E: Executor>( ui_caches: &mut HashMap<window::Id, user_interface::Cache>, ) where C: Compositor<Renderer = A::Renderer> + 'static, - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { for message in messages.drain(..) { debug.log_message(&message); @@ -866,7 +861,7 @@ fn run_command<A, C, E>( A: Application, E: Executor, C: Compositor<Renderer = A::Renderer> + 'static, - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { use crate::runtime::clipboard; use crate::runtime::system; @@ -1142,9 +1137,9 @@ pub fn build_user_interfaces<'a, A: Application, C: Compositor>( debug: &mut Debug, window_manager: &mut WindowManager<A, C>, mut cached_user_interfaces: HashMap<window::Id, user_interface::Cache>, -) -> HashMap<window::Id, UserInterface<'a, A::Message, A::Renderer>> +) -> HashMap<window::Id, UserInterface<'a, A::Message, A::Theme, A::Renderer>> where - <A::Renderer as core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, C: Compositor<Renderer = A::Renderer>, { cached_user_interfaces diff --git a/winit/src/multi_window/state.rs b/winit/src/multi_window/state.rs index 235771f4..2e97a13d 100644 --- a/winit/src/multi_window/state.rs +++ b/winit/src/multi_window/state.rs @@ -1,5 +1,4 @@ use crate::conversion; -use crate::core; use crate::core::{mouse, window}; use crate::core::{Color, Size}; use crate::graphics::Viewport; @@ -14,7 +13,7 @@ use winit::window::Window; /// The state of a multi-windowed [`Application`]. pub struct State<A: Application> where - <A::Renderer as core::Renderer>::Theme: application::StyleSheet, + A::Theme: application::StyleSheet, { title: String, scale_factor: f64, @@ -22,13 +21,13 @@ where viewport_version: u64, cursor_position: Option<winit::dpi::PhysicalPosition<f64>>, modifiers: winit::keyboard::ModifiersState, - theme: <A::Renderer as core::Renderer>::Theme, + theme: A::Theme, appearance: application::Appearance, } impl<A: Application> Debug for State<A> where - <A::Renderer as core::Renderer>::Theme: application::StyleSheet, + A::Theme: application::StyleSheet, { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("multi_window::State") @@ -44,7 +43,7 @@ where impl<A: Application> State<A> where - <A::Renderer as core::Renderer>::Theme: application::StyleSheet, + A::Theme: application::StyleSheet, { /// Creates a new [`State`] for the provided [`Application`]'s `window`. pub fn new( @@ -124,7 +123,7 @@ where } /// Returns the current theme of the [`State`]. - pub fn theme(&self) -> &<A::Renderer as core::Renderer>::Theme { + pub fn theme(&self) -> &A::Theme { &self.theme } diff --git a/winit/src/multi_window/window_manager.rs b/winit/src/multi_window/window_manager.rs index 9e15f9ea..23f3c0ba 100644 --- a/winit/src/multi_window/window_manager.rs +++ b/winit/src/multi_window/window_manager.rs @@ -12,7 +12,7 @@ use winit::monitor::MonitorHandle; #[allow(missing_debug_implementations)] pub struct WindowManager<A: Application, C: Compositor> where - <A::Renderer as crate::core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, C: Compositor<Renderer = A::Renderer>, { aliases: BTreeMap<winit::window::WindowId, Id>, @@ -23,7 +23,7 @@ impl<A, C> WindowManager<A, C> where A: Application, C: Compositor<Renderer = A::Renderer>, - <A::Renderer as crate::core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { pub fn new() -> Self { Self { @@ -109,7 +109,7 @@ impl<A, C> Default for WindowManager<A, C> where A: Application, C: Compositor<Renderer = A::Renderer>, - <A::Renderer as crate::core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { fn default() -> Self { Self::new() @@ -121,7 +121,7 @@ pub struct Window<A, C> where A: Application, C: Compositor<Renderer = A::Renderer>, - <A::Renderer as crate::core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { pub raw: Arc<winit::window::Window>, pub state: State<A>, @@ -136,7 +136,7 @@ impl<A, C> Window<A, C> where A: Application, C: Compositor<Renderer = A::Renderer>, - <A::Renderer as crate::core::Renderer>::Theme: StyleSheet, + A::Theme: StyleSheet, { pub fn position(&self) -> Option<Point> { self.raw |