From 8bf238697226e827dc983f9d89afbd0e252c5254 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 18 Jan 2024 09:55:27 +0100 Subject: Remove `Compositor` window generic And update `glyphon` and `window_clipboard` --- renderer/Cargo.toml | 1 - renderer/src/compositor.rs | 36 ++++++++++++++---------------------- 2 files changed, 14 insertions(+), 23 deletions(-) (limited to 'renderer') diff --git a/renderer/Cargo.toml b/renderer/Cargo.toml index 56e17209..a159978c 100644 --- a/renderer/Cargo.toml +++ b/renderer/Cargo.toml @@ -27,5 +27,4 @@ iced_wgpu.workspace = true iced_wgpu.optional = true log.workspace = true -raw-window-handle.workspace = true thiserror.workspace = true diff --git a/renderer/src/compositor.rs b/renderer/src/compositor.rs index 17157c66..a7c63444 100644 --- a/renderer/src/compositor.rs +++ b/renderer/src/compositor.rs @@ -1,36 +1,28 @@ use crate::core::Color; -use crate::graphics::compositor::{Information, SurfaceError}; +use crate::graphics::compositor::{Information, SurfaceError, Window}; use crate::graphics::{Error, Viewport}; use crate::{Renderer, Settings}; -use raw_window_handle::{HasDisplayHandle, HasWindowHandle}; use std::env; -pub enum Compositor { - TinySkia(iced_tiny_skia::window::Compositor), +pub enum Compositor { + TinySkia(iced_tiny_skia::window::Compositor), #[cfg(feature = "wgpu")] - Wgpu(iced_wgpu::window::Compositor), + Wgpu(iced_wgpu::window::Compositor), } -pub enum Surface { - TinySkia(iced_tiny_skia::window::Surface), +pub enum Surface { + TinySkia(iced_tiny_skia::window::Surface), #[cfg(feature = "wgpu")] Wgpu(iced_wgpu::window::Surface<'static>), } -// XXX Clone bound -// XXX Send/Sync? -// 'static? -impl< - W: Clone + Send + Sync + HasWindowHandle + HasDisplayHandle + 'static, - Theme, - > crate::graphics::Compositor for Compositor -{ +impl crate::graphics::Compositor for Compositor { type Settings = Settings; type Renderer = Renderer; - type Surface = Surface; + type Surface = Surface; - fn new( + fn new( settings: Self::Settings, compatible_window: Option, ) -> Result { @@ -63,12 +55,12 @@ impl< } } - fn create_surface( + fn create_surface( &mut self, window: W, width: u32, height: u32, - ) -> Surface { + ) -> Surface { match self { Self::TinySkia(compositor) => Surface::TinySkia( compositor.create_surface(window, width, height), @@ -82,7 +74,7 @@ impl< fn configure_surface( &mut self, - surface: &mut Surface, + surface: &mut Surface, width: u32, height: u32, ) { @@ -233,11 +225,11 @@ impl Candidate { ) } - fn build( + fn build( self, settings: Settings, _compatible_window: Option, - ) -> Result, Error> { + ) -> Result, Error> { match self { Self::TinySkia => { let compositor = iced_tiny_skia::window::compositor::new( -- cgit