From 0ad53a3d5c7b5fb5785a64102ee1ad7df9a5fb2b Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 19 Sep 2022 20:59:37 -0300 Subject: add `window::Id` to `Event` and `Action` --- winit/src/application.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 74c73815..4486f5d9 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -502,6 +502,7 @@ async fn run_instance( state.update(&window, &window_event, &mut debug); if let Some(event) = conversion::window_event( + crate::window::Id::MAIN, &window_event, state.scale_factor(), state.modifiers(), @@ -667,7 +668,7 @@ pub fn run_command( clipboard.write(contents); } }, - command::Action::Window(action) => match action { + command::Action::Window(_id, action) => match action { window::Action::Close => { *should_exit = true; } -- cgit From f93fa0254329ebddca21ea1a79bd8ee6d8b4bdaf Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 19 Oct 2022 23:33:20 -0300 Subject: introduce `window::spawn` and `window::close` --- winit/src/application.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 4486f5d9..910f3d94 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -675,6 +675,11 @@ pub fn run_command( window::Action::Drag => { let _res = window.drag_window(); } + window::Action::Spawn { .. } | window::Action::Close => { + log::info!( + "This is only available on `multi_window::Application`" + ) + } window::Action::Resize { width, height } => { window.set_inner_size(winit::dpi::LogicalSize { width, -- cgit From ec41918ec40bddaba81235372f1566da59fd09f2 Mon Sep 17 00:00:00 2001 From: bungoboingo Date: Thu, 5 Jan 2023 15:26:28 -0800 Subject: Implemented window title update functionality for multiwindow. --- 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 910f3d94..eef6833c 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -675,7 +675,7 @@ pub fn run_command( window::Action::Drag => { let _res = window.drag_window(); } - window::Action::Spawn { .. } | window::Action::Close => { + window::Action::Spawn { .. } => { log::info!( "This is only available on `multi_window::Application`" ) -- cgit From 790fa3e7a01a790aa3f07083fe9abf6b68fa7ba1 Mon Sep 17 00:00:00 2001 From: Bingus Date: Fri, 13 Jan 2023 11:56:28 -0800 Subject: Added tracing to multi_window applications --- winit/src/application.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index eef6833c..76553988 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -1,6 +1,4 @@ //! Create interactive, native cross-platform applications. -#[cfg(feature = "trace")] -mod profiler; mod state; pub use state::State; @@ -27,7 +25,7 @@ pub use iced_native::application::{Appearance, StyleSheet}; use std::mem::ManuallyDrop; #[cfg(feature = "trace")] -pub use profiler::Profiler; +pub use crate::Profiler; #[cfg(feature = "trace")] use tracing::{info_span, instrument::Instrument}; -- cgit From 7e9a12a4aa64deda193dfc0f18c34f93e3adc852 Mon Sep 17 00:00:00 2001 From: Bingus Date: Wed, 18 Jan 2023 15:17:20 -0800 Subject: New iced changes --- winit/src/application.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index c66e08b2..d586fd21 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -402,6 +402,7 @@ async fn run_instance( // Then, we can use the `interface_state` here to decide if a redraw // is needed right away, or simply wait until a specific time. let redraw_event = Event::Window( + crate::window::Id::MAIN, crate::window::Event::RedrawRequested(Instant::now()), ); -- cgit From e36daa6f937abd7cb2071fd8852a3c12263944ea Mon Sep 17 00:00:00 2001 From: bungoboingo Date: Tue, 28 Feb 2023 13:44:36 -0800 Subject: Removed glutin MW support and reverted glutin changes back to Iced master since it's being axed as we speak. --- 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 58556da4..1310ba1c 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -734,7 +734,7 @@ pub fn run_command( clipboard.write(contents); } }, - command::Action::Window(_id, action) => match action { + command::Action::Window(_, action) => match action { window::Action::Close => { *should_exit = true; } -- cgit From 8ba18430800142965549077373e2a45d0a3429a1 Mon Sep 17 00:00:00 2001 From: Bingus Date: Mon, 13 Mar 2023 14:16:45 -0700 Subject: Code cleanup, clearer comments + removed some unnecessary dupe; Removed `Frames` struct return for `window::frames()` since we are just redrawing every window anyways; Interface dropping; --- 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 906da3c6..fe97486f 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -743,7 +743,7 @@ pub fn run_command( } window::Action::Spawn { .. } => { log::info!( - "This is only available on `multi_window::Application`" + "Spawning a window is only available with `multi_window::Application`s." ) } window::Action::Resize { width, height } => { -- cgit From d53ccc857da4d4cda769904342aeb5a82a64f146 Mon Sep 17 00:00:00 2001 From: Bingus Date: Wed, 12 Jul 2023 19:21:05 -0700 Subject: refactored window storage; new helper window events (Destroyed, Created); clippy + fmt; --- winit/src/application.rs | 86 +++++++++++++----------------------------------- 1 file changed, 23 insertions(+), 63 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index ab7b2495..5c45bbda 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -18,6 +18,7 @@ use crate::runtime::clipboard; use crate::runtime::program::Program; use crate::runtime::user_interface::{self, UserInterface}; use crate::runtime::{Command, Debug}; +use crate::settings; use crate::style::application::{Appearance, StyleSheet}; use crate::{Clipboard, Error, Proxy, Settings}; @@ -25,11 +26,6 @@ use futures::channel::mpsc; use std::mem::ManuallyDrop; -#[cfg(feature = "trace")] -pub use crate::Profiler; -#[cfg(feature = "trace")] -use tracing::{info_span, instrument::Instrument}; - /// An interactive, native cross-platform application. /// /// This trait is the main entrypoint of Iced. Once implemented, you can run @@ -117,15 +113,9 @@ where use futures::Future; use winit::event_loop::EventLoopBuilder; - #[cfg(feature = "trace")] - let _guard = Profiler::init(); - let mut debug = Debug::new(); debug.startup_started(); - #[cfg(feature = "trace")] - let _ = info_span!("Application", "RUN").entered(); - let event_loop = EventLoopBuilder::with_user_event().build(); let proxy = event_loop.create_proxy(); @@ -146,14 +136,13 @@ where let target = settings.window.platform_specific.target.clone(); let should_be_visible = settings.window.visible; - let builder = settings - .window - .into_builder( - &application.title(), - event_loop.primary_monitor(), - settings.id, - ) - .with_visible(false); + let builder = settings::window_builder( + settings.window, + &application.title(), + event_loop.primary_monitor(), + settings.id, + ) + .with_visible(false); log::debug!("Window builder: {:#?}", builder); @@ -196,28 +185,20 @@ where let (mut event_sender, event_receiver) = mpsc::unbounded(); let (control_sender, mut control_receiver) = mpsc::unbounded(); - let mut instance = Box::pin({ - let run_instance = run_instance::( - application, - compositor, - renderer, - runtime, - proxy, - debug, - event_receiver, - control_sender, - init_command, - window, - should_be_visible, - settings.exit_on_close_request, - ); - - #[cfg(feature = "trace")] - let run_instance = - run_instance.instrument(info_span!("Application", "LOOP")); - - run_instance - }); + let mut instance = Box::pin(run_instance::( + application, + compositor, + renderer, + runtime, + proxy, + debug, + event_receiver, + control_sender, + init_command, + window, + should_be_visible, + settings.exit_on_close_request, + )); let mut context = task::Context::from_waker(task::noop_waker_ref()); @@ -480,9 +461,6 @@ async fn run_instance( messages.push(message); } event::Event::RedrawRequested(_) => { - #[cfg(feature = "trace")] - let _ = info_span!("Application", "FRAME").entered(); - let physical_size = state.physical_size(); if physical_size.width == 0 || physical_size.height == 0 { @@ -622,24 +600,12 @@ pub fn build_user_interface<'a, A: Application>( where ::Theme: StyleSheet, { - #[cfg(feature = "trace")] - let view_span = info_span!("Application", "VIEW").entered(); - debug.view_started(); let view = application.view(); - - #[cfg(feature = "trace")] - let _ = view_span.exit(); debug.view_finished(); - #[cfg(feature = "trace")] - let layout_span = info_span!("Application", "LAYOUT").entered(); - debug.layout_started(); let user_interface = UserInterface::build(view, size, cache, renderer); - - #[cfg(feature = "trace")] - let _ = layout_span.exit(); debug.layout_finished(); user_interface @@ -666,16 +632,10 @@ pub fn update( ::Theme: StyleSheet, { for message in messages.drain(..) { - #[cfg(feature = "trace")] - let update_span = info_span!("Application", "UPDATE").entered(); - debug.log_message(&message); debug.update_started(); let command = runtime.enter(|| application.update(message)); - - #[cfg(feature = "trace")] - let _ = update_span.exit(); debug.update_finished(); run_command( @@ -750,7 +710,7 @@ pub fn run_command( } window::Action::Spawn { .. } => { log::info!( - "Spawning a window is only available with `multi_window::Application`s." + "Spawning a window is only available with multi-window applications." ) } window::Action::Resize(size) => { -- cgit From 83c7870c569a2976923ee6243a19813094d44673 Mon Sep 17 00:00:00 2001 From: Bingus Date: Mon, 24 Jul 2023 14:32:59 -0700 Subject: Moved `exit_on_close_request` to window settings. This now controls whether each INDIVIDUAL window should close on CloseRequested events. --- winit/src/application.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 5c45bbda..cffcb884 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -136,6 +136,8 @@ where let target = settings.window.platform_specific.target.clone(); let should_be_visible = settings.window.visible; + let exit_on_close_request = settings.window.exit_on_close_request; + let builder = settings::window_builder( settings.window, &application.title(), @@ -197,7 +199,7 @@ where init_command, window, should_be_visible, - settings.exit_on_close_request, + exit_on_close_request, )); let mut context = task::Context::from_waker(task::noop_waker_ref()); -- cgit From e7326f0af6f16cf2ff04fbac93bf296a044923f4 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 18 Sep 2023 19:07:41 +0200 Subject: Flesh out the `editor` example a bit more --- winit/src/application.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index d1689452..e80e9783 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -193,7 +193,14 @@ where }; } - let (compositor, renderer) = C::new(compositor_settings, Some(&window))?; + let (compositor, mut renderer) = + C::new(compositor_settings, Some(&window))?; + + for font in settings.fonts { + use crate::core::text::Renderer; + + renderer.load_font(font); + } let (mut event_sender, event_receiver) = mpsc::unbounded(); let (control_sender, mut control_receiver) = mpsc::unbounded(); -- cgit From 3b7d479534d9114ed12bb5d9ccd910e85d5c13c7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 29 Nov 2023 00:12:48 +0100 Subject: Implement `Command::run` for executing a `Stream` to completion --- winit/src/application.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 315e34d9..2c5c864a 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -736,6 +736,9 @@ pub fn run_command( command::Action::Future(future) => { runtime.spawn(future); } + command::Action::Stream(stream) => { + runtime.run(stream); + } command::Action::Clipboard(action) => match action { clipboard::Action::Read(tag) => { let message = tag(clipboard.read()); -- cgit From 7def3ee38a3f0f24a331d722b09f325fc9584625 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 29 Nov 2023 22:37:54 +0100 Subject: Fix `clippy` lints --- winit/src/application.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 8457fd92..b197c4ed 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -720,9 +720,10 @@ pub fn run_command( let _res = window.drag_window(); } window::Action::Spawn { .. } => { - log::info!( - "Spawning a window is only available with multi-window applications." - ) + log::warn!( + "Spawning a window is only available with \ + multi-window applications." + ); } window::Action::Resize(size) => { window.set_inner_size(winit::dpi::LogicalSize { -- cgit From 67408311f45d341509538f8cc185978da66b6ace Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 30 Nov 2023 23:40:33 +0100 Subject: Use actual floats for logical coordinates --- winit/src/application.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index b197c4ed..4e6a879f 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -732,7 +732,8 @@ pub fn run_command( }); } window::Action::FetchSize(callback) => { - let size = window.inner_size(); + let size = + window.inner_size().to_logical(window.scale_factor()); proxy .send_event(callback(Size::new( @@ -747,10 +748,10 @@ pub fn run_command( window::Action::Minimize(minimized) => { window.set_minimized(minimized); } - window::Action::Move { x, y } => { + window::Action::Move(position) => { window.set_outer_position(winit::dpi::LogicalPosition { - x, - y, + x: position.x, + y: position.y, }); } window::Action::ChangeMode(mode) => { -- cgit From ea42af766f345715ff7a7168182d3896ee79cfbc Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 2 Dec 2023 20:41:58 +0100 Subject: Use `AtomicU64` for `window::Id` --- winit/src/application.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 4e6a879f..cc1db8cb 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -712,11 +712,11 @@ pub fn run_command( clipboard.write(contents); } }, - command::Action::Window(_, action) => match action { - window::Action::Close => { + command::Action::Window(action) => match action { + window::Action::Close(_id) => { *should_exit = true; } - window::Action::Drag => { + window::Action::Drag(_id) => { let _res = window.drag_window(); } window::Action::Spawn { .. } => { @@ -725,13 +725,13 @@ pub fn run_command( multi-window applications." ); } - window::Action::Resize(size) => { + window::Action::Resize(_id, size) => { window.set_inner_size(winit::dpi::LogicalSize { width: size.width, height: size.height, }); } - window::Action::FetchSize(callback) => { + window::Action::FetchSize(_id, callback) => { let size = window.inner_size().to_logical(window.scale_factor()); @@ -742,29 +742,29 @@ pub fn run_command( ))) .expect("Send message to event loop"); } - window::Action::Maximize(maximized) => { + window::Action::Maximize(_id, maximized) => { window.set_maximized(maximized); } - window::Action::Minimize(minimized) => { + window::Action::Minimize(_id, minimized) => { window.set_minimized(minimized); } - window::Action::Move(position) => { + window::Action::Move(_id, position) => { window.set_outer_position(winit::dpi::LogicalPosition { x: position.x, y: position.y, }); } - window::Action::ChangeMode(mode) => { + window::Action::ChangeMode(_id, mode) => { window.set_visible(conversion::visible(mode)); window.set_fullscreen(conversion::fullscreen( window.current_monitor(), mode, )); } - window::Action::ChangeIcon(icon) => { + window::Action::ChangeIcon(_id, icon) => { window.set_window_icon(conversion::icon(icon)); } - window::Action::FetchMode(tag) => { + window::Action::FetchMode(_id, tag) => { let mode = if window.is_visible().unwrap_or(true) { conversion::mode(window.fullscreen()) } else { @@ -775,29 +775,29 @@ pub fn run_command( .send_event(tag(mode)) .expect("Send message to event loop"); } - window::Action::ToggleMaximize => { + window::Action::ToggleMaximize(_id) => { window.set_maximized(!window.is_maximized()); } - window::Action::ToggleDecorations => { + window::Action::ToggleDecorations(_id) => { window.set_decorations(!window.is_decorated()); } - window::Action::RequestUserAttention(user_attention) => { + window::Action::RequestUserAttention(_id, user_attention) => { window.request_user_attention( user_attention.map(conversion::user_attention), ); } - window::Action::GainFocus => { + window::Action::GainFocus(_id) => { window.focus_window(); } - window::Action::ChangeLevel(level) => { + window::Action::ChangeLevel(_id, level) => { window.set_window_level(conversion::window_level(level)); } - window::Action::FetchId(tag) => { + window::Action::FetchId(_id, tag) => { proxy .send_event(tag(window.id().into())) .expect("Send message to event loop"); } - window::Action::Screenshot(tag) => { + window::Action::Screenshot(_id, tag) => { let bytes = compositor.screenshot( renderer, surface, -- cgit From b152ecda63238136f77b6eda3c582fa1eff99737 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 2 Dec 2023 20:49:47 +0100 Subject: Separate `Compositor::new` from `Compositor::create_renderer` --- winit/src/application.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index cc1db8cb..d9700075 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -181,8 +181,8 @@ where }; } - let (compositor, mut renderer) = - C::new(compositor_settings, Some(&window))?; + let compositor = C::new(compositor_settings, Some(&window))?; + let mut renderer = compositor.create_renderer(); for font in settings.fonts { use crate::core::text::Renderer; -- cgit From e819c2390bad76e811265245bd5fab63fc30a8b2 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 15 Dec 2023 13:15:44 +0100 Subject: Update `winit` to `0.29.4` --- winit/src/application.rs | 341 ++++++++++++++++++++--------------------------- 1 file changed, 141 insertions(+), 200 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index d9700075..ed6ba9eb 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -115,7 +115,9 @@ where let mut debug = Debug::new(); debug.startup_started(); - let event_loop = EventLoopBuilder::with_user_event().build(); + let event_loop = EventLoopBuilder::with_user_event() + .build() + .expect("Create event loop"); let proxy = event_loop.create_proxy(); let runtime = { @@ -155,7 +157,7 @@ where { use winit::platform::web::WindowExtWebSys; - let canvas = window.canvas(); + let canvas = window.canvas().expect("Get window canvas"); let window = web_sys::window().unwrap(); let document = window.document().unwrap(); @@ -210,45 +212,28 @@ where let mut context = task::Context::from_waker(task::noop_waker_ref()); - platform::run(event_loop, move |event, _, control_flow| { - use winit::event_loop::ControlFlow; - - if let ControlFlow::ExitWithCode(_) = control_flow { + let _ = event_loop.run(move |event, event_loop| { + if event_loop.exiting() { return; } - let event = match event { - winit::event::Event::WindowEvent { - event: - winit::event::WindowEvent::ScaleFactorChanged { - new_inner_size, - .. - }, - window_id, - } => Some(winit::event::Event::WindowEvent { - event: winit::event::WindowEvent::Resized(*new_inner_size), - window_id, - }), - _ => event.to_static(), - }; - - if let Some(event) = event { - event_sender.start_send(event).expect("Send event"); + event_sender.start_send(event).expect("Send event"); - let poll = instance.as_mut().poll(&mut context); + let poll = instance.as_mut().poll(&mut context); - match poll { - task::Poll::Pending => { - if let Ok(Some(flow)) = control_receiver.try_next() { - *control_flow = flow; - } - } - task::Poll::Ready(_) => { - *control_flow = ControlFlow::Exit; + match poll { + task::Poll::Pending => { + if let Ok(Some(flow)) = control_receiver.try_next() { + event_loop.set_control_flow(flow); } - }; - } - }) + } + task::Poll::Ready(_) => { + event_loop.exit(); + } + }; + }); + + Ok(()) } async fn run_instance( @@ -259,7 +244,7 @@ async fn run_instance( mut proxy: winit::event_loop::EventLoopProxy, mut debug: Debug, mut event_receiver: mpsc::UnboundedReceiver< - winit::event::Event<'_, A::Message>, + winit::event::Event, >, mut control_sender: mpsc::UnboundedSender, init_command: Command, @@ -335,89 +320,24 @@ async fn run_instance( | event::StartCause::ResumeTimeReached { .. } ); } - event::Event::MainEventsCleared => { - if !redraw_pending && events.is_empty() && messages.is_empty() { - continue; - } - - debug.event_processing_started(); - - let (interface_state, statuses) = user_interface.update( - &events, - state.cursor(), - &mut renderer, - &mut clipboard, - &mut messages, - ); - - debug.event_processing_finished(); - - for (event, status) in - events.drain(..).zip(statuses.into_iter()) - { - runtime.broadcast(event, status); - } - - if !messages.is_empty() - || matches!( - interface_state, - user_interface::State::Outdated - ) - { - let mut cache = - ManuallyDrop::into_inner(user_interface).into_cache(); - - // Update application - update( - &mut application, - &mut compositor, - &mut surface, - &mut cache, - &state, - &mut renderer, - &mut runtime, - &mut clipboard, - &mut should_exit, - &mut proxy, - &mut debug, - &mut messages, - &window, - ); - - // Update window - state.synchronize(&application, &window); - - user_interface = ManuallyDrop::new(build_user_interface( - &application, - cache, - &mut renderer, - state.logical_size(), - &mut debug, - )); - - if should_exit { - break; - } - } - - // TODO: Avoid redrawing all the time by forcing widgets to - // request redraws on state changes - // - // Then, we can use the `interface_state` here to decide if a redraw - // is needed right away, or simply wait until a specific time. - let redraw_event = Event::Window( - window::Id::MAIN, - window::Event::RedrawRequested(Instant::now()), - ); - - let (interface_state, _) = user_interface.update( - &[redraw_event.clone()], - state.cursor(), - &mut renderer, - &mut clipboard, - &mut messages, - ); + event::Event::PlatformSpecific(event::PlatformSpecific::MacOS( + event::MacOS::ReceivedUrl(url), + )) => { + use crate::core::event; + events.push(Event::PlatformSpecific( + event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl( + url, + )), + )); + } + event::Event::UserEvent(message) => { + messages.push(message); + } + event::Event::WindowEvent { + event: event::WindowEvent::RedrawRequested { .. }, + .. + } => { debug.draw_started(); let new_mouse_interaction = user_interface.draw( &mut renderer, @@ -437,38 +357,6 @@ async fn run_instance( mouse_interaction = new_mouse_interaction; } - window.request_redraw(); - runtime.broadcast(redraw_event, core::event::Status::Ignored); - - let _ = control_sender.start_send(match interface_state { - user_interface::State::Updated { - redraw_request: Some(redraw_request), - } => match redraw_request { - window::RedrawRequest::NextFrame => ControlFlow::Poll, - window::RedrawRequest::At(at) => { - ControlFlow::WaitUntil(at) - } - }, - _ => ControlFlow::Wait, - }); - - redraw_pending = false; - } - event::Event::PlatformSpecific(event::PlatformSpecific::MacOS( - event::MacOS::ReceivedUrl(url), - )) => { - use crate::core::event; - - events.push(Event::PlatformSpecific( - event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl( - url, - )), - )); - } - event::Event::UserEvent(message) => { - messages.push(message); - } - event::Event::RedrawRequested(_) => { let physical_size = state.physical_size(); if physical_size.width == 0 || physical_size.height == 0 { @@ -566,6 +454,98 @@ async fn run_instance( } _ => {} } + + if !redraw_pending && events.is_empty() && messages.is_empty() { + continue; + } + + debug.event_processing_started(); + + let (interface_state, statuses) = user_interface.update( + &events, + state.cursor(), + &mut renderer, + &mut clipboard, + &mut messages, + ); + + debug.event_processing_finished(); + + for (event, status) in events.drain(..).zip(statuses.into_iter()) { + runtime.broadcast(event, status); + } + + if !messages.is_empty() + || matches!(interface_state, user_interface::State::Outdated) + { + let mut cache = + ManuallyDrop::into_inner(user_interface).into_cache(); + + // Update application + update( + &mut application, + &mut compositor, + &mut surface, + &mut cache, + &state, + &mut renderer, + &mut runtime, + &mut clipboard, + &mut should_exit, + &mut proxy, + &mut debug, + &mut messages, + &window, + ); + + // Update window + state.synchronize(&application, &window); + + user_interface = ManuallyDrop::new(build_user_interface( + &application, + cache, + &mut renderer, + state.logical_size(), + &mut debug, + )); + + if should_exit { + break; + } + } + + // TODO: Avoid redrawing all the time by forcing widgets to + // request redraws on state changes + // + // Then, we can use the `interface_state` here to decide if a redraw + // is needed right away, or simply wait until a specific time. + let redraw_event = Event::Window( + window::Id::MAIN, + window::Event::RedrawRequested(Instant::now()), + ); + + let (interface_state, _) = user_interface.update( + &[redraw_event.clone()], + state.cursor(), + &mut renderer, + &mut clipboard, + &mut messages, + ); + + window.request_redraw(); + runtime.broadcast(redraw_event, core::event::Status::Ignored); + + let _ = control_sender.start_send(match interface_state { + user_interface::State::Updated { + redraw_request: Some(redraw_request), + } => match redraw_request { + window::RedrawRequest::NextFrame => ControlFlow::Poll, + window::RedrawRequest::At(at) => ControlFlow::WaitUntil(at), + }, + _ => ControlFlow::Wait, + }); + + redraw_pending = false; } // Manually drop the user interface @@ -575,8 +555,8 @@ async fn run_instance( /// Returns true if the provided event should cause an [`Application`] to /// exit. pub fn requests_exit( - event: &winit::event::WindowEvent<'_>, - _modifiers: winit::event::ModifiersState, + event: &winit::event::WindowEvent, + _modifiers: winit::keyboard::ModifiersState, ) -> bool { use winit::event::WindowEvent; @@ -584,14 +564,14 @@ pub fn requests_exit( WindowEvent::CloseRequested => true, #[cfg(target_os = "macos")] WindowEvent::KeyboardInput { - input: - winit::event::KeyboardInput { - virtual_keycode: Some(winit::event::VirtualKeyCode::Q), + event: + winit::event::KeyEvent { + logical_key: winit::keyboard::Key::Character(c), state: winit::event::ElementState::Pressed, .. }, .. - } if _modifiers.logo() => true, + } if c == "q" && _modifiers.super_key() => true, _ => false, } } @@ -726,10 +706,11 @@ pub fn run_command( ); } window::Action::Resize(_id, size) => { - window.set_inner_size(winit::dpi::LogicalSize { - width: size.width, - height: size.height, - }); + let _ = + window.request_inner_size(winit::dpi::LogicalSize { + width: size.width, + height: size.height, + }); } window::Action::FetchSize(_id, callback) => { let size = @@ -878,43 +859,3 @@ pub fn run_command( } } } - -#[cfg(not(target_arch = "wasm32"))] -mod platform { - pub fn run( - mut event_loop: winit::event_loop::EventLoop, - event_handler: F, - ) -> Result<(), super::Error> - where - F: 'static - + FnMut( - winit::event::Event<'_, T>, - &winit::event_loop::EventLoopWindowTarget, - &mut winit::event_loop::ControlFlow, - ), - { - use winit::platform::run_return::EventLoopExtRunReturn; - - let _ = event_loop.run_return(event_handler); - - Ok(()) - } -} - -#[cfg(target_arch = "wasm32")] -mod platform { - pub fn run( - event_loop: winit::event_loop::EventLoop, - event_handler: F, - ) -> ! - where - F: 'static - + FnMut( - winit::event::Event<'_, T>, - &winit::event_loop::EventLoopWindowTarget, - &mut winit::event_loop::ControlFlow, - ), - { - event_loop.run(event_handler) - } -} -- cgit From 48cebbb22cfd701984017f1f3336735bc70272d3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 19 Dec 2023 12:37:04 +0100 Subject: Fix redraw request handling in new event loop logic --- winit/src/application.rs | 61 +++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 29 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index ed6ba9eb..aea828bc 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -338,6 +338,38 @@ async fn run_instance( event: event::WindowEvent::RedrawRequested { .. }, .. } => { + // TODO: Avoid redrawing all the time by forcing widgets to + // request redraws on state changes + // + // Then, we can use the `interface_state` here to decide if a redraw + // is needed right away, or simply wait until a specific time. + let redraw_event = Event::Window( + window::Id::MAIN, + window::Event::RedrawRequested(Instant::now()), + ); + + let (interface_state, _) = user_interface.update( + &[redraw_event.clone()], + state.cursor(), + &mut renderer, + &mut clipboard, + &mut messages, + ); + + let _ = control_sender.start_send(match interface_state { + user_interface::State::Updated { + redraw_request: Some(redraw_request), + } => match redraw_request { + window::RedrawRequest::NextFrame => ControlFlow::Poll, + window::RedrawRequest::At(at) => { + ControlFlow::WaitUntil(at) + } + }, + _ => ControlFlow::Wait, + }); + + runtime.broadcast(redraw_event, core::event::Status::Ignored); + debug.draw_started(); let new_mouse_interaction = user_interface.draw( &mut renderer, @@ -514,36 +546,7 @@ async fn run_instance( } } - // TODO: Avoid redrawing all the time by forcing widgets to - // request redraws on state changes - // - // Then, we can use the `interface_state` here to decide if a redraw - // is needed right away, or simply wait until a specific time. - let redraw_event = Event::Window( - window::Id::MAIN, - window::Event::RedrawRequested(Instant::now()), - ); - - let (interface_state, _) = user_interface.update( - &[redraw_event.clone()], - state.cursor(), - &mut renderer, - &mut clipboard, - &mut messages, - ); - window.request_redraw(); - runtime.broadcast(redraw_event, core::event::Status::Ignored); - - let _ = control_sender.start_send(match interface_state { - user_interface::State::Updated { - redraw_request: Some(redraw_request), - } => match redraw_request { - window::RedrawRequest::NextFrame => ControlFlow::Poll, - window::RedrawRequest::At(at) => ControlFlow::WaitUntil(at), - }, - _ => ControlFlow::Wait, - }); redraw_pending = false; } -- cgit From af917a08d8c60f1684439989f63f856d445d0383 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 19 Dec 2023 12:44:08 +0100 Subject: Fix request redraw event handling for multi-window apps --- 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 aea828bc..34bf7f55 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -417,6 +417,7 @@ async fn run_instance( }, state.cursor(), ); + debug.draw_finished(); if new_mouse_interaction != mouse_interaction { window.set_cursor_icon(conversion::mouse_interaction( @@ -425,7 +426,6 @@ async fn run_instance( mouse_interaction = new_mouse_interaction; } - debug.draw_finished(); compositor.configure_surface( &mut surface, -- cgit From e772e5a9e90b5d8ae12a9891cb7b848d81e63239 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 19 Dec 2023 14:54:27 +0100 Subject: Avoid duplicated `UserInterface::draw` calls in `RedrawRequested` --- winit/src/application.rs | 95 ++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 56 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 34bf7f55..75be08f1 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -312,13 +312,13 @@ async fn run_instance( while let Some(event) = event_receiver.next().await { match event { - event::Event::NewEvents(start_cause) => { - redraw_pending = matches!( - start_cause, - event::StartCause::Init - | event::StartCause::Poll - | event::StartCause::ResumeTimeReached { .. } - ); + event::Event::NewEvents( + event::StartCause::Init + | event::StartCause::Poll + | event::StartCause::ResumeTimeReached { .. }, + ) if !redraw_pending => { + window.request_redraw(); + redraw_pending = true; } event::Event::PlatformSpecific(event::PlatformSpecific::MacOS( event::MacOS::ReceivedUrl(url), @@ -338,6 +338,33 @@ async fn run_instance( event: event::WindowEvent::RedrawRequested { .. }, .. } => { + let physical_size = state.physical_size(); + + if physical_size.width == 0 || physical_size.height == 0 { + continue; + } + + let current_viewport_version = state.viewport_version(); + + if viewport_version != current_viewport_version { + let logical_size = state.logical_size(); + + debug.layout_started(); + user_interface = ManuallyDrop::new( + ManuallyDrop::into_inner(user_interface) + .relayout(logical_size, &mut renderer), + ); + debug.layout_finished(); + + compositor.configure_surface( + &mut surface, + physical_size.width, + physical_size.height, + ); + + viewport_version = current_viewport_version; + } + // TODO: Avoid redrawing all the time by forcing widgets to // request redraws on state changes // @@ -379,6 +406,7 @@ async fn run_instance( }, state.cursor(), ); + redraw_pending = false; debug.draw_finished(); if new_mouse_interaction != mouse_interaction { @@ -389,53 +417,7 @@ async fn run_instance( mouse_interaction = new_mouse_interaction; } - let physical_size = state.physical_size(); - - if physical_size.width == 0 || physical_size.height == 0 { - continue; - } - debug.render_started(); - let current_viewport_version = state.viewport_version(); - - if viewport_version != current_viewport_version { - let logical_size = state.logical_size(); - - debug.layout_started(); - user_interface = ManuallyDrop::new( - ManuallyDrop::into_inner(user_interface) - .relayout(logical_size, &mut renderer), - ); - debug.layout_finished(); - - debug.draw_started(); - let new_mouse_interaction = user_interface.draw( - &mut renderer, - state.theme(), - &renderer::Style { - text_color: state.text_color(), - }, - state.cursor(), - ); - debug.draw_finished(); - - if new_mouse_interaction != mouse_interaction { - window.set_cursor_icon(conversion::mouse_interaction( - new_mouse_interaction, - )); - - mouse_interaction = new_mouse_interaction; - } - - compositor.configure_surface( - &mut surface, - physical_size.width, - physical_size.height, - ); - - viewport_version = current_viewport_version; - } - match compositor.present( &mut renderer, &mut surface, @@ -546,9 +528,10 @@ async fn run_instance( } } - window.request_redraw(); - - redraw_pending = false; + if !redraw_pending { + window.request_redraw(); + redraw_pending = true; + } } // Manually drop the user interface -- cgit From 50a7852cb857cd110077ffce492bafe9ebe8786c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 20 Dec 2023 08:56:57 +0100 Subject: Stop polling in event loop on `RedrawRequest::NextFrame` --- winit/src/application.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 75be08f1..5ff76060 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -314,7 +314,6 @@ async fn run_instance( match event { event::Event::NewEvents( event::StartCause::Init - | event::StartCause::Poll | event::StartCause::ResumeTimeReached { .. }, ) if !redraw_pending => { window.request_redraw(); @@ -387,7 +386,11 @@ async fn run_instance( user_interface::State::Updated { redraw_request: Some(redraw_request), } => match redraw_request { - window::RedrawRequest::NextFrame => ControlFlow::Poll, + window::RedrawRequest::NextFrame => { + window.request_redraw(); + + ControlFlow::Wait + } window::RedrawRequest::At(at) => { ControlFlow::WaitUntil(at) } @@ -469,7 +472,7 @@ async fn run_instance( _ => {} } - if !redraw_pending && events.is_empty() && messages.is_empty() { + if events.is_empty() && messages.is_empty() { continue; } -- cgit From 031784e274b0a65dc67004e503b89d29fe0e36ea Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 20 Dec 2023 10:00:27 +0100 Subject: Batch events for processing in `iced_winit` event loop --- winit/src/application.rs | 123 ++++++++++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 59 deletions(-) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index 5ff76060..7f5a3620 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -469,71 +469,74 @@ async fn run_instance( events.push(event); } } - _ => {} - } + event::Event::AboutToWait => { + if events.is_empty() && messages.is_empty() { + continue; + } - if events.is_empty() && messages.is_empty() { - continue; - } + debug.event_processing_started(); - debug.event_processing_started(); + let (interface_state, statuses) = user_interface.update( + &events, + state.cursor(), + &mut renderer, + &mut clipboard, + &mut messages, + ); - let (interface_state, statuses) = user_interface.update( - &events, - state.cursor(), - &mut renderer, - &mut clipboard, - &mut messages, - ); + debug.event_processing_finished(); - debug.event_processing_finished(); + for (event, status) in + events.drain(..).zip(statuses.into_iter()) + { + runtime.broadcast(event, status); + } - for (event, status) in events.drain(..).zip(statuses.into_iter()) { - runtime.broadcast(event, status); - } + if !messages.is_empty() + || matches!( + interface_state, + user_interface::State::Outdated + ) + { + let mut cache = + ManuallyDrop::into_inner(user_interface).into_cache(); - if !messages.is_empty() - || matches!(interface_state, user_interface::State::Outdated) - { - let mut cache = - ManuallyDrop::into_inner(user_interface).into_cache(); - - // Update application - update( - &mut application, - &mut compositor, - &mut surface, - &mut cache, - &state, - &mut renderer, - &mut runtime, - &mut clipboard, - &mut should_exit, - &mut proxy, - &mut debug, - &mut messages, - &window, - ); - - // Update window - state.synchronize(&application, &window); - - user_interface = ManuallyDrop::new(build_user_interface( - &application, - cache, - &mut renderer, - state.logical_size(), - &mut debug, - )); - - if should_exit { - break; - } - } + // Update application + update( + &mut application, + &mut compositor, + &mut surface, + &mut cache, + &mut state, + &mut renderer, + &mut runtime, + &mut clipboard, + &mut should_exit, + &mut proxy, + &mut debug, + &mut messages, + &window, + ); + + user_interface = ManuallyDrop::new(build_user_interface( + &application, + cache, + &mut renderer, + state.logical_size(), + &mut debug, + )); + + if should_exit { + break; + } + } - if !redraw_pending { - window.request_redraw(); - redraw_pending = true; + if !redraw_pending { + window.request_redraw(); + redraw_pending = true; + } + } + _ => {} } } @@ -595,7 +598,7 @@ pub fn update( compositor: &mut C, surface: &mut C::Surface, cache: &mut user_interface::Cache, - state: &State, + state: &mut State, renderer: &mut A::Renderer, runtime: &mut Runtime, A::Message>, clipboard: &mut Clipboard, @@ -632,6 +635,8 @@ pub fn update( ); } + state.synchronize(application, window); + let subscription = application.subscription(); runtime.track(subscription.into_recipes()); } -- cgit From 2aa2b1712dfdc93762ebe0958614154920068731 Mon Sep 17 00:00:00 2001 From: Calastrophe Date: Tue, 9 Jan 2024 02:37:45 -0600 Subject: Implemented fetch_maximized and fetch_minimized --- winit/src/application.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'winit/src/application.rs') diff --git a/winit/src/application.rs b/winit/src/application.rs index d9700075..35a35872 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -742,9 +742,19 @@ pub fn run_command( ))) .expect("Send message to event loop"); } + window::Action::FetchMaximized(_id, callback) => { + proxy + .send_event(callback(window.is_maximized())) + .expect("Send message to event loop"); + } window::Action::Maximize(_id, maximized) => { window.set_maximized(maximized); } + window::Action::FetchMinimized(_id, callback) => { + proxy + .send_event(callback(window.is_minimized())) + .expect("Send message to event loop"); + } window::Action::Minimize(_id, minimized) => { window.set_minimized(minimized); } -- cgit From 64d1ce5532f55d152fa5819532a138da2dca1a39 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 16 Jan 2024 13:28:00 +0100 Subject: Refactor `KeyCode` into `Key` and `Location` --- 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 46d1cddc..bf48538d 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -462,7 +462,7 @@ async fn run_instance( if let Some(event) = conversion::window_event( window::Id::MAIN, - &window_event, + window_event, state.scale_factor(), state.modifiers(), ) { -- cgit 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