Allow custom renderers in Program and Application

This commit is contained in:
Héctor Ramón Jiménez 2024-03-22 07:09:51 +01:00
parent 4f2f40c68b
commit 5137d655e6
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
19 changed files with 162 additions and 122 deletions

View file

@ -13,6 +13,7 @@ use crate::core::window;
use crate::core::{Color, Event, Point, Size, Theme};
use crate::futures::futures;
use crate::futures::{Executor, Runtime, Subscription};
use crate::graphics;
use crate::graphics::compositor::{self, Compositor};
use crate::runtime::clipboard;
use crate::runtime::program::Program;
@ -130,7 +131,7 @@ pub fn default(theme: &Theme) -> Appearance {
/// settings.
pub async fn run<A, E, C>(
settings: Settings<A::Flags>,
compositor_settings: impl Into<C::Settings>,
graphics_settings: graphics::Settings,
) -> Result<(), Error>
where
A: Application + 'static,
@ -219,7 +220,7 @@ where
};
}
let compositor = C::new(compositor_settings.into(), window.clone()).await?;
let compositor = C::new(graphics_settings, window.clone()).await?;
let mut renderer = compositor.create_renderer();
for font in settings.fonts {

View file

@ -16,6 +16,7 @@ use crate::futures::futures::executor;
use crate::futures::futures::task;
use crate::futures::futures::{Future, StreamExt};
use crate::futures::{Executor, Runtime, Subscription};
use crate::graphics;
use crate::graphics::{compositor, Compositor};
use crate::multi_window::window_manager::WindowManager;
use crate::runtime::command::{self, Command};
@ -105,7 +106,7 @@ where
/// settings.
pub fn run<A, E, C>(
settings: Settings<A::Flags>,
compositor_settings: impl Into<C::Settings>,
graphics_settings: graphics::Settings,
) -> Result<(), Error>
where
A: Application + 'static,
@ -186,10 +187,8 @@ where
};
}
let mut compositor = executor::block_on(C::new(
compositor_settings.into(),
main_window.clone(),
))?;
let mut compositor =
executor::block_on(C::new(graphics_settings, main_window.clone()))?;
let mut window_manager = WindowManager::new();
let _ = window_manager.insert(