From 7289b6091b61b0aa448a756cfe32211c78a4cce0 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 9 Jan 2024 07:19:15 -0800 Subject: WIP raw-window-handle 0.6 --- winit/src/application.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index bf48538d..d639a36b 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -24,6 +24,7 @@ use crate::{Clipboard, Error, Proxy, Settings}; use futures::channel::mpsc; use std::mem::ManuallyDrop; +use std::sync::Arc; /// An interactive, native cross-platform application. /// @@ -105,7 +106,7 @@ pub fn run( where A: Application + 'static, E: Executor + 'static, - C: Compositor + 'static, + C: Compositor, Renderer = A::Renderer> + 'static, ::Theme: StyleSheet, { use futures::task; @@ -149,9 +150,12 @@ where log::debug!("Window builder: {builder:#?}"); - let window = builder - .build(&event_loop) - .map_err(Error::WindowCreationFailed)?; + // XXX Arc? + let window = Arc::new( + builder + .build(&event_loop) + .map_err(Error::WindowCreationFailed)?, + ); #[cfg(target_arch = "wasm32")] { @@ -183,7 +187,7 @@ where }; } - let compositor = C::new(compositor_settings, Some(&window))?; + let compositor = C::new(compositor_settings, Some(window.clone()))?; let mut renderer = compositor.create_renderer(); for font in settings.fonts { @@ -248,13 +252,13 @@ async fn run_instance( >, mut control_sender: mpsc::UnboundedSender, init_command: Command, - window: winit::window::Window, + window: Arc, should_be_visible: bool, exit_on_close_request: bool, ) where A: Application + 'static, E: Executor + 'static, - C: Compositor + 'static, + C: Compositor, Renderer = A::Renderer> + 'static, ::Theme: StyleSheet, { use futures::stream::StreamExt; @@ -268,7 +272,7 @@ async fn run_instance( let mut clipboard = Clipboard::connect(&window); let mut cache = user_interface::Cache::default(); let mut surface = compositor.create_surface( - &window, + window.clone(), physical_size.width, physical_size.height, ); @@ -608,7 +612,7 @@ pub fn update( messages: &mut Vec, window: &winit::window::Window, ) where - C: Compositor + 'static, + C: Compositor, Renderer = A::Renderer> + 'static, ::Theme: StyleSheet, { for message in messages.drain(..) { @@ -659,7 +663,7 @@ pub fn run_command( ) where A: Application, E: Executor, - C: Compositor + 'static, + C: Compositor, Renderer = A::Renderer> + 'static, ::Theme: StyleSheet, { use crate::runtime::command; -- cgit 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` --- winit/src/application.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index d639a36b..c5e11167 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -106,7 +106,7 @@ pub fn run( where A: Application + 'static, E: Executor + 'static, - C: Compositor, Renderer = A::Renderer> + 'static, + C: Compositor + 'static, ::Theme: StyleSheet, { use futures::task; @@ -258,7 +258,7 @@ async fn run_instance( ) where A: Application + 'static, E: Executor + 'static, - C: Compositor, Renderer = A::Renderer> + 'static, + C: Compositor + 'static, ::Theme: StyleSheet, { use futures::stream::StreamExt; @@ -612,7 +612,7 @@ pub fn update( messages: &mut Vec, window: &winit::window::Window, ) where - C: Compositor, Renderer = A::Renderer> + 'static, + C: Compositor + 'static, ::Theme: StyleSheet, { for message in messages.drain(..) { @@ -663,7 +663,7 @@ pub fn run_command( ) where A: Application, E: Executor, - C: Compositor, Renderer = A::Renderer> + 'static, + C: Compositor + 'static, ::Theme: StyleSheet, { use crate::runtime::command; -- cgit From 5fc49edc55a0e64c4c46ca55eddafe9d4e8232e1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 18 Jan 2024 10:06:30 +0100 Subject: Make `compatible_window` mandatory in `Compositor` --- winit/src/application.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index c5e11167..5fcdbbd8 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -187,7 +187,7 @@ where }; } - let compositor = C::new(compositor_settings, Some(window.clone()))?; + let compositor = C::new(compositor_settings, window.clone())?; let mut renderer = compositor.create_renderer(); for font in settings.fonts { -- cgit From 74a6e58cbc3354d45ed6cd86e58c624a946d0f05 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 18 Jan 2024 10:57:53 +0100 Subject: Remove comment in `iced_winit::application` --- winit/src/application.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 5fcdbbd8..09bf63cc 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -150,7 +150,6 @@ where log::debug!("Window builder: {builder:#?}"); - // XXX Arc? let window = Arc::new( builder .build(&event_loop) -- cgit