summaryrefslogtreecommitdiffstats
path: root/renderer
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-18 09:55:27 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-18 09:55:27 +0100
commit8bf238697226e827dc983f9d89afbd0e252c5254 (patch)
tree3594e998d60b130ab6b161aa00159e2311cbde0a /renderer
parent7289b6091b61b0aa448a756cfe32211c78a4cce0 (diff)
downloadiced-8bf238697226e827dc983f9d89afbd0e252c5254.tar.gz
iced-8bf238697226e827dc983f9d89afbd0e252c5254.tar.bz2
iced-8bf238697226e827dc983f9d89afbd0e252c5254.zip
Remove `Compositor` window generic
And update `glyphon` and `window_clipboard`
Diffstat (limited to 'renderer')
-rw-r--r--renderer/Cargo.toml1
-rw-r--r--renderer/src/compositor.rs36
2 files changed, 14 insertions, 23 deletions
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<W: HasWindowHandle + HasDisplayHandle, Theme> {
- TinySkia(iced_tiny_skia::window::Compositor<W, Theme>),
+pub enum Compositor<Theme> {
+ TinySkia(iced_tiny_skia::window::Compositor<Theme>),
#[cfg(feature = "wgpu")]
- Wgpu(iced_wgpu::window::Compositor<W, Theme>),
+ Wgpu(iced_wgpu::window::Compositor<Theme>),
}
-pub enum Surface<W: HasWindowHandle + HasDisplayHandle> {
- TinySkia(iced_tiny_skia::window::Surface<W>),
+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<W> for Compositor<W, Theme>
-{
+impl<Theme> crate::graphics::Compositor for Compositor<Theme> {
type Settings = Settings;
type Renderer = Renderer<Theme>;
- type Surface = Surface<W>;
+ type Surface = Surface;
- fn new(
+ fn new<W: Window + Clone>(
settings: Self::Settings,
compatible_window: Option<W>,
) -> Result<Self, Error> {
@@ -63,12 +55,12 @@ impl<
}
}
- fn create_surface(
+ fn create_surface<W: Window + Clone>(
&mut self,
window: W,
width: u32,
height: u32,
- ) -> Surface<W> {
+ ) -> 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<W>,
+ surface: &mut Surface,
width: u32,
height: u32,
) {
@@ -233,11 +225,11 @@ impl Candidate {
)
}
- fn build<Theme, W: HasWindowHandle + HasDisplayHandle + Send + Sync>(
+ fn build<Theme, W: Window>(
self,
settings: Settings,
_compatible_window: Option<W>,
- ) -> Result<Compositor<W, Theme>, Error> {
+ ) -> Result<Compositor<Theme>, Error> {
match self {
Self::TinySkia => {
let compositor = iced_tiny_skia::window::compositor::new(