diff options
Diffstat (limited to 'winit/src')
-rw-r--r-- | winit/src/application.rs | 16 | ||||
-rw-r--r-- | winit/src/application/state.rs | 13 |
2 files changed, 7 insertions, 22 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index abe6b8a9..55fd9e73 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -6,9 +6,10 @@ pub use state::State; use crate::clipboard::{self, Clipboard}; use crate::conversion; use crate::mouse; +use crate::theme::{self, Definition as _}; use crate::{ - Color, Command, Debug, Error, Executor, Mode, Proxy, Runtime, Settings, - Size, Subscription, + Command, Debug, Error, Executor, Mode, Proxy, Runtime, Settings, Size, + Subscription, }; use iced_futures::futures; @@ -77,13 +78,6 @@ pub trait Application: Program { Mode::Windowed } - /// Returns the background [`Color`] of the [`Application`]. - /// - /// By default, it returns [`Color::WHITE`]. - fn background_color(&self) -> Color { - Color::WHITE - } - /// Returns the scale factor of the [`Application`]. /// /// It can be used to dynamically control the size of the UI at runtime @@ -115,6 +109,7 @@ where A: Application + 'static, E: Executor + 'static, C: window::Compositor<Renderer = A::Renderer> + 'static, + <A::Renderer as iced_native::Renderer>::Theme: theme::Definition, { use futures::task; use futures::Future; @@ -250,6 +245,7 @@ async fn run_instance<A, E, C>( A: Application + 'static, E: Executor + 'static, C: window::Compositor<Renderer = A::Renderer> + 'static, + <A::Renderer as iced_native::Renderer>::Theme: theme::Definition, { use iced_futures::futures::stream::StreamExt; use winit::event; @@ -425,7 +421,7 @@ async fn run_instance<A, E, C>( &mut renderer, &mut surface, state.viewport(), - state.background_color(), + theme.background_color(), &debug.overlay(), ) { Ok(()) => { diff --git a/winit/src/application/state.rs b/winit/src/application/state.rs index b54d3aed..34a9b10e 100644 --- a/winit/src/application/state.rs +++ b/winit/src/application/state.rs @@ -1,5 +1,5 @@ use crate::conversion; -use crate::{Application, Color, Debug, Mode, Point, Size, Viewport}; +use crate::{Application, Debug, Mode, Point, Size, Viewport}; use std::marker::PhantomData; use winit::event::{Touch, WindowEvent}; @@ -10,7 +10,6 @@ use winit::window::Window; pub struct State<A: Application> { title: String, mode: Mode, - background_color: Color, scale_factor: f64, viewport: Viewport, viewport_version: usize, @@ -24,7 +23,6 @@ impl<A: Application> State<A> { pub fn new(application: &A, window: &Window) -> Self { let title = application.title(); let mode = application.mode(); - let background_color = application.background_color(); let scale_factor = application.scale_factor(); let viewport = { @@ -39,7 +37,6 @@ impl<A: Application> State<A> { Self { title, mode, - background_color, scale_factor, viewport, viewport_version: 0, @@ -50,11 +47,6 @@ impl<A: Application> State<A> { } } - /// Returns the current background [`Color`] of the [`State`]. - pub fn background_color(&self) -> Color { - self.background_color - } - /// Returns the current [`Viewport`] of the [`State`]. pub fn viewport(&self) -> &Viewport { &self.viewport @@ -187,9 +179,6 @@ impl<A: Application> State<A> { self.mode = new_mode; } - // Update background color - self.background_color = application.background_color(); - // Update scale factor let new_scale_factor = application.scale_factor(); |