From 7a50e9e8fbb8d37e53a42c1dd5936b97463ead53 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 21 Jan 2024 17:56:01 +0100 Subject: Convert `Renderer::Theme` to generic `Widget` type --- winit/src/multi_window.rs | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'winit/src/multi_window.rs') 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 - ::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, - ) -> ::Theme; + fn theme(&self, window: window::Id) -> Self::Theme; /// Returns the `Style` variation of the `Theme`. - fn style( - &self, - ) -> <::Theme as StyleSheet>::Style { + fn style(&self) -> ::Style { Default::default() } @@ -112,7 +107,7 @@ where A: Application + 'static, E: Executor + 'static, C: Compositor + 'static, - ::Theme: StyleSheet, + A::Theme: StyleSheet, { use winit::event_loop::EventLoopBuilder; @@ -325,7 +320,7 @@ async fn run_instance( A: Application + 'static, E: Executor + 'static, C: Compositor + 'static, - ::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 - ::Theme: StyleSheet, + A::Theme: StyleSheet, { debug.view_started(); let view = application.view(id); @@ -823,7 +818,7 @@ fn update( ui_caches: &mut HashMap, ) where C: Compositor + 'static, - ::Theme: StyleSheet, + A::Theme: StyleSheet, { for message in messages.drain(..) { debug.log_message(&message); @@ -866,7 +861,7 @@ fn run_command( A: Application, E: Executor, C: Compositor + 'static, - ::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, mut cached_user_interfaces: HashMap, -) -> HashMap> +) -> HashMap> where - ::Theme: StyleSheet, + A::Theme: StyleSheet, C: Compositor, { cached_user_interfaces -- cgit