Remove Compositor window generic

And update `glyphon` and `window_clipboard`
This commit is contained in:
Héctor Ramón Jiménez 2024-01-18 09:55:27 +01:00
parent 7289b6091b
commit 8bf2386972
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
18 changed files with 126 additions and 114 deletions

View file

@ -106,7 +106,7 @@ pub fn run<A, E, C>(
where
A: Application + 'static,
E: Executor + 'static,
C: Compositor<Arc<winit::window::Window>, Renderer = A::Renderer> + 'static,
C: Compositor<Renderer = A::Renderer> + 'static,
<A::Renderer as core::Renderer>::Theme: StyleSheet,
{
use futures::task;
@ -258,7 +258,7 @@ async fn run_instance<A, E, C>(
) where
A: Application + 'static,
E: Executor + 'static,
C: Compositor<Arc<winit::window::Window>, Renderer = A::Renderer> + 'static,
C: Compositor<Renderer = A::Renderer> + 'static,
<A::Renderer as core::Renderer>::Theme: StyleSheet,
{
use futures::stream::StreamExt;
@ -612,7 +612,7 @@ pub fn update<A: Application, C, E: Executor>(
messages: &mut Vec<A::Message>,
window: &winit::window::Window,
) where
C: Compositor<Arc<winit::window::Window>, Renderer = A::Renderer> + 'static,
C: Compositor<Renderer = A::Renderer> + 'static,
<A::Renderer as core::Renderer>::Theme: StyleSheet,
{
for message in messages.drain(..) {
@ -663,7 +663,7 @@ pub fn run_command<A, C, E>(
) where
A: Application,
E: Executor,
C: Compositor<Arc<winit::window::Window>, Renderer = A::Renderer> + 'static,
C: Compositor<Renderer = A::Renderer> + 'static,
<A::Renderer as core::Renderer>::Theme: StyleSheet,
{
use crate::runtime::command;

View file

@ -24,6 +24,7 @@ use crate::{Clipboard, Error, Proxy, Settings};
use std::collections::HashMap;
use std::mem::ManuallyDrop;
use std::sync::Arc;
use std::time::Instant;
/// An interactive, native, cross-platform, multi-windowed application.
@ -150,9 +151,11 @@ where
log::info!("Window builder: {:#?}", builder);
let main_window = builder
.build(&event_loop)
.map_err(Error::WindowCreationFailed)?;
let main_window = Arc::new(
builder
.build(&event_loop)
.map_err(Error::WindowCreationFailed)?,
);
#[cfg(target_arch = "wasm32")]
{
@ -184,7 +187,8 @@ where
};
}
let mut compositor = C::new(compositor_settings, Some(&main_window))?;
let mut compositor =
C::new(compositor_settings, Some(main_window.clone()))?;
let mut window_manager = WindowManager::new();
let _ = window_manager.insert(
@ -388,7 +392,7 @@ async fn run_instance<A, E, C>(
} => {
let window = window_manager.insert(
id,
window,
Arc::new(window),
&application,
&mut compositor,
exit_on_close_request,

View file

@ -6,6 +6,7 @@ use crate::multi_window::{Application, State};
use crate::style::application::StyleSheet;
use std::collections::BTreeMap;
use std::sync::Arc;
use winit::monitor::MonitorHandle;
#[allow(missing_debug_implementations)]
@ -34,7 +35,7 @@ where
pub fn insert(
&mut self,
id: Id,
window: winit::window::Window,
window: Arc<winit::window::Window>,
application: &A,
compositor: &mut C,
exit_on_close_request: bool,
@ -43,7 +44,7 @@ where
let viewport_version = state.viewport_version();
let physical_size = state.physical_size();
let surface = compositor.create_surface(
&window,
window.clone(),
physical_size.width,
physical_size.height,
);
@ -122,7 +123,7 @@ where
C: Compositor<Renderer = A::Renderer>,
<A::Renderer as crate::core::Renderer>::Theme: StyleSheet,
{
pub raw: winit::window::Window,
pub raw: Arc<winit::window::Window>,
pub state: State<A>,
pub viewport_version: u64,
pub exit_on_close_request: bool,