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/application.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'winit/src/application.rs') 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 - ::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) -> ::Theme; + fn theme(&self) -> Self::Theme; /// Returns the `Style` variation of the `Theme`. - fn style( - &self, - ) -> <::Theme as StyleSheet>::Style { + fn style(&self) -> ::Style { Default::default() } @@ -107,7 +105,7 @@ where A: Application + 'static, E: Executor + 'static, C: Compositor + 'static, - ::Theme: StyleSheet, + A::Theme: StyleSheet, { use futures::task; use futures::Future; @@ -258,7 +256,7 @@ async fn run_instance( A: Application + 'static, E: Executor + 'static, C: Compositor + 'static, - ::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 - ::Theme: StyleSheet, + A::Theme: StyleSheet, { debug.view_started(); let view = application.view(); @@ -612,7 +610,7 @@ pub fn update( window: &winit::window::Window, ) where C: Compositor + 'static, - ::Theme: StyleSheet, + A::Theme: StyleSheet, { for message in messages.drain(..) { debug.log_message(&message); @@ -663,7 +661,7 @@ pub fn run_command( A: Application, E: Executor, C: Compositor + 'static, - ::Theme: StyleSheet, + A::Theme: StyleSheet, { use crate::runtime::command; use crate::runtime::system; -- cgit