From 2f3c2a360bce6fc46e73a63c82b93f15fb7a4cb1 Mon Sep 17 00:00:00 2001 From: Barugon Date: Thu, 4 Aug 2022 03:07:45 -0700 Subject: [PATCH 01/16] Add with_main_align method (#1891) Co-authored-by: Barugon --- egui/src/layout.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/egui/src/layout.rs b/egui/src/layout.rs index 358217257..2ec0a88b5 100644 --- a/egui/src/layout.rs +++ b/egui/src/layout.rs @@ -252,7 +252,13 @@ impl Layout { Self { main_wrap, ..self } } - /// The aligmnet to use on the cross axis. + /// The alignment to use on the main axis. + #[inline(always)] + pub fn with_main_align(self, main_align: Align) -> Self { + Self { main_align, ..self } + } + + /// The alignment to use on the cross axis. /// /// The "cross" axis is the one orthogonal to the main axis. /// For instance: in left-to-right layout, the main axis is horizontal and the cross axis is vertical. From e3f993d7b4abc2d9001a45eb6e6b26d3a6ae0388 Mon Sep 17 00:00:00 2001 From: Lorren Biffin Date: Thu, 4 Aug 2022 03:32:27 -0700 Subject: [PATCH 02/16] Fixed bug in custom window example (#1750) --- examples/custom_window_frame/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/custom_window_frame/src/main.rs b/examples/custom_window_frame/src/main.rs index 9f3f10aa0..64e01b287 100644 --- a/examples/custom_window_frame/src/main.rs +++ b/examples/custom_window_frame/src/main.rs @@ -99,8 +99,8 @@ fn custon_window_frame( rect }; let title_bar_response = - ui.interact(title_bar_rect, Id::new("title_bar"), Sense::drag()); - if title_bar_response.drag_started() { + ui.interact(title_bar_rect, Id::new("title_bar"), Sense::click()); + if title_bar_response.is_pointer_button_down_on() { frame.drag_window(); } From 66c601f775ef751f7274e66bc5e81936a4d8b151 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 5 Aug 2022 08:20:31 +0200 Subject: [PATCH 03/16] Continue execution after closing native eframe window (#1889) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds `NativeOptions::run_and_return` with default value `true`. If `true`, execution will continue after the eframe window is closed. This is a new behavior introduced in this PR. If `false`, the app will close once the eframe window is closed. The is the old behavior. This is `true` by default, and the `false` option is only there so we can revert if we find any bugs. When `true`, [`winit::platform::run_return::EventLoopExtRunReturn::run_return`](https://docs.rs/winit/latest/winit/platform/run_return/trait.EventLoopExtRunReturn.html#tymethod.run_return) is used. The winit docs warns of its usage, recommending `EventLoop::run`, but 🤷 When `false`, [`winit::event_loop::EventLoop::run`](https://docs.rs/winit/latest/winit/event_loop/struct.EventLoop.html#method.run) is used. This is a really useful feature. You can now use `eframe` to quickly open up a window and show some data or options, and then continue your program after the `eframe` window is closed My previous attempt at this caused some problems, but my new attempt seems to be working much better, at least on my Mac. --- eframe/src/epi.rs | 15 + eframe/src/lib.rs | 6 +- eframe/src/native/run.rs | 763 ++++++++++++++++++++++++++------------- 3 files changed, 533 insertions(+), 251 deletions(-) diff --git a/eframe/src/epi.rs b/eframe/src/epi.rs index a5b32d7d6..ab4ee0ef0 100644 --- a/eframe/src/epi.rs +++ b/eframe/src/epi.rs @@ -269,6 +269,20 @@ pub struct NativeOptions { /// /// Default: `Theme::Dark`. pub default_theme: Theme, + + /// This controls what happens when you close the main eframe window. + /// + /// If `true`, execution will continue after the eframe window is closed. + /// If `false`, the app will close once the eframe window is closed. + /// + /// This is `true` by default, and the `false` option is only there + /// so we can revert if we find any bugs. + /// + /// This feature was introduced in . + /// + /// When `true`, [`winit::platform::run_return::EventLoopExtRunReturn::run_return`] is used. + /// When `false`, [`winit::event_loop::EventLoop::run`] is used. + pub run_and_return: bool, } #[cfg(not(target_arch = "wasm32"))] @@ -295,6 +309,7 @@ impl Default for NativeOptions { renderer: Renderer::default(), follow_system_theme: cfg!(target_os = "macos") || cfg!(target_os = "windows"), default_theme: Theme::Dark, + run_and_return: true, } } } diff --git a/eframe/src/lib.rs b/eframe/src/lib.rs index 1175c2af9..7558163d3 100644 --- a/eframe/src/lib.rs +++ b/eframe/src/lib.rs @@ -161,20 +161,20 @@ mod native; /// ``` #[cfg(not(target_arch = "wasm32"))] #[allow(clippy::needless_pass_by_value)] -pub fn run_native(app_name: &str, native_options: NativeOptions, app_creator: AppCreator) -> ! { +pub fn run_native(app_name: &str, native_options: NativeOptions, app_creator: AppCreator) { let renderer = native_options.renderer; match renderer { #[cfg(feature = "glow")] Renderer::Glow => { tracing::debug!("Using the glow renderer"); - native::run::run_glow(app_name, &native_options, app_creator) + native::run::run_glow(app_name, &native_options, app_creator); } #[cfg(feature = "wgpu")] Renderer::Wgpu => { tracing::debug!("Using the wgpu renderer"); - native::run::run_wgpu(app_name, &native_options, app_creator) + native::run::run_wgpu(app_name, &native_options, app_creator); } } } diff --git a/eframe/src/native/run.rs b/eframe/src/native/run.rs index 0387cb5ae..0087aafa9 100644 --- a/eframe/src/native/run.rs +++ b/eframe/src/native/run.rs @@ -1,7 +1,16 @@ -use super::epi_integration; -use crate::epi; -use egui_winit::winit; +//! Note that this file contains two similar paths - one for [`glow`], one for [`wgpu`]. +//! When making changes to one you often also want to apply it to the other. +use std::time::Instant; +use std::{sync::Arc, time::Duration}; + +use egui_winit::winit; +use winit::event_loop::{ControlFlow, EventLoop}; + +use super::epi_integration::{self, EpiIntegration}; +use crate::epi; + +#[derive(Debug)] struct RequestRepaintEvent; #[cfg(feature = "glow")] @@ -9,7 +18,7 @@ struct RequestRepaintEvent; fn create_display( native_options: &NativeOptions, window_builder: winit::window::WindowBuilder, - event_loop: &winit::event_loop::EventLoop, + event_loop: &EventLoop, ) -> ( glutin::WindowedContext, glow::Context, @@ -47,73 +56,261 @@ fn create_display( pub use epi::NativeOptions; -/// Run an egui app -#[cfg(feature = "glow")] -pub fn run_glow( - app_name: &str, - native_options: &epi::NativeOptions, - app_creator: epi::AppCreator, -) -> ! { - let storage = epi_integration::create_storage(app_name); - let window_settings = epi_integration::load_window_settings(storage.as_deref()); - let event_loop = winit::event_loop::EventLoop::with_user_event(); +enum EventResult { + Wait, + RepaintAsap, + RepaintAt(Instant), + Exit, +} - let window_builder = - epi_integration::window_builder(native_options, &window_settings).with_title(app_name); - let (gl_window, gl) = create_display(native_options, window_builder, &event_loop); - let gl = std::sync::Arc::new(gl); +trait WinitApp { + fn is_focused(&self) -> bool; + fn integration(&self) -> &EpiIntegration; + fn window(&self) -> &winit::window::Window; + fn save_and_destroy(&mut self); + fn paint(&mut self) -> EventResult; + fn on_event(&mut self, event: winit::event::Event<'_, RequestRepaintEvent>) -> EventResult; +} - let mut painter = egui_glow::Painter::new(gl.clone(), None, "") - .unwrap_or_else(|error| panic!("some OpenGL error occurred {}\n", error)); +fn run_and_return(mut event_loop: EventLoop, mut winit_app: impl WinitApp) { + use winit::platform::run_return::EventLoopExtRunReturn as _; - let system_theme = native_options.system_theme(); - let mut integration = epi_integration::EpiIntegration::new( - &event_loop, - painter.max_texture_side(), - gl_window.window(), - system_theme, - storage, - Some(gl.clone()), - #[cfg(feature = "wgpu")] - None, - ); - let theme = system_theme.unwrap_or(native_options.default_theme); - integration.egui_ctx.set_visuals(theme.egui_visuals()); + tracing::debug!("event_loop.run_return"); - { - let event_loop_proxy = egui::mutex::Mutex::new(event_loop.create_proxy()); - integration.egui_ctx.set_request_repaint_callback(move || { - event_loop_proxy.lock().send_event(RequestRepaintEvent).ok(); - }); - } + let mut next_repaint_time = Instant::now(); - let mut app = app_creator(&epi::CreationContext { - egui_ctx: integration.egui_ctx.clone(), - integration_info: integration.frame.info(), - storage: integration.frame.storage(), - gl: Some(gl.clone()), - #[cfg(feature = "wgpu")] - render_state: None, + event_loop.run_return(|event, _, control_flow| { + let event_result = match event { + winit::event::Event::LoopDestroyed => EventResult::Exit, + + // Platform-dependent event handlers to workaround a winit bug + // See: https://github.com/rust-windowing/winit/issues/987 + // See: https://github.com/rust-windowing/winit/issues/1619 + winit::event::Event::RedrawEventsCleared if cfg!(windows) => { + next_repaint_time = Instant::now() + Duration::from_secs(1_000_000_000); + winit_app.paint() + } + winit::event::Event::RedrawRequested(_) if !cfg!(windows) => { + next_repaint_time = Instant::now() + Duration::from_secs(1_000_000_000); + winit_app.paint() + } + + winit::event::Event::UserEvent(RequestRepaintEvent) + | winit::event::Event::NewEvents(winit::event::StartCause::ResumeTimeReached { + .. + }) => EventResult::RepaintAsap, + + event => winit_app.on_event(event), + }; + + match event_result { + EventResult::Wait => {} + EventResult::RepaintAsap => { + next_repaint_time = Instant::now(); + } + EventResult::RepaintAt(repaint_time) => { + next_repaint_time = next_repaint_time.min(repaint_time); + } + EventResult::Exit => { + *control_flow = ControlFlow::Exit; + return; + } + } + + *control_flow = match next_repaint_time.checked_duration_since(Instant::now()) { + None => { + winit_app.window().request_redraw(); + ControlFlow::Poll + } + Some(time_until_next_repaint) => { + ControlFlow::WaitUntil(Instant::now() + time_until_next_repaint) + } + } }); - if app.warm_up_enabled() { - integration.warm_up(app.as_mut(), gl_window.window()); - } + tracing::debug!("eframe window closed"); - let mut is_focused = true; + winit_app.save_and_destroy(); +} + +fn run_and_exit( + event_loop: EventLoop, + mut winit_app: impl WinitApp + 'static, +) -> ! { + tracing::debug!("event_loop.run"); + + let mut next_repaint_time = Instant::now(); event_loop.run(move |event, _, control_flow| { - let window = gl_window.window(); + let event_result = match event { + winit::event::Event::LoopDestroyed => EventResult::Exit, - let mut redraw = || { + // Platform-dependent event handlers to workaround a winit bug + // See: https://github.com/rust-windowing/winit/issues/987 + // See: https://github.com/rust-windowing/winit/issues/1619 + winit::event::Event::RedrawEventsCleared if cfg!(windows) => { + next_repaint_time = Instant::now() + Duration::from_secs(1_000_000_000); + winit_app.paint() + } + winit::event::Event::RedrawRequested(_) if !cfg!(windows) => { + next_repaint_time = Instant::now() + Duration::from_secs(1_000_000_000); + winit_app.paint() + } + + winit::event::Event::UserEvent(RequestRepaintEvent) + | winit::event::Event::NewEvents(winit::event::StartCause::ResumeTimeReached { + .. + }) => EventResult::RepaintAsap, + + event => winit_app.on_event(event), + }; + + match event_result { + EventResult::Wait => {} + EventResult::RepaintAsap => { + next_repaint_time = Instant::now(); + } + EventResult::RepaintAt(repaint_time) => { + next_repaint_time = next_repaint_time.min(repaint_time); + } + EventResult::Exit => { + tracing::debug!("Quitting…"); + winit_app.save_and_destroy(); + #[allow(clippy::exit)] + std::process::exit(0); + } + } + + *control_flow = match next_repaint_time.checked_duration_since(Instant::now()) { + None => { + winit_app.window().request_redraw(); + ControlFlow::Poll + } + Some(time_until_next_repaint) => { + ControlFlow::WaitUntil(Instant::now() + time_until_next_repaint) + } + } + }) +} + +// ---------------------------------------------------------------------------- + +/// Run an egui app +#[cfg(feature = "glow")] +mod glow_integration { + use super::*; + + struct GlowWinitApp { + gl_window: glutin::WindowedContext, + gl: Arc, + painter: egui_glow::Painter, + integration: epi_integration::EpiIntegration, + app: Box, + is_focused: bool, + } + + impl GlowWinitApp { + fn new( + event_loop: &EventLoop, + app_name: &str, + native_options: &epi::NativeOptions, + app_creator: epi::AppCreator, + ) -> Self { + let storage = epi_integration::create_storage(app_name); + let window_settings = epi_integration::load_window_settings(storage.as_deref()); + + let window_builder = epi_integration::window_builder(native_options, &window_settings) + .with_title(app_name); + let (gl_window, gl) = create_display(native_options, window_builder, event_loop); + let gl = Arc::new(gl); + + let painter = egui_glow::Painter::new(gl.clone(), None, "") + .unwrap_or_else(|error| panic!("some OpenGL error occurred {}\n", error)); + + let system_theme = native_options.system_theme(); + let mut integration = epi_integration::EpiIntegration::new( + event_loop, + painter.max_texture_side(), + gl_window.window(), + system_theme, + storage, + Some(gl.clone()), + #[cfg(feature = "wgpu")] + None, + ); + let theme = system_theme.unwrap_or(native_options.default_theme); + integration.egui_ctx.set_visuals(theme.egui_visuals()); + + { + let event_loop_proxy = egui::mutex::Mutex::new(event_loop.create_proxy()); + integration.egui_ctx.set_request_repaint_callback(move || { + event_loop_proxy.lock().send_event(RequestRepaintEvent).ok(); + }); + } + + let mut app = app_creator(&epi::CreationContext { + egui_ctx: integration.egui_ctx.clone(), + integration_info: integration.frame.info(), + storage: integration.frame.storage(), + gl: Some(gl.clone()), + #[cfg(feature = "wgpu")] + render_state: None, + }); + + if app.warm_up_enabled() { + integration.warm_up(app.as_mut(), gl_window.window()); + } + + Self { + gl_window, + gl, + painter, + integration, + app, + is_focused: true, + } + } + } + + impl WinitApp for GlowWinitApp { + fn is_focused(&self) -> bool { + self.is_focused + } + + fn integration(&self) -> &EpiIntegration { + &self.integration + } + + fn window(&self) -> &winit::window::Window { + self.gl_window.window() + } + + fn save_and_destroy(&mut self) { + self.integration + .save(&mut *self.app, self.gl_window.window()); + self.app.on_exit(Some(&self.gl)); + self.painter.destroy(); + } + + fn paint(&mut self) -> EventResult { #[cfg(feature = "puffin")] puffin::GlobalProfiler::lock().new_frame(); crate::profile_scope!("frame"); + let Self { + gl_window, + gl, + app, + integration, + painter, + .. + } = self; + let window = gl_window.window(); + let screen_size_in_pixels: [u32; 2] = window.inner_size().into(); egui_glow::painter::clear( - &gl, + gl, screen_size_in_pixels, app.clear_color(&integration.egui_ctx.style().visuals), ); @@ -146,11 +343,10 @@ pub fn run_glow( gl_window.swap_buffers().unwrap(); } - *control_flow = if integration.should_quit() { - winit::event_loop::ControlFlow::Exit + let control_flow = if integration.should_quit() { + EventResult::Exit } else if repaint_after.is_zero() { - window.request_redraw(); - winit::event_loop::ControlFlow::Poll + EventResult::RepaintAsap } else if let Some(repaint_after_instant) = std::time::Instant::now().checked_add(repaint_after) { @@ -159,14 +355,14 @@ pub fn run_glow( // technically, this might lead to some weird corner cases where the user *WANTS* // winit to use `WaitUntil(MAX_INSTANT)` explicitly. they can roll their own // egui backend impl i guess. - winit::event_loop::ControlFlow::WaitUntil(repaint_after_instant) + EventResult::RepaintAt(repaint_after_instant) } else { - winit::event_loop::ControlFlow::Wait + EventResult::Wait }; integration.maybe_autosave(app.as_mut(), window); - if !is_focused { + if !self.is_focused { // On Mac, a minimized Window uses up all CPU: https://github.com/emilk/egui/issues/325 // We can't know if we are minimized: https://github.com/rust-windowing/winit/issues/208 // But we know if we are focused (in foreground). When minimized, we are not focused. @@ -175,140 +371,203 @@ pub fn run_glow( crate::profile_scope!("bg_sleep"); std::thread::sleep(std::time::Duration::from_millis(10)); } - }; - match event { - // Platform-dependent event handlers to workaround a winit bug - // See: https://github.com/rust-windowing/winit/issues/987 - // See: https://github.com/rust-windowing/winit/issues/1619 - winit::event::Event::RedrawEventsCleared if cfg!(windows) => redraw(), - winit::event::Event::RedrawRequested(_) if !cfg!(windows) => redraw(), - winit::event::Event::WindowEvent { event, .. } => { - match &event { - winit::event::WindowEvent::Focused(new_focused) => { - is_focused = *new_focused; - } - winit::event::WindowEvent::Resized(physical_size) => { - // Resize with 0 width and height is used by winit to signal a minimize event on Windows. - // See: https://github.com/rust-windowing/winit/issues/208 - // This solves an issue where the app would panic when minimizing on Windows. - if physical_size.width > 0 && physical_size.height > 0 { - gl_window.resize(*physical_size); - } - } - winit::event::WindowEvent::ScaleFactorChanged { new_inner_size, .. } => { - gl_window.resize(**new_inner_size); - } - winit::event::WindowEvent::CloseRequested if integration.should_quit() => { - *control_flow = winit::event_loop::ControlFlow::Exit; - } - _ => {} - } - - integration.on_event(app.as_mut(), &event); - if integration.should_quit() { - *control_flow = winit::event_loop::ControlFlow::Exit; - } - window.request_redraw(); // TODO(emilk): ask egui if the events warrants a repaint instead - } - winit::event::Event::LoopDestroyed => { - integration.save(&mut *app, window); - app.on_exit(Some(&gl)); - painter.destroy(); - } - winit::event::Event::UserEvent(RequestRepaintEvent) => window.request_redraw(), - winit::event::Event::NewEvents(winit::event::StartCause::ResumeTimeReached { - .. - }) => { - window.request_redraw(); - } - _ => {} + control_flow } - }); + + fn on_event(&mut self, event: winit::event::Event<'_, RequestRepaintEvent>) -> EventResult { + match event { + winit::event::Event::WindowEvent { event, .. } => { + match &event { + winit::event::WindowEvent::Focused(new_focused) => { + self.is_focused = *new_focused; + } + winit::event::WindowEvent::Resized(physical_size) => { + // Resize with 0 width and height is used by winit to signal a minimize event on Windows. + // See: https://github.com/rust-windowing/winit/issues/208 + // This solves an issue where the app would panic when minimizing on Windows. + if physical_size.width > 0 && physical_size.height > 0 { + self.gl_window.resize(*physical_size); + } + } + winit::event::WindowEvent::ScaleFactorChanged { + new_inner_size, .. + } => { + self.gl_window.resize(**new_inner_size); + } + winit::event::WindowEvent::CloseRequested + if self.integration.should_quit() => + { + return EventResult::Exit + } + _ => {} + } + + self.integration.on_event(self.app.as_mut(), &event); + + if self.integration.should_quit() { + EventResult::Exit + } else { + // TODO(emilk): ask egui if the event warrants a repaint + EventResult::RepaintAsap + } + } + _ => EventResult::Wait, + } + } + } + + pub fn run_glow( + app_name: &str, + native_options: &epi::NativeOptions, + app_creator: epi::AppCreator, + ) { + let event_loop = EventLoop::with_user_event(); + let glow_eframe = GlowWinitApp::new(&event_loop, app_name, native_options, app_creator); + + if native_options.run_and_return { + run_and_return(event_loop, glow_eframe); + } else { + run_and_exit(event_loop, glow_eframe); + } + } } -// TODO(emilk): merge with with the clone above -/// Run an egui app +#[cfg(feature = "glow")] +pub use glow_integration::run_glow; + +// ---------------------------------------------------------------------------- + #[cfg(feature = "wgpu")] -pub fn run_wgpu( - app_name: &str, - native_options: &epi::NativeOptions, - app_creator: epi::AppCreator, -) -> ! { - let storage = epi_integration::create_storage(app_name); - let window_settings = epi_integration::load_window_settings(storage.as_deref()); - let event_loop = winit::event_loop::EventLoop::with_user_event(); +mod wgpu_integration { + use super::*; - let window = epi_integration::window_builder(native_options, &window_settings) - .with_title(app_name) - .build(&event_loop) - .unwrap(); - - // SAFETY: `window` must outlive `painter`. - #[allow(unsafe_code)] - let mut painter = unsafe { - let mut painter = egui_wgpu::winit::Painter::new( - wgpu::Backends::PRIMARY | wgpu::Backends::GL, - wgpu::PowerPreference::HighPerformance, - wgpu::DeviceDescriptor { - label: None, - features: wgpu::Features::default(), - limits: wgpu::Limits::default(), - }, - wgpu::PresentMode::Fifo, - native_options.multisampling.max(1) as _, - ); - #[cfg(not(target_os = "android"))] - painter.set_window(Some(&window)); - painter - }; - - let render_state = painter.get_render_state().expect("Uninitialized"); - - let system_theme = native_options.system_theme(); - let mut integration = epi_integration::EpiIntegration::new( - &event_loop, - painter.max_texture_side().unwrap_or(2048), - &window, - system_theme, - storage, - #[cfg(feature = "glow")] - None, - Some(render_state.clone()), - ); - let theme = system_theme.unwrap_or(native_options.default_theme); - integration.egui_ctx.set_visuals(theme.egui_visuals()); - - { - let event_loop_proxy = egui::mutex::Mutex::new(event_loop.create_proxy()); - integration.egui_ctx.set_request_repaint_callback(move || { - event_loop_proxy.lock().send_event(RequestRepaintEvent).ok(); - }); + struct WgpuWinitApp { + window: winit::window::Window, + painter: egui_wgpu::winit::Painter<'static>, + integration: epi_integration::EpiIntegration, + app: Box, + is_focused: bool, } - let mut app = app_creator(&epi::CreationContext { - egui_ctx: integration.egui_ctx.clone(), - integration_info: integration.frame.info(), - storage: integration.frame.storage(), - #[cfg(feature = "glow")] - gl: None, - render_state: Some(render_state), - }); + impl WgpuWinitApp { + fn new( + event_loop: &EventLoop, + app_name: &str, + native_options: &epi::NativeOptions, + app_creator: epi::AppCreator, + ) -> Self { + let storage = epi_integration::create_storage(app_name); + let window_settings = epi_integration::load_window_settings(storage.as_deref()); - if app.warm_up_enabled() { - integration.warm_up(app.as_mut(), &window); + let window = epi_integration::window_builder(native_options, &window_settings) + .with_title(app_name) + .build(event_loop) + .unwrap(); + + // SAFETY: `window` must outlive `painter`. + #[allow(unsafe_code)] + let painter = unsafe { + let mut painter = egui_wgpu::winit::Painter::new( + wgpu::Backends::PRIMARY | wgpu::Backends::GL, + wgpu::PowerPreference::HighPerformance, + wgpu::DeviceDescriptor { + label: None, + features: wgpu::Features::default(), + limits: wgpu::Limits::default(), + }, + wgpu::PresentMode::Fifo, + native_options.multisampling.max(1) as _, + ); + #[cfg(not(target_os = "android"))] + painter.set_window(Some(&window)); + painter + }; + + let render_state = painter.get_render_state().expect("Uninitialized"); + + let system_theme = native_options.system_theme(); + let mut integration = epi_integration::EpiIntegration::new( + event_loop, + painter.max_texture_side().unwrap_or(2048), + &window, + system_theme, + storage, + #[cfg(feature = "glow")] + None, + Some(render_state.clone()), + ); + let theme = system_theme.unwrap_or(native_options.default_theme); + integration.egui_ctx.set_visuals(theme.egui_visuals()); + + { + let event_loop_proxy = egui::mutex::Mutex::new(event_loop.create_proxy()); + integration.egui_ctx.set_request_repaint_callback(move || { + event_loop_proxy.lock().send_event(RequestRepaintEvent).ok(); + }); + } + + let mut app = app_creator(&epi::CreationContext { + egui_ctx: integration.egui_ctx.clone(), + integration_info: integration.frame.info(), + storage: integration.frame.storage(), + #[cfg(feature = "glow")] + gl: None, + render_state: Some(render_state), + }); + + if app.warm_up_enabled() { + integration.warm_up(app.as_mut(), &window); + } + + Self { + window, + painter, + integration, + app, + is_focused: true, + } + } } - let mut is_focused = true; + impl WinitApp for WgpuWinitApp { + fn is_focused(&self) -> bool { + self.is_focused + } - event_loop.run(move |event, _, control_flow| { - let window = &window; + fn integration(&self) -> &EpiIntegration { + &self.integration + } - let mut redraw = || { + fn window(&self) -> &winit::window::Window { + &self.window + } + + fn save_and_destroy(&mut self) { + self.integration.save(&mut *self.app, &self.window); + + #[cfg(feature = "glow")] + self.app.on_exit(None); + + #[cfg(not(feature = "glow"))] + self.app.on_exit(); + + self.painter.destroy(); + } + + fn paint(&mut self) -> EventResult { #[cfg(feature = "puffin")] puffin::GlobalProfiler::lock().new_frame(); crate::profile_scope!("frame"); + let Self { + window, + app, + integration, + painter, + .. + } = self; + let egui::FullOutput { platform_output, repaint_after, @@ -330,11 +589,10 @@ pub fn run_wgpu( &textures_delta, ); - *control_flow = if integration.should_quit() { - winit::event_loop::ControlFlow::Exit + let control_flow = if integration.should_quit() { + EventResult::Exit } else if repaint_after.is_zero() { - window.request_redraw(); - winit::event_loop::ControlFlow::Poll + EventResult::RepaintAsap } else if let Some(repaint_after_instant) = std::time::Instant::now().checked_add(repaint_after) { @@ -343,14 +601,14 @@ pub fn run_wgpu( // technically, this might lead to some weird corner cases where the user *WANTS* // winit to use `WaitUntil(MAX_INSTANT)` explicitly. they can roll their own // egui backend impl i guess. - winit::event_loop::ControlFlow::WaitUntil(repaint_after_instant) + EventResult::RepaintAt(repaint_after_instant) } else { - winit::event_loop::ControlFlow::Wait + EventResult::Wait }; integration.maybe_autosave(app.as_mut(), window); - if !is_focused { + if !self.is_focused { // On Mac, a minimized Window uses up all CPU: https://github.com/emilk/egui/issues/325 // We can't know if we are minimized: https://github.com/rust-windowing/winit/issues/208 // But we know if we are focused (in foreground). When minimized, we are not focused. @@ -359,70 +617,79 @@ pub fn run_wgpu( crate::profile_scope!("bg_sleep"); std::thread::sleep(std::time::Duration::from_millis(10)); } - }; - match event { - // Platform-dependent event handlers to workaround a winit bug - // See: https://github.com/rust-windowing/winit/issues/987 - // See: https://github.com/rust-windowing/winit/issues/1619 - winit::event::Event::RedrawEventsCleared if cfg!(windows) => redraw(), - winit::event::Event::RedrawRequested(_) if !cfg!(windows) => redraw(), - - #[cfg(target_os = "android")] - winit::event::Event::Resumed => unsafe { - painter.set_window(Some(&window)); - }, - #[cfg(target_os = "android")] - winit::event::Event::Paused => unsafe { - painter.set_window(None); - }, - - winit::event::Event::WindowEvent { event, .. } => { - match &event { - winit::event::WindowEvent::Focused(new_focused) => { - is_focused = *new_focused; - } - winit::event::WindowEvent::Resized(physical_size) => { - // Resize with 0 width and height is used by winit to signal a minimize event on Windows. - // See: https://github.com/rust-windowing/winit/issues/208 - // This solves an issue where the app would panic when minimizing on Windows. - if physical_size.width > 0 && physical_size.height > 0 { - painter.on_window_resized(physical_size.width, physical_size.height); - } - } - winit::event::WindowEvent::ScaleFactorChanged { new_inner_size, .. } => { - painter.on_window_resized(new_inner_size.width, new_inner_size.height); - } - winit::event::WindowEvent::CloseRequested if integration.should_quit() => { - *control_flow = winit::event_loop::ControlFlow::Exit; - } - _ => {} - }; - - integration.on_event(app.as_mut(), &event); - if integration.should_quit() { - *control_flow = winit::event_loop::ControlFlow::Exit; - } - window.request_redraw(); // TODO(emilk): ask egui if the events warrants a repaint instead - } - winit::event::Event::LoopDestroyed => { - integration.save(&mut *app, window); - - #[cfg(feature = "glow")] - app.on_exit(None); - - #[cfg(not(feature = "glow"))] - app.on_exit(); - - painter.destroy(); - } - winit::event::Event::UserEvent(RequestRepaintEvent) => window.request_redraw(), - winit::event::Event::NewEvents(winit::event::StartCause::ResumeTimeReached { - .. - }) => { - window.request_redraw(); - } - _ => (), + control_flow } - }); + + fn on_event(&mut self, event: winit::event::Event<'_, RequestRepaintEvent>) -> EventResult { + match event { + #[cfg(target_os = "android")] + winit::event::Event::Resumed => unsafe { + painter.set_window(Some(&window)); + }, + #[cfg(target_os = "android")] + winit::event::Event::Paused => unsafe { + painter.set_window(None); + }, + + winit::event::Event::WindowEvent { event, .. } => { + match &event { + winit::event::WindowEvent::Focused(new_focused) => { + self.is_focused = *new_focused; + } + winit::event::WindowEvent::Resized(physical_size) => { + // Resize with 0 width and height is used by winit to signal a minimize event on Windows. + // See: https://github.com/rust-windowing/winit/issues/208 + // This solves an issue where the app would panic when minimizing on Windows. + if physical_size.width > 0 && physical_size.height > 0 { + self.painter + .on_window_resized(physical_size.width, physical_size.height); + } + } + winit::event::WindowEvent::ScaleFactorChanged { + new_inner_size, .. + } => { + self.painter + .on_window_resized(new_inner_size.width, new_inner_size.height); + } + winit::event::WindowEvent::CloseRequested + if self.integration.should_quit() => + { + return EventResult::Exit + } + _ => {} + }; + + self.integration.on_event(self.app.as_mut(), &event); + if self.integration.should_quit() { + EventResult::Exit + } else { + // TODO(emilk): ask egui if the event warrants a repaint + EventResult::RepaintAsap + } + } + _ => EventResult::Wait, + } + } + } + + pub fn run_wgpu( + app_name: &str, + native_options: &epi::NativeOptions, + app_creator: epi::AppCreator, + ) { + let event_loop = EventLoop::with_user_event(); + let wgpu_eframe = WgpuWinitApp::new(&event_loop, app_name, native_options, app_creator); + + if native_options.run_and_return { + run_and_return(event_loop, wgpu_eframe); + } else { + run_and_exit(event_loop, wgpu_eframe); + } + } } + +// ---------------------------------------------------------------------------- + +#[cfg(feature = "wgpu")] +pub use wgpu_integration::run_wgpu; From 9e41fa021a5e0c3d7620260c41d464a325e53a03 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 8 Aug 2022 12:15:31 +0200 Subject: [PATCH 04/16] eframe: rename `render_state` to `wgpu_render_state` for added clarity --- eframe/src/epi.rs | 28 ++++++++++++++++++------- eframe/src/native/epi_integration.rs | 4 ++-- eframe/src/native/run.rs | 8 +++---- eframe/src/web/backend.rs | 4 ++-- egui-wgpu/src/winit.rs | 8 +++---- egui_demo_app/src/apps/custom3d_wgpu.rs | 8 +++---- 6 files changed, 37 insertions(+), 23 deletions(-) diff --git a/eframe/src/epi.rs b/eframe/src/epi.rs index ab4ee0ef0..950a94cb7 100644 --- a/eframe/src/epi.rs +++ b/eframe/src/epi.rs @@ -27,13 +27,18 @@ pub struct CreationContext<'s> { /// The [`glow::Context`] allows you to initialize OpenGL resources (e.g. shaders) that /// you might want to use later from a [`egui::PaintCallback`]. + /// + /// Only available when compiling with the `glow` feature and using [`Renderer::Glow`]. #[cfg(feature = "glow")] pub gl: Option>, - /// Can be used to manage GPU resources for custom rendering with WGPU using - /// [`egui::PaintCallback`]s. + /// The underlying WGPU render state. + /// + /// Only available when compiling with the `wgpu` feature and using [`Renderer::Wgpu`]. + /// + /// Can be used to manage GPU resources for custom rendering with WGPU using [`egui::PaintCallback`]s. #[cfg(feature = "wgpu")] - pub render_state: Option, + pub wgpu_render_state: Option, } // ---------------------------------------------------------------------------- @@ -510,10 +515,9 @@ pub struct Frame { #[cfg(feature = "glow")] pub(crate) gl: Option>, - /// Can be used to manage GPU resources for custom rendering with WGPU using - /// [`egui::PaintCallback`]s. + /// Can be used to manage GPU resources for custom rendering with WGPU using [`egui::PaintCallback`]s. #[cfg(feature = "wgpu")] - pub render_state: Option, + pub(crate) wgpu_render_state: Option, } impl Frame { @@ -551,12 +555,22 @@ impl Frame { /// ([`egui`] only collects [`egui::Shape`]s and then eframe paints them all in one go later on). /// /// To get a [`glow`] context you need to compile with the `glow` feature flag, - /// and run eframe with the glow backend. + /// and run eframe using [`Renderer::Glow`]. #[cfg(feature = "glow")] pub fn gl(&self) -> Option<&std::sync::Arc> { self.gl.as_ref() } + /// The underlying WGPU render state. + /// + /// Only available when compiling with the `wgpu` feature and using [`Renderer::Wgpu`]. + /// + /// Can be used to manage GPU resources for custom rendering with WGPU using [`egui::PaintCallback`]s. + #[cfg(feature = "wgpu")] + pub fn wgpu_render_state(&self) -> Option<&egui_wgpu::RenderState> { + self.wgpu_render_state.as_ref() + } + /// Signal the app to stop/exit/quit the app (only works for native apps, not web apps). /// The framework will not quit immediately, but at the end of the this frame. #[cfg(not(target_arch = "wasm32"))] diff --git a/eframe/src/native/epi_integration.rs b/eframe/src/native/epi_integration.rs index b2b7d7e26..ee32f1b2a 100644 --- a/eframe/src/native/epi_integration.rs +++ b/eframe/src/native/epi_integration.rs @@ -196,7 +196,7 @@ impl EpiIntegration { system_theme: Option, storage: Option>, #[cfg(feature = "glow")] gl: Option>, - #[cfg(feature = "wgpu")] render_state: Option, + #[cfg(feature = "wgpu")] wgpu_render_state: Option, ) -> Self { let egui_ctx = egui::Context::default(); @@ -214,7 +214,7 @@ impl EpiIntegration { #[cfg(feature = "glow")] gl, #[cfg(feature = "wgpu")] - render_state, + wgpu_render_state, }; let mut egui_winit = egui_winit::State::new(event_loop); diff --git a/eframe/src/native/run.rs b/eframe/src/native/run.rs index 0087aafa9..4bd36c4b5 100644 --- a/eframe/src/native/run.rs +++ b/eframe/src/native/run.rs @@ -254,7 +254,7 @@ mod glow_integration { storage: integration.frame.storage(), gl: Some(gl.clone()), #[cfg(feature = "wgpu")] - render_state: None, + wgpu_render_state: None, }); if app.warm_up_enabled() { @@ -484,7 +484,7 @@ mod wgpu_integration { painter }; - let render_state = painter.get_render_state().expect("Uninitialized"); + let wgpu_render_state = painter.render_state().expect("Uninitialized"); let system_theme = native_options.system_theme(); let mut integration = epi_integration::EpiIntegration::new( @@ -495,7 +495,7 @@ mod wgpu_integration { storage, #[cfg(feature = "glow")] None, - Some(render_state.clone()), + Some(wgpu_render_state.clone()), ); let theme = system_theme.unwrap_or(native_options.default_theme); integration.egui_ctx.set_visuals(theme.egui_visuals()); @@ -513,7 +513,7 @@ mod wgpu_integration { storage: integration.frame.storage(), #[cfg(feature = "glow")] gl: None, - render_state: Some(render_state), + wgpu_render_state: Some(wgpu_render_state), }); if app.warm_up_enabled() { diff --git a/eframe/src/web/backend.rs b/eframe/src/web/backend.rs index 7c1a37a67..aed3a81d6 100644 --- a/eframe/src/web/backend.rs +++ b/eframe/src/web/backend.rs @@ -219,7 +219,7 @@ impl AppRunner { #[cfg(feature = "glow")] gl: Some(painter.painter.gl().clone()), #[cfg(feature = "wgpu")] - render_state: None, + wgpu_render_state: None, }); let frame = epi::Frame { @@ -229,7 +229,7 @@ impl AppRunner { #[cfg(feature = "glow")] gl: Some(painter.gl().clone()), #[cfg(feature = "wgpu")] - render_state: None, + wgpu_render_state: None, }; let needs_repaint: std::sync::Arc = Default::default(); diff --git a/egui-wgpu/src/winit.rs b/egui-wgpu/src/winit.rs index 2b6c6d023..33518d897 100644 --- a/egui-wgpu/src/winit.rs +++ b/egui-wgpu/src/winit.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use egui::mutex::RwLock; use tracing::error; -use wgpu::{Adapter, Instance, Surface, TextureFormat}; +use wgpu::{Adapter, Instance, Surface}; use crate::renderer; @@ -12,7 +12,7 @@ use crate::renderer; pub struct RenderState { pub device: Arc, pub queue: Arc, - pub target_format: TextureFormat, + pub target_format: wgpu::TextureFormat, pub egui_rpass: Arc>, } @@ -75,14 +75,14 @@ impl<'a> Painter<'a> { /// Get the [`RenderState`]. /// /// Will return [`None`] if the render state has not been initialized yet. - pub fn get_render_state(&self) -> Option { + pub fn render_state(&self) -> Option { self.render_state.as_ref().cloned() } async fn init_render_state( &self, adapter: &Adapter, - target_format: TextureFormat, + target_format: wgpu::TextureFormat, ) -> RenderState { let (device, queue) = pollster::block_on(adapter.request_device(&self.device_descriptor, None)).unwrap(); diff --git a/egui_demo_app/src/apps/custom3d_wgpu.rs b/egui_demo_app/src/apps/custom3d_wgpu.rs index d868a57be..1904da98b 100644 --- a/egui_demo_app/src/apps/custom3d_wgpu.rs +++ b/egui_demo_app/src/apps/custom3d_wgpu.rs @@ -13,9 +13,9 @@ impl Custom3d { pub fn new<'a>(cc: &'a eframe::CreationContext<'a>) -> Self { // Get the WGPU render state from the eframe creation context. This can also be retrieved // from `eframe::Frame` when you don't have a `CreationContext` available. - let render_state = cc.render_state.as_ref().expect("WGPU enabled"); + let wgpu_render_state = cc.wgpu_render_state.as_ref().expect("WGPU enabled"); - let device = &render_state.device; + let device = &wgpu_render_state.device; let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, @@ -53,7 +53,7 @@ impl Custom3d { fragment: Some(wgpu::FragmentState { module: &shader, entry_point: "fs_main", - targets: &[Some(render_state.target_format.into())], + targets: &[Some(wgpu_render_state.target_format.into())], }), primitive: wgpu::PrimitiveState::default(), depth_stencil: None, @@ -81,7 +81,7 @@ impl Custom3d { // Because the graphics pipeline must have the same lifetime as the egui render pass, // instead of storing the pipeline in our `Custom3D` struct, we insert it into the // `paint_callback_resources` type map, which is stored alongside the render pass. - render_state + wgpu_render_state .egui_rpass .write() .paint_callback_resources From e38955fbac43473a97bb946fa95046094ac864d9 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 8 Aug 2022 12:15:51 +0200 Subject: [PATCH 05/16] Fix: remember to call integration.post_rendering on wgpu path --- eframe/src/native/run.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eframe/src/native/run.rs b/eframe/src/native/run.rs index 4bd36c4b5..2f232ffbb 100644 --- a/eframe/src/native/run.rs +++ b/eframe/src/native/run.rs @@ -1,8 +1,8 @@ //! Note that this file contains two similar paths - one for [`glow`], one for [`wgpu`]. //! When making changes to one you often also want to apply it to the other. +use std::time::Duration; use std::time::Instant; -use std::{sync::Arc, time::Duration}; use egui_winit::winit; use winit::event_loop::{ControlFlow, EventLoop}; @@ -198,6 +198,8 @@ fn run_and_exit( /// Run an egui app #[cfg(feature = "glow")] mod glow_integration { + use std::sync::Arc; + use super::*; struct GlowWinitApp { @@ -589,6 +591,8 @@ mod wgpu_integration { &textures_delta, ); + integration.post_rendering(app.as_mut(), window); + let control_flow = if integration.should_quit() { EventResult::Exit } else if repaint_after.is_zero() { From 7c25a9238e8b899b4d5653db98a583e69b790b17 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 8 Aug 2022 12:21:53 +0200 Subject: [PATCH 06/16] Remove get_ prefix from functions to better follow Rust API Guidelines --- egui-wgpu/src/renderer.rs | 2 +- egui-winit/src/lib.rs | 4 +-- egui/src/menu.rs | 14 ++++---- egui/src/ui.rs | 4 +-- egui/src/widgets/plot/items/mod.rs | 52 +++++++++++++-------------- egui/src/widgets/plot/items/values.rs | 2 +- egui/src/widgets/plot/legend.rs | 4 +-- egui/src/widgets/plot/mod.rs | 14 ++++---- egui_demo_lib/src/demo/plot_demo.rs | 22 ++++++------ egui_glium/src/painter.rs | 4 +-- egui_glow/src/painter.rs | 9 +++-- 11 files changed, 68 insertions(+), 63 deletions(-) diff --git a/egui-wgpu/src/renderer.rs b/egui-wgpu/src/renderer.rs index cbdeada6e..0de81f1ce 100644 --- a/egui-wgpu/src/renderer.rs +++ b/egui-wgpu/src/renderer.rs @@ -569,7 +569,7 @@ impl RenderPass { /// This could be used by custom paint hooks to render images that have been added through with /// [`egui_extras::RetainedImage`](https://docs.rs/egui_extras/latest/egui_extras/image/struct.RetainedImage.html) /// or [`egui::Context::load_texture`]. - pub fn get_texture( + pub fn texture( &self, id: &egui::TextureId, ) -> Option<&(Option, wgpu::BindGroup)> { diff --git a/egui-winit/src/lib.rs b/egui-winit/src/lib.rs index b9b43980e..be98ff479 100644 --- a/egui-winit/src/lib.rs +++ b/egui-winit/src/lib.rs @@ -66,7 +66,7 @@ pub struct State { impl State { pub fn new(event_loop: &EventLoopWindowTarget) -> Self { - Self::new_with_wayland_display(get_wayland_display(event_loop)) + Self::new_with_wayland_display(wayland_display(event_loop)) } pub fn new_with_wayland_display(wayland_display: Option<*mut c_void>) -> Self { @@ -712,7 +712,7 @@ fn translate_cursor(cursor_icon: egui::CursorIcon) -> Option(_event_loop: &EventLoopWindowTarget) -> Option<*mut c_void> { +fn wayland_display(_event_loop: &EventLoopWindowTarget) -> Option<*mut c_void> { #[cfg(any( target_os = "linux", target_os = "dragonfly", diff --git a/egui/src/menu.rs b/egui/src/menu.rs index a3812f3e2..1950cb833 100644 --- a/egui/src/menu.rs +++ b/egui/src/menu.rs @@ -532,7 +532,7 @@ impl MenuState { id: Id, add_contents: impl FnOnce(&mut Ui) -> R, ) -> Option { - let (sub_response, response) = self.get_submenu(id).map(|sub| { + let (sub_response, response) = self.submenu(id).map(|sub| { let inner_response = Self::show(ctx, sub, id, add_contents); (sub.read().response, inner_response.inner) })?; @@ -582,7 +582,7 @@ impl MenuState { if pointer.is_still() { return false; } - if let Some(sub_menu) = self.get_current_submenu() { + if let Some(sub_menu) = self.current_submenu() { if let Some(pos) = pointer.hover_pos() { return Self::points_at_left_of_rect(pos, pointer.velocity(), sub_menu.read().rect); } @@ -592,7 +592,7 @@ impl MenuState { /// Check if pointer is hovering current submenu. fn hovering_current_submenu(&self, pointer: &PointerState) -> bool { - if let Some(sub_menu) = self.get_current_submenu() { + if let Some(sub_menu) = self.current_submenu() { if let Some(pos) = pointer.hover_pos() { return sub_menu.read().area_contains(pos); } @@ -608,18 +608,18 @@ impl MenuState { } fn is_open(&self, id: Id) -> bool { - self.get_sub_id() == Some(id) + self.sub_id() == Some(id) } - fn get_sub_id(&self) -> Option { + fn sub_id(&self) -> Option { self.sub_menu.as_ref().map(|(id, _)| *id) } - fn get_current_submenu(&self) -> Option<&Arc>> { + fn current_submenu(&self) -> Option<&Arc>> { self.sub_menu.as_ref().map(|(_, sub)| sub) } - fn get_submenu(&mut self, id: Id) -> Option<&Arc>> { + fn submenu(&mut self, id: Id) -> Option<&Arc>> { self.sub_menu .as_ref() .and_then(|(k, sub)| if id == *k { Some(sub) } else { None }) diff --git a/egui/src/ui.rs b/egui/src/ui.rs index 413677c55..bb915b49d 100644 --- a/egui/src/ui.rs +++ b/egui/src/ui.rs @@ -99,7 +99,7 @@ impl Ui { crate::egui_assert!(!max_rect.any_nan()); let next_auto_id_source = Id::new(self.next_auto_id_source).with("child").value(); self.next_auto_id_source = self.next_auto_id_source.wrapping_add(1); - let menu_state = self.get_menu_state(); + let menu_state = self.menu_state(); Ui { id: self.id.with(id_source), next_auto_id_source, @@ -2096,7 +2096,7 @@ impl Ui { self.menu_state = None; } - pub(crate) fn get_menu_state(&self) -> Option>> { + pub(crate) fn menu_state(&self) -> Option>> { self.menu_state.clone() } diff --git a/egui/src/widgets/plot/items/mod.rs b/egui/src/widgets/plot/items/mod.rs index c9f667721..def04a458 100644 --- a/egui/src/widgets/plot/items/mod.rs +++ b/egui/src/widgets/plot/items/mod.rs @@ -32,7 +32,7 @@ pub(super) struct PlotConfig<'a> { /// Trait shared by things that can be drawn in the plot. pub(super) trait PlotItem { - fn get_shapes(&self, ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec); + fn shapes(&self, ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec); fn initialize(&mut self, x_range: RangeInclusive); @@ -46,7 +46,7 @@ pub(super) trait PlotItem { fn geometry(&self) -> PlotGeometry<'_>; - fn get_bounds(&self) -> PlotBounds; + fn bounds(&self) -> PlotBounds; fn find_closest(&self, point: Pos2, transform: &ScreenTransform) -> Option { match self.geometry() { @@ -167,7 +167,7 @@ impl HLine { } impl PlotItem for HLine { - fn get_shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { let HLine { y, stroke, @@ -204,7 +204,7 @@ impl PlotItem for HLine { PlotGeometry::None } - fn get_bounds(&self) -> PlotBounds { + fn bounds(&self) -> PlotBounds { let mut bounds = PlotBounds::NOTHING; bounds.min[1] = self.y; bounds.max[1] = self.y; @@ -277,7 +277,7 @@ impl VLine { } impl PlotItem for VLine { - fn get_shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { let VLine { x, stroke, @@ -314,7 +314,7 @@ impl PlotItem for VLine { PlotGeometry::None } - fn get_bounds(&self) -> PlotBounds { + fn bounds(&self) -> PlotBounds { let mut bounds = PlotBounds::NOTHING; bounds.min[0] = self.x; bounds.max[0] = self.x; @@ -401,7 +401,7 @@ fn y_intersection(p1: &Pos2, p2: &Pos2, y: f32) -> Option { } impl PlotItem for Line { - fn get_shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { let Self { series, stroke, @@ -484,8 +484,8 @@ impl PlotItem for Line { PlotGeometry::Points(self.series.points()) } - fn get_bounds(&self) -> PlotBounds { - self.series.get_bounds() + fn bounds(&self) -> PlotBounds { + self.series.bounds() } } @@ -562,7 +562,7 @@ impl Polygon { } impl PlotItem for Polygon { - fn get_shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { let Self { series, stroke, @@ -614,8 +614,8 @@ impl PlotItem for Polygon { PlotGeometry::Points(self.series.points()) } - fn get_bounds(&self) -> PlotBounds { - self.series.get_bounds() + fn bounds(&self) -> PlotBounds { + self.series.bounds() } } @@ -674,7 +674,7 @@ impl Text { } impl PlotItem for Text { - fn get_shapes(&self, ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { let color = if self.color == Color32::TRANSPARENT { ui.style().visuals.text_color() } else { @@ -728,7 +728,7 @@ impl PlotItem for Text { PlotGeometry::None } - fn get_bounds(&self) -> PlotBounds { + fn bounds(&self) -> PlotBounds { let mut bounds = PlotBounds::NOTHING; bounds.extend_with(&self.position); bounds @@ -814,7 +814,7 @@ impl Points { } impl PlotItem for Points { - fn get_shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { let sqrt_3 = 3_f32.sqrt(); let frac_sqrt_3_2 = 3_f32.sqrt() / 2.0; let frac_1_sqrt_2 = 1.0 / 2_f32.sqrt(); @@ -965,8 +965,8 @@ impl PlotItem for Points { PlotGeometry::Points(self.series.points()) } - fn get_bounds(&self) -> PlotBounds { - self.series.get_bounds() + fn bounds(&self) -> PlotBounds { + self.series.bounds() } } @@ -1016,7 +1016,7 @@ impl Arrows { } impl PlotItem for Arrows { - fn get_shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { use crate::emath::*; let Self { origins, @@ -1080,8 +1080,8 @@ impl PlotItem for Arrows { PlotGeometry::Points(self.origins.points()) } - fn get_bounds(&self) -> PlotBounds { - self.origins.get_bounds() + fn bounds(&self) -> PlotBounds { + self.origins.bounds() } } @@ -1155,7 +1155,7 @@ impl PlotImage { } impl PlotItem for PlotImage { - fn get_shapes(&self, ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { let Self { position, texture_id, @@ -1215,7 +1215,7 @@ impl PlotItem for PlotImage { PlotGeometry::None } - fn get_bounds(&self) -> PlotBounds { + fn bounds(&self) -> PlotBounds { let mut bounds = PlotBounds::NOTHING; let left_top = PlotPoint::new( self.position.x as f32 - self.size.x / 2.0, @@ -1346,7 +1346,7 @@ impl BarChart { } impl PlotItem for BarChart { - fn get_shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { for b in &self.bars { b.add_shapes(transform, self.highlight, shapes); } @@ -1376,7 +1376,7 @@ impl PlotItem for BarChart { PlotGeometry::Rects } - fn get_bounds(&self) -> PlotBounds { + fn bounds(&self) -> PlotBounds { let mut bounds = PlotBounds::NOTHING; for b in &self.bars { bounds.merge(&b.bounds()); @@ -1488,7 +1488,7 @@ impl BoxPlot { } impl PlotItem for BoxPlot { - fn get_shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { + fn shapes(&self, _ui: &mut Ui, transform: &ScreenTransform, shapes: &mut Vec) { for b in &self.boxes { b.add_shapes(transform, self.highlight, shapes); } @@ -1518,7 +1518,7 @@ impl PlotItem for BoxPlot { PlotGeometry::Rects } - fn get_bounds(&self) -> PlotBounds { + fn bounds(&self) -> PlotBounds { let mut bounds = PlotBounds::NOTHING; for b in &self.boxes { bounds.merge(&b.bounds()); diff --git a/egui/src/widgets/plot/items/values.rs b/egui/src/widgets/plot/items/values.rs index 95c21dbe9..d39947d18 100644 --- a/egui/src/widgets/plot/items/values.rs +++ b/egui/src/widgets/plot/items/values.rs @@ -302,7 +302,7 @@ impl PlotPoints { (start < end).then(|| start..=end) } - pub(super) fn get_bounds(&self) -> PlotBounds { + pub(super) fn bounds(&self) -> PlotBounds { match self { PlotPoints::Owned(points) => { let mut bounds = PlotBounds::NOTHING; diff --git a/egui/src/widgets/plot/legend.rs b/egui/src/widgets/plot/legend.rs index c2beeac51..1679fce33 100644 --- a/egui/src/widgets/plot/legend.rs +++ b/egui/src/widgets/plot/legend.rs @@ -199,7 +199,7 @@ impl LegendWidget { } // Get the names of the hidden items. - pub fn get_hidden_items(&self) -> AHashSet { + pub fn hidden_items(&self) -> AHashSet { self.entries .iter() .filter(|(_, entry)| !entry.checked) @@ -208,7 +208,7 @@ impl LegendWidget { } // Get the name of the hovered items. - pub fn get_hovered_entry_name(&self) -> Option { + pub fn hovered_entry_name(&self) -> Option { self.entries .iter() .find(|(_, entry)| entry.hovered) diff --git a/egui/src/widgets/plot/mod.rs b/egui/src/widgets/plot/mod.rs index 7695a05d8..6603451de 100644 --- a/egui/src/widgets/plot/mod.rs +++ b/egui/src/widgets/plot/mod.rs @@ -430,7 +430,7 @@ impl Plot { /// /// The function has this signature: /// ```ignore - /// fn get_step_sizes(input: GridInput) -> Vec; + /// fn step_sizes(input: GridInput) -> Vec; /// ``` /// /// This function should return all marks along the visible range of the X axis. @@ -697,7 +697,7 @@ impl Plot { } for item in &items { - let item_bounds = item.get_bounds(); + let item_bounds = item.bounds(); if auto_bounds.x { bounds.merge_x(&item_bounds); @@ -829,8 +829,8 @@ impl Plot { if let Some(mut legend) = legend { ui.add(&mut legend); - hidden_items = legend.get_hidden_items(); - hovered_entry = legend.get_hovered_entry_name(); + hidden_items = legend.hidden_items(); + hovered_entry = legend.hovered_entry_name(); } if let Some(group) = linked_axes.as_ref() { @@ -1073,7 +1073,7 @@ pub struct GridMark { /// 10 is a typical value, others are possible though. pub fn log_grid_spacer(log_base: i64) -> GridSpacer { let log_base = log_base as f64; - let get_step_sizes = move |input: GridInput| -> Vec { + let step_sizes = move |input: GridInput| -> Vec { // The distance between two of the thinnest grid lines is "rounded" up // to the next-bigger power of base let smallest_visible_unit = next_power(input.base_step_size, log_base); @@ -1087,7 +1087,7 @@ pub fn log_grid_spacer(log_base: i64) -> GridSpacer { generate_marks(step_sizes, input.bounds) }; - Box::new(get_step_sizes) + Box::new(step_sizes) } /// Splits the grid into uniform-sized spacings (e.g. 100, 25, 1). @@ -1136,7 +1136,7 @@ impl PreparedPlot { let mut plot_ui = ui.child_ui(*transform.frame(), Layout::default()); plot_ui.set_clip_rect(*transform.frame()); for item in &self.items { - item.get_shapes(&mut plot_ui, transform, &mut shapes); + item.shapes(&mut plot_ui, transform, &mut shapes); } if let Some(pointer) = response.hover_pos() { diff --git a/egui_demo_lib/src/demo/plot_demo.rs b/egui_demo_lib/src/demo/plot_demo.rs index 709e2fddb..8d6b36674 100644 --- a/egui_demo_lib/src/demo/plot_demo.rs +++ b/egui_demo_lib/src/demo/plot_demo.rs @@ -389,19 +389,19 @@ impl CustomAxisDemo { const MINS_PER_DAY: f64 = CustomAxisDemo::MINS_PER_DAY; const MINS_PER_H: f64 = CustomAxisDemo::MINS_PER_H; - fn get_day(x: f64) -> f64 { + fn day(x: f64) -> f64 { (x / MINS_PER_DAY).floor() } - fn get_hour(x: f64) -> f64 { + fn hour(x: f64) -> f64 { (x.rem_euclid(MINS_PER_DAY) / MINS_PER_H).floor() } - fn get_minute(x: f64) -> f64 { + fn minute(x: f64) -> f64 { x.rem_euclid(MINS_PER_H).floor() } - fn get_percent(y: f64) -> f64 { + fn percent(y: f64) -> f64 { 100.0 * y } @@ -411,17 +411,17 @@ impl CustomAxisDemo { String::new() } else if is_approx_integer(x / MINS_PER_DAY) { // Days - format!("Day {}", get_day(x)) + format!("Day {}", day(x)) } else { // Hours and minutes - format!("{h}:{m:02}", h = get_hour(x), m = get_minute(x)) + format!("{h}:{m:02}", h = hour(x), m = minute(x)) } }; let y_fmt = |y, _range: &RangeInclusive| { // Display only integer percentages if !is_approx_zero(y) && is_approx_integer(100.0 * y) { - format!("{:.0}%", get_percent(y)) + format!("{:.0}%", percent(y)) } else { String::new() } @@ -430,10 +430,10 @@ impl CustomAxisDemo { let label_fmt = |_s: &str, val: &PlotPoint| { format!( "Day {d}, {h}:{m:02}\n{p:.2}%", - d = get_day(val.x), - h = get_hour(val.x), - m = get_minute(val.x), - p = get_percent(val.y) + d = day(val.x), + h = hour(val.x), + m = minute(val.x), + p = percent(val.y) ) }; diff --git a/egui_glium/src/painter.rs b/egui_glium/src/painter.rs index 0730ce08a..d0bd81325 100644 --- a/egui_glium/src/painter.rs +++ b/egui_glium/src/painter.rs @@ -145,7 +145,7 @@ impl Painter { let width_in_points = width_in_pixels as f32 / pixels_per_point; let height_in_points = height_in_pixels as f32 / pixels_per_point; - if let Some(texture) = self.get_texture(mesh.texture_id) { + if let Some(texture) = self.texture(mesh.texture_id) { // The texture coordinates for text are so that both nearest and linear should work with the egui font texture. // For user textures linear sampling is more likely to be the right choice. let filter = MagnifySamplerFilter::Linear; @@ -274,7 +274,7 @@ impl Painter { self.textures.remove(&tex_id); } - fn get_texture(&self, texture_id: egui::TextureId) -> Option<&SrgbTexture2d> { + fn texture(&self, texture_id: egui::TextureId) -> Option<&SrgbTexture2d> { self.textures.get(&texture_id).map(|rc| rc.as_ref()) } diff --git a/egui_glow/src/painter.rs b/egui_glow/src/painter.rs index 0645b9a52..524b02f73 100644 --- a/egui_glow/src/painter.rs +++ b/egui_glow/src/painter.rs @@ -452,7 +452,7 @@ impl Painter { #[inline(never)] // Easier profiling fn paint_mesh(&mut self, mesh: &Mesh) { debug_assert!(mesh.is_valid()); - if let Some(texture) = self.get_texture(mesh.texture_id) { + if let Some(texture) = self.texture(mesh.texture_id) { unsafe { self.gl.bind_buffer(glow::ARRAY_BUFFER, Some(self.vbo)); self.gl.buffer_data_u8_slice( @@ -634,10 +634,15 @@ impl Painter { } /// Get the [`glow::Texture`] bound to a [`egui::TextureId`]. - pub fn get_texture(&self, texture_id: egui::TextureId) -> Option { + pub fn texture(&self, texture_id: egui::TextureId) -> Option { self.textures.get(&texture_id).copied() } + #[deprecated = "renamed 'texture'"] + pub fn get_texture(&self, texture_id: egui::TextureId) -> Option { + self.texture(texture_id) + } + #[allow(clippy::needless_pass_by_value)] // False positive pub fn register_native_texture(&mut self, native: glow::Texture) -> egui::TextureId { self.assert_not_destroyed(); From 38a67f86467f16084443258ae5e7761429c00db2 Mon Sep 17 00:00:00 2001 From: eranfu <1119369173@qq.com> Date: Sun, 14 Aug 2022 22:10:38 +0800 Subject: [PATCH 07/16] Add `PointerState::button_double_clicked()` and `PointerState::button_triple_clicked()`. (#1907) Co-authored-by: eranfu --- CHANGELOG.md | 1 + egui/src/input_state.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54febf60f..e34b7ddc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui-w * Added `Contex::request_repaint_after` ([#1694](https://github.com/emilk/egui/pull/1694)). * `ctrl-h` now acts like backspace in `TextEdit` ([#1812](https://github.com/emilk/egui/pull/1812)). * Added `RawInput::has_focus` which backends can set to indicate whether the UI as a whole has the keyboard focus ([#1859](https://github.com/emilk/egui/pull/1859)). +* Added `PointerState::button_double_clicked()` and `PointerState::button_triple_clicked()` ([#1906](https://github.com/emilk/egui/issues/1906)). ### Changed * MSRV (Minimum Supported Rust Version) is now `1.61.0` ([#1846](https://github.com/emilk/egui/pull/1846)). diff --git a/egui/src/input_state.rs b/egui/src/input_state.rs index ed40c5cab..143fd6c31 100644 --- a/egui/src/input_state.rs +++ b/egui/src/input_state.rs @@ -750,6 +750,20 @@ impl PointerState { .any(|event| matches!(event, &PointerEvent::Pressed { button: b, .. } if button == b)) } + /// Was the button given double clicked this frame? + pub fn button_double_clicked(&self, button: PointerButton) -> bool { + self.pointer_events + .iter() + .any(|event| matches!(&event, PointerEvent::Released(Some(click)) if click.button == button && click.is_double())) + } + + /// Was the button given triple clicked this frame? + pub fn button_triple_clicked(&self, button: PointerButton) -> bool { + self.pointer_events + .iter() + .any(|event| matches!(&event, PointerEvent::Released(Some(click)) if click.button == button && click.is_triple())) + } + /// Was the primary button clicked this frame? pub fn primary_clicked(&self) -> bool { self.button_clicked(PointerButton::Primary) From 923b67ef9c0b56712ca7636cbe3337b1ca43bb4e Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sun, 14 Aug 2022 16:23:46 +0200 Subject: [PATCH 08/16] Update to winit 0.27.2, glutin 0.29.0, glium 0.32 (#1914) --- Cargo.lock | 474 +++++++++++++++++--------- eframe/Cargo.toml | 4 +- eframe/src/native/run.rs | 4 +- egui-wgpu/Cargo.toml | 2 +- egui-winit/Cargo.toml | 2 +- egui-winit/src/lib.rs | 4 +- egui-winit/src/window_settings.rs | 2 +- egui_glium/Cargo.toml | 2 +- egui_glium/examples/native_texture.rs | 2 +- egui_glium/examples/pure_glium.rs | 2 +- egui_glow/Cargo.toml | 2 +- egui_glow/examples/pure_glow.rs | 2 +- 12 files changed, 326 insertions(+), 176 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56b562491..d6e25b668 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,12 +66,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "android_glue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" - [[package]] name = "android_system_properties" version = "0.1.2" @@ -285,7 +279,7 @@ checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide 0.5.3", "object", @@ -425,12 +419,15 @@ dependencies = [ [[package]] name = "calloop" -version = "0.9.3" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf2eec61efe56aa1e813f5126959296933cf0700030e4314786c48779a66ab82" +checksum = "a22a6a8f622f797120d452c630b0ab12e1331a1a753e2039ce7868d4ac77b4ee" dependencies = [ "log", - "nix 0.22.3", + "nix 0.24.2", + "slotmap", + "thiserror", + "vec_map", ] [[package]] @@ -475,12 +472,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -596,6 +587,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "cmake" +version = "0.1.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +dependencies = [ + "cc", +] + [[package]] name = "cocoa" version = "0.24.0" @@ -605,9 +605,9 @@ dependencies = [ "bitflags", "block", "cocoa-foundation", - "core-foundation 0.9.3", - "core-graphics 0.22.3", - "foreign-types", + "core-foundation", + "core-graphics", + "foreign-types 0.3.2", "libc", "objc", ] @@ -620,9 +620,9 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" dependencies = [ "bitflags", "block", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", "libc", "objc", ] @@ -681,7 +681,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen", ] @@ -691,50 +691,22 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" -[[package]] -name = "core-foundation" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -dependencies = [ - "core-foundation-sys 0.7.0", - "libc", -] - [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys 0.8.3", + "core-foundation-sys", "libc", ] -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" - [[package]] name = "core-foundation-sys" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" -[[package]] -name = "core-graphics" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" -dependencies = [ - "bitflags", - "core-foundation 0.7.0", - "foreign-types", - "libc", -] - [[package]] name = "core-graphics" version = "0.22.3" @@ -742,9 +714,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ "bitflags", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", "libc", ] @@ -755,22 +727,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ "bitflags", - "core-foundation 0.9.3", - "foreign-types", + "core-foundation", + "foreign-types 0.3.2", "libc", ] [[package]] -name = "core-video-sys" -version = "0.1.4" +name = "core-text" +version = "19.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" +checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" dependencies = [ - "cfg-if 0.1.10", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", + "core-foundation", + "core-graphics", + "foreign-types 0.3.2", "libc", - "objc", ] [[package]] @@ -779,7 +750,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -824,7 +795,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -834,7 +805,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -846,7 +817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "memoffset", "once_cell", @@ -859,10 +830,33 @@ version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] +[[package]] +name = "crossfont" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f66b1c1979c4362323f03ab6bf7fb522902bfc418e0c37319ab347f9561d980f" +dependencies = [ + "cocoa", + "core-foundation", + "core-foundation-sys", + "core-graphics", + "core-text", + "dwrote", + "foreign-types 0.5.0", + "freetype-rs", + "libc", + "log", + "objc", + "once_cell", + "pkg-config", + "servo-fontconfig", + "winapi", +] + [[package]] name = "csv" version = "1.1.6" @@ -1051,7 +1045,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -1133,6 +1127,20 @@ dependencies = [ "poll-promise", ] +[[package]] +name = "dwrote" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" +dependencies = [ + "lazy_static", + "libc", + "serde", + "serde_derive", + "winapi", + "wio", +] + [[package]] name = "dyn-clonable" version = "0.9.0" @@ -1439,6 +1447,16 @@ version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" +[[package]] +name = "expat-sys" +version = "2.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" +dependencies = [ + "cmake", + "pkg-config", +] + [[package]] name = "fancy-regex" version = "0.7.1" @@ -1515,7 +1533,28 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1524,6 +1563,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + [[package]] name = "form_urlencoded" version = "1.0.1" @@ -1534,6 +1579,28 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "freetype-rs" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" +dependencies = [ + "bitflags", + "freetype-sys", + "libc", +] + +[[package]] +name = "freetype-sys" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" +dependencies = [ + "cmake", + "libc", + "pkg-config", +] + [[package]] name = "futures-core" version = "0.3.21" @@ -1642,7 +1709,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -1699,9 +1766,9 @@ dependencies = [ [[package]] name = "glium" -version = "0.31.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab4f09b43d8ee427a700cb9ed3b20e0e858d62a509edded1a98ca5707d68e19" +checksum = "d2766728ecb86014b91d3d687614b32d65aacbbdc887f424a7b03cba3ab593bf" dependencies = [ "backtrace", "fnv", @@ -1743,25 +1810,24 @@ dependencies = [ [[package]] name = "glutin" -version = "0.28.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ea9dbe544bc8a657c4c4a798c2d16cd01b549820e47657297549d28371f6d2" +checksum = "444c9ad294fdcaf20ccf6726b78f380b5450275540c9b68ab62f49726ad1c713" dependencies = [ - "android_glue", "cgl", "cocoa", - "core-foundation 0.9.3", + "core-foundation", "glutin_egl_sys", - "glutin_emscripten_sys", "glutin_gles2_sys", "glutin_glx_sys", "glutin_wgl_sys", - "lazy_static", "libloading", "log", "objc", + "once_cell", "osmesa-sys", - "parking_lot 0.11.2", + "parking_lot 0.12.1", + "raw-window-handle 0.5.0", "wayland-client", "wayland-egl", "winapi", @@ -1770,20 +1836,14 @@ dependencies = [ [[package]] name = "glutin_egl_sys" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2abb6aa55523480c4adc5a56bbaa249992e2dddb2fc63dc96e04a3355364c211" +checksum = "68900f84b471f31ea1d1355567eb865a2cf446294f06cef8d653ed7bcf5f013d" dependencies = [ "gl_generator", "winapi", ] -[[package]] -name = "glutin_emscripten_sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80de4146df76e8a6c32b03007bc764ff3249dcaeb4f675d68a06caf1bac363f1" - [[package]] name = "glutin_gles2_sys" version = "0.1.5" @@ -1796,9 +1856,9 @@ dependencies = [ [[package]] name = "glutin_glx_sys" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e393c8fc02b807459410429150e9c4faffdb312d59b8c038566173c81991351" +checksum = "d93d0575865098580c5b3a423188cd959419912ea60b1e48e8b3b526f6d02468" dependencies = [ "gl_generator", "x11-dl", @@ -2027,7 +2087,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -2154,7 +2214,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] @@ -2195,7 +2255,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -2255,7 +2315,7 @@ dependencies = [ "bitflags", "block", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", "log", "objc", ] @@ -2322,19 +2382,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "ndk" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d" -dependencies = [ - "bitflags", - "jni-sys", - "ndk-sys 0.2.2", - "num_enum", - "thiserror", -] - [[package]] name = "ndk" version = "0.6.0" @@ -2348,27 +2395,26 @@ dependencies = [ "thiserror", ] +[[package]] +name = "ndk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +dependencies = [ + "bitflags", + "jni-sys", + "ndk-sys 0.4.0", + "num_enum", + "raw-window-handle 0.5.0", + "thiserror", +] + [[package]] name = "ndk-context" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "ndk-glue" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71bee8ea72d685477e28bd004cfe1bf99c754d688cd78cad139eae4089484d4" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk 0.5.0", - "ndk-context", - "ndk-macro", - "ndk-sys 0.2.2", -] - [[package]] name = "ndk-glue" version = "0.6.2" @@ -2384,6 +2430,22 @@ dependencies = [ "ndk-sys 0.3.0", ] +[[package]] +name = "ndk-glue" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" +dependencies = [ + "libc", + "log", + "ndk 0.7.0", + "ndk-context", + "ndk-macro", + "ndk-sys 0.4.0", + "once_cell", + "parking_lot 0.12.1", +] + [[package]] name = "ndk-macro" version = "0.3.0" @@ -2397,12 +2459,6 @@ dependencies = [ "syn", ] -[[package]] -name = "ndk-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" - [[package]] name = "ndk-sys" version = "0.3.0" @@ -2412,6 +2468,15 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "ndk-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21d83ec9c63ec5bf950200a8e508bdad6659972187b625469f58ef8c08e29046" +dependencies = [ + "jni-sys", +] + [[package]] name = "nix" version = "0.22.3" @@ -2420,7 +2485,7 @@ checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" dependencies = [ "bitflags", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", ] @@ -2433,7 +2498,19 @@ checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" dependencies = [ "bitflags", "cc", - "cfg-if 1.0.0", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +dependencies = [ + "bitflags", + "cfg-if", "libc", "memoffset", ] @@ -2597,9 +2674,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" [[package]] name = "oorandom" @@ -2696,7 +2773,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall", @@ -2710,7 +2787,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -2834,7 +2911,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", @@ -2969,6 +3046,15 @@ dependencies = [ "cty", ] +[[package]] +name = "raw-window-handle" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" +dependencies = [ + "cty", +] + [[package]] name = "rayon" version = "1.5.3" @@ -3101,7 +3187,7 @@ dependencies = [ "objc", "objc-foundation", "objc_id", - "raw-window-handle", + "raw-window-handle 0.4.3", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -3158,7 +3244,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63471c4aa97a1cf8332a5f97709a79a4234698de6a1f5087faf66f2dae810e22" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ordered-multimap", ] @@ -3282,6 +3368,18 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sctk-adwaita" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8cdeb3fbbd384de045d5683bfc3cadfc4c6ed1e6471f201ede801f31571581a" +dependencies = [ + "crossfont", + "log", + "smithay-client-toolkit 0.16.0", + "tiny-skia", +] + [[package]] name = "semver" version = "1.0.12" @@ -3340,6 +3438,27 @@ dependencies = [ "syn", ] +[[package]] +name = "servo-fontconfig" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e3e22fe5fd73d04ebf0daa049d3efe3eae55369ce38ab16d07ddd9ac5c217c" +dependencies = [ + "libc", + "servo-fontconfig-sys", +] + +[[package]] +name = "servo-fontconfig-sys" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388" +dependencies = [ + "expat-sys", + "freetype-sys", + "pkg-config", +] + [[package]] name = "sha1" version = "0.6.1" @@ -3423,7 +3542,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" dependencies = [ "bitflags", - "calloop", "dlib", "lazy_static", "log", @@ -3435,13 +3553,32 @@ dependencies = [ "wayland-protocols", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" +dependencies = [ + "bitflags", + "calloop", + "dlib", + "lazy_static", + "log", + "memmap2 0.5.4", + "nix 0.24.2", + "pkg-config", + "wayland-client", + "wayland-cursor", + "wayland-protocols", +] + [[package]] name = "smithay-clipboard" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "610b551bd25378bfd2b8e7a0fcbd83d427e8f2f6a40c47ae0f70688e9949dd55" dependencies = [ - "smithay-client-toolkit", + "smithay-client-toolkit 0.15.4", "wayland-client", ] @@ -3606,7 +3743,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", @@ -3730,7 +3867,7 @@ dependencies = [ "arrayref", "arrayvec 0.5.2", "bytemuck", - "cfg-if 1.0.0", + "cfg-if", "png 0.17.5", "safe_arch", ] @@ -3775,7 +3912,7 @@ version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3871,7 +4008,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", "static_assertions", ] @@ -4031,6 +4168,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version-compare" version = "0.1.0" @@ -4078,7 +4221,7 @@ version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "serde", "serde_json", "wasm-bindgen-macro", @@ -4105,7 +4248,7 @@ version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -4292,7 +4435,7 @@ dependencies = [ "log", "naga", "parking_lot 0.12.1", - "raw-window-handle", + "raw-window-handle 0.4.3", "smallvec", "wasm-bindgen", "wasm-bindgen-futures", @@ -4319,7 +4462,7 @@ dependencies = [ "naga", "parking_lot 0.12.1", "profiling", - "raw-window-handle", + "raw-window-handle 0.4.3", "smallvec", "thiserror", "web-sys", @@ -4341,7 +4484,7 @@ dependencies = [ "block", "core-graphics-types", "d3d12", - "foreign-types", + "foreign-types 0.3.2", "fxhash", "glow", "gpu-alloc", @@ -4357,7 +4500,7 @@ dependencies = [ "parking_lot 0.12.1", "profiling", "range-alloc", - "raw-window-handle", + "raw-window-handle 0.4.3", "renderdoc-sys", "thiserror", "wasm-bindgen", @@ -4563,34 +4706,34 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "winit" -version = "0.26.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" +checksum = "83a8f3e9d742401efcfe833b8f84960397482ff049cb7bf59a112e14a4be97f7" dependencies = [ "bitflags", "cocoa", - "core-foundation 0.9.3", - "core-graphics 0.22.3", - "core-video-sys", + "core-foundation", + "core-graphics", "dispatch", "instant", - "lazy_static", "libc", "log", "mio", - "ndk 0.5.0", - "ndk-glue 0.5.2", - "ndk-sys 0.2.2", + "ndk 0.7.0", + "ndk-glue 0.7.0", "objc", - "parking_lot 0.11.2", + "once_cell", + "parking_lot 0.12.1", "percent-encoding", - "raw-window-handle", - "smithay-client-toolkit", + "raw-window-handle 0.4.3", + "raw-window-handle 0.5.0", + "sctk-adwaita", + "smithay-client-toolkit 0.16.0", "wasm-bindgen", "wayland-client", "wayland-protocols", "web-sys", - "winapi", + "windows-sys", "x11-dl", ] @@ -4603,6 +4746,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" +dependencies = [ + "winapi", +] + [[package]] name = "x11-dl" version = "2.19.1" diff --git a/eframe/Cargo.toml b/eframe/Cargo.toml index 191099bc0..4540f9a3d 100644 --- a/eframe/Cargo.toml +++ b/eframe/Cargo.toml @@ -83,8 +83,8 @@ wgpu = { version = "0.13", optional = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] dark-light = { version = "0.2.1", optional = true } egui-winit = { version = "0.18.0", path = "../egui-winit", default-features = false, features = ["clipboard", "links"] } -glutin = { version = "0.28.0" } -winit = "0.26.1" +glutin = { version = "0.29.0" } +winit = "0.27.2" # optional native: puffin = { version = "0.13", optional = true } diff --git a/eframe/src/native/run.rs b/eframe/src/native/run.rs index 2f232ffbb..a0b730f20 100644 --- a/eframe/src/native/run.rs +++ b/eframe/src/native/run.rs @@ -424,7 +424,7 @@ mod glow_integration { native_options: &epi::NativeOptions, app_creator: epi::AppCreator, ) { - let event_loop = EventLoop::with_user_event(); + let event_loop = glutin::event_loop::EventLoopBuilder::with_user_event().build(); let glow_eframe = GlowWinitApp::new(&event_loop, app_name, native_options, app_creator); if native_options.run_and_return { @@ -682,7 +682,7 @@ mod wgpu_integration { native_options: &epi::NativeOptions, app_creator: epi::AppCreator, ) { - let event_loop = EventLoop::with_user_event(); + let event_loop = winit::event_loop::EventLoopBuilder::with_user_event().build(); let wgpu_eframe = WgpuWinitApp::new(&event_loop, app_name, native_options, app_creator); if native_options.run_and_return { diff --git a/egui-wgpu/Cargo.toml b/egui-wgpu/Cargo.toml index a6921642d..fad788822 100644 --- a/egui-wgpu/Cargo.toml +++ b/egui-wgpu/Cargo.toml @@ -47,4 +47,4 @@ wgpu = "0.13" document-features = { version = "0.2", optional = true } pollster = { version = "0.2", optional = true } -winit = { version = "0.26", optional = true } +winit = { version = "0.27.2", optional = true } diff --git a/egui-winit/Cargo.toml b/egui-winit/Cargo.toml index 7a34c0621..95247e5c3 100644 --- a/egui-winit/Cargo.toml +++ b/egui-winit/Cargo.toml @@ -46,7 +46,7 @@ egui = { version = "0.18.0", path = "../egui", default-features = false, feature ] } instant = { version = "0.1", features = ["wasm-bindgen"] } # We use instant so we can (maybe) compile for web tracing = { version = "0.1", default-features = false, features = ["std"] } -winit = "0.26.1" +winit = "0.27.2" #! ### Optional dependencies arboard = { version = "2.1", optional = true, default-features = false } diff --git a/egui-winit/src/lib.rs b/egui-winit/src/lib.rs index be98ff479..7e5bca76f 100644 --- a/egui-winit/src/lib.rs +++ b/egui-winit/src/lib.rs @@ -400,7 +400,7 @@ impl State { } fn on_mouse_wheel(&mut self, delta: winit::event::MouseScrollDelta) { - let mut delta = match delta { + let delta = match delta { winit::event::MouseScrollDelta::LineDelta(x, y) => { let points_per_scroll_line = 50.0; // Scroll speed decided by consensus: https://github.com/emilk/egui/issues/461 egui::vec2(x, y) * points_per_scroll_line @@ -410,8 +410,6 @@ impl State { } }; - delta.x *= -1.0; // Winit has inverted hscroll. Remove this line when we update winit after https://github.com/rust-windowing/winit/pull/2105 is merged and released - if self.egui_input.modifiers.ctrl || self.egui_input.modifiers.command { // Treat as zoom instead: let factor = (delta.y / 200.0).exp(); diff --git a/egui-winit/src/window_settings.rs b/egui-winit/src/window_settings.rs index 651a4e86d..78aeace07 100644 --- a/egui-winit/src/window_settings.rs +++ b/egui-winit/src/window_settings.rs @@ -4,7 +4,7 @@ pub struct WindowSettings { /// Position of window in physical pixels. This is either /// the inner or outer position depending on the platform. - /// See [`winit::window::WindowAttributes`] for details. + /// See [`winit::window::WindowBuilder::with_position`] for details. position: Option, fullscreen: bool, diff --git a/egui_glium/Cargo.toml b/egui_glium/Cargo.toml index b4ea5457f..31b9c6807 100644 --- a/egui_glium/Cargo.toml +++ b/egui_glium/Cargo.toml @@ -46,7 +46,7 @@ egui-winit = { version = "0.18.0", path = "../egui-winit", default-features = fa ahash = "0.7" bytemuck = "1.7" -glium = "0.31" +glium = "0.32" #! ### Optional dependencies ## Enable this when generating docs. diff --git a/egui_glium/examples/native_texture.rs b/egui_glium/examples/native_texture.rs index a0173907c..114ce8df4 100644 --- a/egui_glium/examples/native_texture.rs +++ b/egui_glium/examples/native_texture.rs @@ -3,7 +3,7 @@ use glium::glutin; fn main() { - let event_loop = glutin::event_loop::EventLoop::with_user_event(); + let event_loop = glutin::event_loop::EventLoopBuilder::with_user_event().build(); let display = create_display(&event_loop); let mut egui_glium = egui_glium::EguiGlium::new(&display, &event_loop); diff --git a/egui_glium/examples/pure_glium.rs b/egui_glium/examples/pure_glium.rs index 778f4aabb..019642cfc 100644 --- a/egui_glium/examples/pure_glium.rs +++ b/egui_glium/examples/pure_glium.rs @@ -5,7 +5,7 @@ use glium::glutin; fn main() { - let event_loop = glutin::event_loop::EventLoop::with_user_event(); + let event_loop = glutin::event_loop::EventLoopBuilder::with_user_event().build(); let display = create_display(&event_loop); let mut egui_glium = egui_glium::EguiGlium::new(&display, &event_loop); diff --git a/egui_glow/Cargo.toml b/egui_glow/Cargo.toml index 3db0af718..923730dc5 100644 --- a/egui_glow/Cargo.toml +++ b/egui_glow/Cargo.toml @@ -72,7 +72,7 @@ wasm-bindgen = { version = "0.2" } [dev-dependencies] -glutin = "0.28.0" # examples/pure_glow +glutin = "0.29.0" # examples/pure_glow [[example]] diff --git a/egui_glow/examples/pure_glow.rs b/egui_glow/examples/pure_glow.rs index 1e10cb1db..07d4791df 100644 --- a/egui_glow/examples/pure_glow.rs +++ b/egui_glow/examples/pure_glow.rs @@ -6,7 +6,7 @@ fn main() { let mut clear_color = [0.1, 0.1, 0.1]; - let event_loop = glutin::event_loop::EventLoop::with_user_event(); + let event_loop = glutin::event_loop::EventLoopBuilder::with_user_event().build(); let (gl_window, gl) = create_display(&event_loop); let gl = std::sync::Arc::new(gl); From 48e7f219a3aaa43084d042590b2871c01415e642 Mon Sep 17 00:00:00 2001 From: Zoxc Date: Mon, 15 Aug 2022 10:19:59 +0200 Subject: [PATCH 09/16] Add CI for android (#1900) * Add CI for android * Don't use arboard on Android * Fix Android support for eframe --- .github/workflows/rust.yml | 15 +++++++++++++++ eframe/src/native/run.rs | 16 +++++++++------- egui-winit/Cargo.toml | 4 +++- egui-winit/src/clipboard.rs | 10 +++++----- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5cd5070a1..5be2cc79b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -195,3 +195,18 @@ jobs: - run: rustup target add wasm32-unknown-unknown - run: ./sh/setup_web.sh - run: ./sh/wasm_bindgen_check.sh + + android: + name: android + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.61.0 + target: aarch64-linux-android + override: true + + - run: cargo check --features wgpu --target aarch64-linux-android + working-directory: eframe diff --git a/eframe/src/native/run.rs b/eframe/src/native/run.rs index a0b730f20..b67271a6e 100644 --- a/eframe/src/native/run.rs +++ b/eframe/src/native/run.rs @@ -468,7 +468,7 @@ mod wgpu_integration { .unwrap(); // SAFETY: `window` must outlive `painter`. - #[allow(unsafe_code)] + #[allow(unsafe_code, unused_mut, unused_unsafe)] let painter = unsafe { let mut painter = egui_wgpu::winit::Painter::new( wgpu::Backends::PRIMARY | wgpu::Backends::GL, @@ -486,7 +486,7 @@ mod wgpu_integration { painter }; - let wgpu_render_state = painter.render_state().expect("Uninitialized"); + let wgpu_render_state = painter.render_state(); let system_theme = native_options.system_theme(); let mut integration = epi_integration::EpiIntegration::new( @@ -497,7 +497,7 @@ mod wgpu_integration { storage, #[cfg(feature = "glow")] None, - Some(wgpu_render_state.clone()), + wgpu_render_state.clone(), ); let theme = system_theme.unwrap_or(native_options.default_theme); integration.egui_ctx.set_visuals(theme.egui_visuals()); @@ -515,7 +515,7 @@ mod wgpu_integration { storage: integration.frame.storage(), #[cfg(feature = "glow")] gl: None, - wgpu_render_state: Some(wgpu_render_state), + wgpu_render_state, }); if app.warm_up_enabled() { @@ -629,11 +629,13 @@ mod wgpu_integration { match event { #[cfg(target_os = "android")] winit::event::Event::Resumed => unsafe { - painter.set_window(Some(&window)); + self.painter.set_window(Some(&self.window)); + EventResult::RepaintAsap }, #[cfg(target_os = "android")] - winit::event::Event::Paused => unsafe { - painter.set_window(None); + winit::event::Event::Suspended => unsafe { + self.painter.set_window(None); + EventResult::Wait }, winit::event::Event::WindowEvent { event, .. } => { diff --git a/egui-winit/Cargo.toml b/egui-winit/Cargo.toml index 95247e5c3..b1e1d75d2 100644 --- a/egui-winit/Cargo.toml +++ b/egui-winit/Cargo.toml @@ -49,7 +49,6 @@ tracing = { version = "0.1", default-features = false, features = ["std"] } winit = "0.27.2" #! ### Optional dependencies -arboard = { version = "2.1", optional = true, default-features = false } ## Enable this when generating docs. document-features = { version = "0.2", optional = true } @@ -64,3 +63,6 @@ webbrowser = { version = "0.7", optional = true } [target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies] smithay-clipboard = { version = "0.6.3", optional = true } + +[target.'cfg(not(target_os = "android"))'.dependencies] +arboard = { version = "2.1", optional = true, default-features = false } diff --git a/egui-winit/src/clipboard.rs b/egui-winit/src/clipboard.rs index ef11b12f7..576a78e52 100644 --- a/egui-winit/src/clipboard.rs +++ b/egui-winit/src/clipboard.rs @@ -5,7 +5,7 @@ use std::os::raw::c_void; /// If the "clipboard" feature is off, or we cannot connect to the OS clipboard, /// then a fallback clipboard that just works works within the same app is used instead. pub struct Clipboard { - #[cfg(feature = "arboard")] + #[cfg(all(feature = "arboard", not(target_os = "android")))] arboard: Option, #[cfg(all( @@ -28,7 +28,7 @@ impl Clipboard { #[allow(unused_variables)] pub fn new(#[allow(unused_variables)] wayland_display: Option<*mut c_void>) -> Self { Self { - #[cfg(feature = "arboard")] + #[cfg(all(feature = "arboard", not(target_os = "android")))] arboard: init_arboard(), #[cfg(all( any( @@ -66,7 +66,7 @@ impl Clipboard { }; } - #[cfg(feature = "arboard")] + #[cfg(all(feature = "arboard", not(target_os = "android")))] if let Some(clipboard) = &mut self.arboard { return match clipboard.get_text() { Ok(text) => Some(text), @@ -96,7 +96,7 @@ impl Clipboard { return; } - #[cfg(feature = "arboard")] + #[cfg(all(feature = "arboard", not(target_os = "android")))] if let Some(clipboard) = &mut self.arboard { if let Err(err) = clipboard.set_text(text) { tracing::error!("Copy/Cut error: {}", err); @@ -108,7 +108,7 @@ impl Clipboard { } } -#[cfg(feature = "arboard")] +#[cfg(all(feature = "arboard", not(target_os = "android")))] fn init_arboard() -> Option { match arboard::Clipboard::new() { Ok(clipboard) => Some(clipboard), From 9c58f12a6ca8202185ed391bd1aec0443db04467 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 15 Aug 2022 16:31:03 +0200 Subject: [PATCH 10/16] eframe: several windows in series (#1919) * Add example of opening several eframe windows in series * Reuse the same winit event loop * Ignore events to the wrong window * Run run_return again --- Cargo.lock | 7 ++++ Cargo.toml | 14 +------- eframe/src/native/run.rs | 52 +++++++++++++++++++++++----- examples/serial_windows/Cargo.toml | 12 +++++++ examples/serial_windows/README.md | 8 +++++ examples/serial_windows/src/main.rs | 53 +++++++++++++++++++++++++++++ 6 files changed, 124 insertions(+), 22 deletions(-) create mode 100644 examples/serial_windows/Cargo.toml create mode 100644 examples/serial_windows/README.md create mode 100644 examples/serial_windows/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index d6e25b668..7c779ccdd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3438,6 +3438,13 @@ dependencies = [ "syn", ] +[[package]] +name = "serial_windows" +version = "0.1.0" +dependencies = [ + "eframe", +] + [[package]] name = "servo-fontconfig" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index b05a4925b..8dd656f77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,19 +12,7 @@ members = [ "emath", "epaint", - "examples/confirm_exit", - "examples/custom_3d_glow", - "examples/custom_3d_three-d", - "examples/custom_font", - "examples/custom_font_style", - "examples/custom_window_frame", - "examples/download_image", - "examples/file_dialog", - "examples/hello_world", - "examples/puffin_profiler", - "examples/retained_image", - "examples/screenshot", - "examples/svg", + "examples/*", ] [profile.dev] diff --git a/eframe/src/native/run.rs b/eframe/src/native/run.rs index b67271a6e..217d2f720 100644 --- a/eframe/src/native/run.rs +++ b/eframe/src/native/run.rs @@ -72,7 +72,20 @@ trait WinitApp { fn on_event(&mut self, event: winit::event::Event<'_, RequestRepaintEvent>) -> EventResult; } -fn run_and_return(mut event_loop: EventLoop, mut winit_app: impl WinitApp) { +/// Access a thread-local event loop. +/// +/// We reuse the event-loop so we can support closing and opening an eframe window +/// multiple times. This is just a limitation of winit. +fn with_event_loop(f: impl FnOnce(&mut EventLoop)) { + use std::cell::RefCell; + thread_local!(static EVENT_LOOP: RefCell> = RefCell::new(winit::event_loop::EventLoopBuilder::with_user_event().build())); + + EVENT_LOOP.with(|event_loop| { + f(&mut *event_loop.borrow_mut()); + }); +} + +fn run_and_return(event_loop: &mut EventLoop, mut winit_app: impl WinitApp) { use winit::platform::run_return::EventLoopExtRunReturn as _; tracing::debug!("event_loop.run_return"); @@ -100,6 +113,14 @@ fn run_and_return(mut event_loop: EventLoop, mut winit_app: .. }) => EventResult::RepaintAsap, + winit::event::Event::WindowEvent { window_id, .. } + if window_id != winit_app.window().id() => + { + // This can happen if we close a window, and then reopen a new one, + // or if we have multiple windows open. + EventResult::Wait + } + event => winit_app.on_event(event), }; @@ -131,6 +152,13 @@ fn run_and_return(mut event_loop: EventLoop, mut winit_app: tracing::debug!("eframe window closed"); winit_app.save_and_destroy(); + + drop(winit_app); + + // Needed to clean the event_loop: + event_loop.run_return(|_, _, control_flow| { + control_flow.set_exit(); + }); } fn run_and_exit( @@ -424,12 +452,15 @@ mod glow_integration { native_options: &epi::NativeOptions, app_creator: epi::AppCreator, ) { - let event_loop = glutin::event_loop::EventLoopBuilder::with_user_event().build(); - let glow_eframe = GlowWinitApp::new(&event_loop, app_name, native_options, app_creator); - if native_options.run_and_return { - run_and_return(event_loop, glow_eframe); + with_event_loop(|event_loop| { + let glow_eframe = + GlowWinitApp::new(event_loop, app_name, native_options, app_creator); + run_and_return(event_loop, glow_eframe); + }); } else { + let event_loop = winit::event_loop::EventLoopBuilder::with_user_event().build(); + let glow_eframe = GlowWinitApp::new(&event_loop, app_name, native_options, app_creator); run_and_exit(event_loop, glow_eframe); } } @@ -684,12 +715,15 @@ mod wgpu_integration { native_options: &epi::NativeOptions, app_creator: epi::AppCreator, ) { - let event_loop = winit::event_loop::EventLoopBuilder::with_user_event().build(); - let wgpu_eframe = WgpuWinitApp::new(&event_loop, app_name, native_options, app_creator); - if native_options.run_and_return { - run_and_return(event_loop, wgpu_eframe); + with_event_loop(|event_loop| { + let wgpu_eframe = + WgpuWinitApp::new(event_loop, app_name, native_options, app_creator); + run_and_return(event_loop, wgpu_eframe); + }); } else { + let event_loop = winit::event_loop::EventLoopBuilder::with_user_event().build(); + let wgpu_eframe = WgpuWinitApp::new(&event_loop, app_name, native_options, app_creator); run_and_exit(event_loop, wgpu_eframe); } } diff --git a/examples/serial_windows/Cargo.toml b/examples/serial_windows/Cargo.toml new file mode 100644 index 000000000..a73860800 --- /dev/null +++ b/examples/serial_windows/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "serial_windows" +version = "0.1.0" +authors = ["Emil Ernerfeldt "] +license = "MIT OR Apache-2.0" +edition = "2021" +rust-version = "1.61" +publish = false + + +[dependencies] +eframe = { path = "../../eframe" } diff --git a/examples/serial_windows/README.md b/examples/serial_windows/README.md new file mode 100644 index 000000000..4941ce270 --- /dev/null +++ b/examples/serial_windows/README.md @@ -0,0 +1,8 @@ +Demonstrates how to open several windows after each other. + +NOTE: this doesn't work on Mac due to . +See also . + +```sh +cargo run -p serial_windows +``` diff --git a/examples/serial_windows/src/main.rs b/examples/serial_windows/src/main.rs new file mode 100644 index 000000000..79362ca16 --- /dev/null +++ b/examples/serial_windows/src/main.rs @@ -0,0 +1,53 @@ +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release + +use eframe::egui; + +fn main() { + if cfg!(target_os = "macos") { + eprintln!("WARNING: this example does not work on Mac! See https://github.com/emilk/egui/issues/1918"); + } + + let options = eframe::NativeOptions { + run_and_return: true, + ..Default::default() + }; + + eprintln!("Starting first window…"); + eframe::run_native( + "First Window", + options.clone(), + Box::new(|_cc| Box::new(MyApp::default())), + ); + + std::thread::sleep(std::time::Duration::from_secs(2)); + + eprintln!("Starting second window…"); + eframe::run_native( + "Second Window", + options.clone(), + Box::new(|_cc| Box::new(MyApp::default())), + ); + + std::thread::sleep(std::time::Duration::from_secs(2)); + + eprintln!("Starting third window…"); + eframe::run_native( + "Third Window", + options, + Box::new(|_cc| Box::new(MyApp::default())), + ); +} + +#[derive(Default)] +struct MyApp {} + +impl eframe::App for MyApp { + fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) { + egui::CentralPanel::default().show(ctx, |ui| { + if ui.button("Close").clicked() { + eprintln!("Pressed Close button"); + frame.quit(); + } + }); + } +} From 39b63f6163c7aabbf20138b505f0c86d62977408 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 16 Aug 2022 22:47:23 +0200 Subject: [PATCH 11/16] Warn if using an `TextShape` from before a change to pixels_per_point Closes https://github.com/emilk/egui/issues/1915 --- epaint/src/shape.rs | 9 +++++++++ epaint/src/tessellator.rs | 5 +++++ epaint/src/text/text_layout.rs | 1 + epaint/src/text/text_layout_types.rs | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/epaint/src/shape.rs b/epaint/src/shape.rs index 1409bfb44..3a72bc324 100644 --- a/epaint/src/shape.rs +++ b/epaint/src/shape.rs @@ -13,6 +13,11 @@ pub use crate::{CubicBezierShape, QuadraticBezierShape}; /// A paint primitive such as a circle or a piece of text. /// Coordinates are all screen space points (not physical pixels). +/// +/// You should generally recreate your [`Shape`]s each frame, +/// but storing them should also be fine with one exception: +/// [`Shape::Text`] depends on the current `pixels_per_point` (dpi scale) +/// and so must be recreated every time `pixels_per_point` changes. #[must_use = "Add a Shape to a Painter"] #[derive(Clone, Debug, PartialEq)] pub enum Shape { @@ -37,6 +42,8 @@ pub enum Shape { Rect(RectShape), /// Text. + /// + /// This needs to be recreated if `pixels_per_point` (dpi scale) changes. Text(TextShape), /// A general triangle mesh. @@ -604,6 +611,8 @@ impl Rounding { // ---------------------------------------------------------------------------- /// How to paint some text on screen. +/// +/// This needs to be recreated if `pixels_per_point` (dpi scale) changes. #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct TextShape { diff --git a/epaint/src/tessellator.rs b/epaint/src/tessellator.rs index 32826f4ee..7eb4089df 100644 --- a/epaint/src/tessellator.rs +++ b/epaint/src/tessellator.rs @@ -1334,6 +1334,11 @@ impl Tessellator { return; } + if galley.pixels_per_point != self.pixels_per_point { + eprintln!("epaint: WARNING: pixels_per_point (dpi scale) have changed between text layout and tessellation. \ + You must recreate your text shapes if pixels_per_point changes."); + } + out.vertices.reserve(galley.num_vertices); out.indices.reserve(galley.num_indices); diff --git a/epaint/src/text/text_layout.rs b/epaint/src/text/text_layout.rs index 3b2220912..801ea3ec8 100644 --- a/epaint/src/text/text_layout.rs +++ b/epaint/src/text/text_layout.rs @@ -478,6 +478,7 @@ fn galley_from_rows(point_scale: PointScale, job: Arc, mut rows: Vec< mesh_bounds, num_vertices, num_indices, + pixels_per_point: point_scale.pixels_per_point, } } diff --git a/epaint/src/text/text_layout_types.rs b/epaint/src/text/text_layout_types.rs index 830acb842..07472e23a 100644 --- a/epaint/src/text/text_layout_types.rs +++ b/epaint/src/text/text_layout_types.rs @@ -309,6 +309,8 @@ impl Default for TextWrapping { /// Text that has been layed out, ready for painting. /// /// You can create a [`Galley`] using [`crate::Fonts::layout_job`]; +/// +/// This needs to be recreated if `pixels_per_point` (dpi scale) changes. #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Galley { @@ -341,6 +343,12 @@ pub struct Galley { /// Total number of indices in all the row meshes. pub num_indices: usize, + + /// The number of physical pixels for each logical point. + /// Since this affects the layout, we keep track of it + /// so that we can warn if this has changed once we get to + /// tessellation. + pub pixels_per_point: f32, } #[derive(Clone, Debug, PartialEq)] From eeeb4b7de2d08b7923a0e19cf1a711b7219afa1f Mon Sep 17 00:00:00 2001 From: Asger Nyman Christiansen Date: Wed, 17 Aug 2022 21:33:34 +0200 Subject: [PATCH 12/16] Improve custom_3d_three-d example (#1923) * Use correct FBO to output * custom_3d_three-d web * Update .gitignore * Do not free the FBO * Use three-d 0.13 * ThreeDApp * Only construct model and camera once * Clean-up and docs * Web build instructions * Remove unused dependencies * Update Cargo.lock * Fix build * More fixes * omg --- .gitignore | 1 + Cargo.lock | 125 ++--------- examples/custom_3d_three-d/Cargo.toml | 9 +- examples/custom_3d_three-d/README.md | 4 + examples/custom_3d_three-d/index.html | 38 ++++ examples/custom_3d_three-d/src/lib.rs | 19 ++ examples/custom_3d_three-d/src/main.rs | 279 +++++++++++++++---------- 7 files changed, 264 insertions(+), 211 deletions(-) create mode 100644 examples/custom_3d_three-d/index.html create mode 100644 examples/custom_3d_three-d/src/lib.rs diff --git a/.gitignore b/.gitignore index 14ea8159a..bd26ae082 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /.*.json /.vscode /media/* +.DS_Store diff --git a/Cargo.lock b/Cargo.lock index 7c779ccdd..069e3a13f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide 0.5.3", + "miniz_oxide", "object", "rustc-demangle", ] @@ -898,10 +898,13 @@ dependencies = [ name = "custom_3d_three-d" version = "0.1.0" dependencies = [ + "console_error_panic_hook", "eframe", "egui_glow", "glow", "three-d", + "wasm-bindgen", + "wasm-bindgen-futures", ] [[package]] @@ -1003,16 +1006,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7046468a81e6a002061c01e6a7c83139daf91b11c30e66795b13217c2d885c8b" -[[package]] -name = "deflate" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" -dependencies = [ - "adler32", - "byteorder", -] - [[package]] name = "deflate" version = "1.0.0" @@ -1123,7 +1116,7 @@ dependencies = [ "eframe", "egui_extras", "ehttp", - "image 0.24.2", + "image", "poll-promise", ] @@ -1258,7 +1251,7 @@ dependencies = [ "egui_demo_lib", "egui_extras", "ehttp", - "image 0.24.2", + "image", "poll-promise", "pollster", "serde", @@ -1290,7 +1283,7 @@ dependencies = [ "chrono", "document-features", "egui", - "image 0.24.2", + "image", "resvg", "serde", "tiny-skia", @@ -1308,7 +1301,7 @@ dependencies = [ "egui", "egui-winit", "glium", - "image 0.24.2", + "image", ] [[package]] @@ -1491,7 +1484,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ "crc32fast", - "miniz_oxide 0.5.3", + "miniz_oxide", ] [[package]] @@ -1786,16 +1779,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -[[package]] -name = "gloo-timers" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "glow" version = "0.11.2" @@ -1948,7 +1931,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" dependencies = [ "num-traits", - "serde", "zerocopy", ] @@ -2033,22 +2015,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "image" -version = "0.23.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "jpeg-decoder 0.1.22", - "num-iter", - "num-rational 0.3.2", - "num-traits", - "png 0.16.8", -] - [[package]] name = "image" version = "0.24.2" @@ -2058,11 +2024,11 @@ dependencies = [ "bytemuck", "byteorder", "color_quant", - "jpeg-decoder 0.2.6", + "jpeg-decoder", "num-iter", - "num-rational 0.4.1", + "num-rational", "num-traits", - "png 0.17.5", + "png", ] [[package]] @@ -2143,12 +2109,6 @@ dependencies = [ "libc", ] -[[package]] -name = "jpeg-decoder" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" - [[package]] name = "jpeg-decoder" version = "0.2.6" @@ -2326,15 +2286,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - [[package]] name = "miniz_oxide" version = "0.5.3" @@ -2552,17 +2503,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -2872,18 +2812,6 @@ dependencies = [ "plotters-backend", ] -[[package]] -name = "png" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" -dependencies = [ - "bitflags", - "crc32fast", - "deflate 0.8.6", - "miniz_oxide 0.3.7", -] - [[package]] name = "png" version = "0.17.5" @@ -2892,8 +2820,8 @@ checksum = "dc38c0ad57efb786dd57b9864e5b18bae478c00c824dc55a38bbc9da95dde3ba" dependencies = [ "bitflags", "crc32fast", - "deflate 1.0.0", - "miniz_oxide 0.5.3", + "deflate", + "miniz_oxide", ] [[package]] @@ -3150,10 +3078,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34489194784b86c03c3d688258e2ba73f3c82700ba4673ee2ecad5ae540b9438" dependencies = [ "gif", - "jpeg-decoder 0.2.6", + "jpeg-decoder", "log", "pico-args", - "png 0.17.5", + "png", "rgb", "svgfilters", "svgtypes", @@ -3167,7 +3095,7 @@ version = "0.1.0" dependencies = [ "eframe", "egui_extras", - "image 0.24.2", + "image", ] [[package]] @@ -3813,32 +3741,27 @@ dependencies = [ [[package]] name = "three-d" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc0ef660c02244f00fc2d1759e67d30a3c282541458490de641f0e832c8d3c9" +checksum = "f7a5a1017829335f6761bdbae2daf3021a88314a1f8d5f188c9b62ce62e2fd31" dependencies = [ "cgmath", - "gloo-timers", "glow", - "half", - "js-sys", - "serde", + "instant", "thiserror", "three-d-asset", "wasm-bindgen", - "wasm-bindgen-futures", "web-sys", ] [[package]] name = "three-d-asset" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1886553d8b51093705b6d1a02ec2c41ac78260f68b40682d94d9976960d689" +checksum = "e953f34aa4169e098621a1ff23a68c47b7798711f7c769bf741248e850e93fbe" dependencies = [ "cgmath", "half", - "image 0.23.14", "thiserror", "web-sys", ] @@ -3875,7 +3798,7 @@ dependencies = [ "arrayvec 0.5.2", "bytemuck", "cfg-if", - "png 0.17.5", + "png", "safe_arch", ] @@ -4229,8 +4152,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ "cfg-if", - "serde", - "serde_json", "wasm-bindgen-macro", ] diff --git a/examples/custom_3d_three-d/Cargo.toml b/examples/custom_3d_three-d/Cargo.toml index 277276471..8841fb46c 100644 --- a/examples/custom_3d_three-d/Cargo.toml +++ b/examples/custom_3d_three-d/Cargo.toml @@ -7,9 +7,16 @@ edition = "2021" rust-version = "1.61" publish = false +[lib] +crate-type = ["cdylib", "rlib"] [dependencies] eframe = { path = "../../eframe", features = ["glow"] } egui_glow = { path = "../../egui_glow" } glow = "0.11" -three-d = { version = "0.12", default-features = false } # 2022-05-22 +three-d = { version = "0.13", default-features = false } + +[target.'cfg(target_arch = "wasm32")'.dependencies] # Web dependencies +wasm-bindgen = "0.2" # Core bindings +wasm-bindgen-futures = "0.4" # Core bindings +console_error_panic_hook = "0.1" # For logging diff --git a/examples/custom_3d_three-d/README.md b/examples/custom_3d_three-d/README.md index c6de521fb..58c6d23fc 100644 --- a/examples/custom_3d_three-d/README.md +++ b/examples/custom_3d_three-d/README.md @@ -14,3 +14,7 @@ If you are content of having egui sit on top of a 3D background, take a look at: ```sh cargo run -p custom_3d_three-d ``` + +``` +wasm-pack build examples/custom_3d_three-d --target web +``` diff --git a/examples/custom_3d_three-d/index.html b/examples/custom_3d_three-d/index.html new file mode 100644 index 000000000..e26cad7c3 --- /dev/null +++ b/examples/custom_3d_three-d/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + diff --git a/examples/custom_3d_three-d/src/lib.rs b/examples/custom_3d_three-d/src/lib.rs new file mode 100644 index 000000000..ff2e4fd15 --- /dev/null +++ b/examples/custom_3d_three-d/src/lib.rs @@ -0,0 +1,19 @@ +mod main; + +// Entry point for wasm +#[cfg(target_arch = "wasm32")] +use wasm_bindgen::prelude::*; + +#[cfg(target_arch = "wasm32")] +#[wasm_bindgen(start)] +pub async fn start() -> Result<(), JsValue> { + std::panic::set_hook(Box::new(console_error_panic_hook::hook)); + + let web_options = eframe::WebOptions::default(); + eframe::start_web( + "my", + web_options, + Box::new(|cc| Box::new(main::MyApp::new(cc))), + )?; + Ok(()) +} diff --git a/examples/custom_3d_three-d/src/main.rs b/examples/custom_3d_three-d/src/main.rs index 0ca9eb58e..aa0f5a53b 100644 --- a/examples/custom_3d_three-d/src/main.rs +++ b/examples/custom_3d_three-d/src/main.rs @@ -1,7 +1,9 @@ +#![allow(dead_code)] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release use eframe::egui; +#[cfg(not(target_arch = "wasm32"))] fn main() { let options = eframe::NativeOptions { initial_window_size: Some(egui::vec2(550.0, 610.0)), @@ -17,12 +19,12 @@ fn main() { ); } -struct MyApp { +pub struct MyApp { angle: f32, } impl MyApp { - fn new(_cc: &eframe::CreationContext<'_>) -> Self { + pub fn new(_cc: &eframe::CreationContext<'_>) -> Self { Self { angle: 0.2 } } } @@ -41,7 +43,28 @@ impl eframe::App for MyApp { egui::ScrollArea::both().show(ui, |ui| { egui::Frame::canvas(ui.style()).show(ui, |ui| { - self.custom_painting(ui); + let (rect, response) = + ui.allocate_exact_size(egui::Vec2::splat(512.0), egui::Sense::drag()); + + self.angle += response.drag_delta().x * 0.01; + + // Clone locals so we can move them into the paint callback: + let angle = self.angle; + + let callback = egui::PaintCallback { + rect, + callback: std::sync::Arc::new(egui_glow::CallbackFn::new( + move |info, painter| { + with_three_d(painter.gl(), |three_d| { + three_d.frame( + FrameInput::new(&three_d.context, &info, painter), + angle, + ); + }); + }, + )), + }; + ui.painter().add(callback); }); ui.label("Drag to rotate!"); }); @@ -49,120 +72,160 @@ impl eframe::App for MyApp { } } -impl MyApp { - fn custom_painting(&mut self, ui: &mut egui::Ui) { - let (rect, response) = - ui.allocate_exact_size(egui::Vec2::splat(512.0), egui::Sense::drag()); - - self.angle += response.drag_delta().x * 0.01; - - // Clone locals so we can move them into the paint callback: - let angle = self.angle; - - let callback = egui::PaintCallback { - rect, - callback: std::sync::Arc::new(egui_glow::CallbackFn::new(move |info, painter| { - with_three_d_context(painter.gl(), |three_d| { - paint_with_three_d(three_d, &info, angle); - }); - })), - }; - ui.painter().add(callback); - } -} - -/// We get a [`glow::Context`] from `eframe`, but we want a [`three_d::Context`]. +/// We get a [`glow::Context`] from `eframe` and we want to construct a [`ThreeDApp`]. /// -/// Sadly we can't just create a [`three_d::Context`] in [`MyApp::new`] and pass it -/// to the [`egui::PaintCallback`] because [`three_d::Context`] isn't `Send+Sync`, which -/// [`egui::PaintCallback`] is. -fn with_three_d_context( - gl: &std::sync::Arc, - f: impl FnOnce(&three_d::Context) -> R, -) -> R { +/// Sadly we can't just create a [`ThreeDApp`] in [`MyApp::new`] and pass it +/// to the [`egui::PaintCallback`] because [`glow::Context`] isn't `Send+Sync` on web, which +/// [`egui::PaintCallback`] needs. If you do not target web, then you can construct the [`ThreeDApp`] in [`MyApp::new`]. +fn with_three_d(gl: &std::sync::Arc, f: impl FnOnce(&mut ThreeDApp) -> R) -> R { use std::cell::RefCell; thread_local! { - pub static THREE_D: RefCell> = RefCell::new(None); - } - - // If you are using the depth buffer you need to do this: - #[allow(unsafe_code)] - unsafe { - use glow::HasContext as _; - gl.enable(glow::DEPTH_TEST); - if !cfg!(target_arch = "wasm32") { - gl.disable(glow::FRAMEBUFFER_SRGB); - } - gl.clear(glow::DEPTH_BUFFER_BIT); + pub static THREE_D: RefCell> = RefCell::new(None); } THREE_D.with(|three_d| { let mut three_d = three_d.borrow_mut(); - let three_d = - three_d.get_or_insert_with(|| three_d::Context::from_gl_context(gl.clone()).unwrap()); + let three_d = three_d.get_or_insert_with(|| ThreeDApp::new(gl.clone())); f(three_d) }) } -fn paint_with_three_d(three_d: &three_d::Context, info: &egui::PaintCallbackInfo, angle: f32) { - // Based on https://github.com/asny/three-d/blob/master/examples/triangle/src/main.rs - use three_d::*; - - // Set where to paint - let viewport = info.viewport_in_pixels(); - let viewport = Viewport { - x: viewport.left_px.round() as _, - y: viewport.from_bottom_px.round() as _, - width: viewport.width_px.round() as _, - height: viewport.height_px.round() as _, - }; - - // Respect the egui clip region (e.g. if we are inside an `egui::ScrollArea`). - let clip_rect = info.clip_rect_in_pixels(); - three_d.set_scissor(ScissorBox { - x: clip_rect.left_px.round() as _, - y: clip_rect.from_bottom_px.round() as _, - width: clip_rect.width_px.round() as _, - height: clip_rect.height_px.round() as _, - }); - - let camera = Camera::new_perspective( - three_d, - viewport, - vec3(0.0, 0.0, 2.0), - vec3(0.0, 0.0, 0.0), - vec3(0.0, 1.0, 0.0), - degrees(45.0), - 0.1, - 10.0, - ) - .unwrap(); - - // Create a CPU-side mesh consisting of a single colored triangle - let positions = vec![ - vec3(0.5, -0.5, 0.0), // bottom right - vec3(-0.5, -0.5, 0.0), // bottom left - vec3(0.0, 0.5, 0.0), // top - ]; - let colors = vec![ - Color::new(255, 0, 0, 255), // bottom right - Color::new(0, 255, 0, 255), // bottom left - Color::new(0, 0, 255, 255), // top - ]; - let cpu_mesh = CpuMesh { - positions: Positions::F32(positions), - colors: Some(colors), - ..Default::default() - }; - - let mut model = Gm::new( - Mesh::new(three_d, &cpu_mesh).unwrap(), - ColorMaterial::default(), - ); - - // Set the current transformation of the triangle - model.set_transformation(Mat4::from_angle_y(radians(angle))); - - // Render the triangle with the color material which uses the per vertex colors defined at construction - model.render(&camera, &[]).unwrap(); +/// +/// Translates from egui input to three-d input +/// +pub struct FrameInput<'a> { + screen: three_d::RenderTarget<'a>, + viewport: three_d::Viewport, + scissor_box: three_d::ScissorBox, +} + +impl FrameInput<'_> { + pub fn new( + context: &three_d::Context, + info: &egui::PaintCallbackInfo, + painter: &egui_glow::Painter, + ) -> Self { + use three_d::*; + + // Disable sRGB textures for three-d + #[cfg(not(target_arch = "wasm32"))] + #[allow(unsafe_code)] + unsafe { + use glow::HasContext as _; + context.disable(glow::FRAMEBUFFER_SRGB); + } + + // Constructs a screen render target to render the final image to + let screen = painter.intermediate_fbo().map_or_else( + || { + RenderTarget::screen( + context, + info.viewport.width() as u32, + info.viewport.height() as u32, + ) + }, + |fbo| { + RenderTarget::from_framebuffer( + context, + info.viewport.width() as u32, + info.viewport.height() as u32, + fbo, + ) + }, + ); + + // Set where to paint + let viewport = info.viewport_in_pixels(); + let viewport = Viewport { + x: viewport.left_px.round() as _, + y: viewport.from_bottom_px.round() as _, + width: viewport.width_px.round() as _, + height: viewport.height_px.round() as _, + }; + + // Respect the egui clip region (e.g. if we are inside an `egui::ScrollArea`). + let clip_rect = info.clip_rect_in_pixels(); + let scissor_box = ScissorBox { + x: clip_rect.left_px.round() as _, + y: clip_rect.from_bottom_px.round() as _, + width: clip_rect.width_px.round() as _, + height: clip_rect.height_px.round() as _, + }; + Self { + screen, + scissor_box, + viewport, + } + } +} + +/// +/// Based on the `three-d` [Triangle example](https://github.com/asny/three-d/blob/master/examples/triangle/src/main.rs). +/// This is where you'll need to customize +/// +use three_d::*; +pub struct ThreeDApp { + context: Context, + camera: Camera, + model: Gm, +} + +impl ThreeDApp { + pub fn new(gl: std::sync::Arc) -> Self { + let context = Context::from_gl_context(gl).unwrap(); + // Create a camera + let camera = Camera::new_perspective( + Viewport::new_at_origo(1, 1), + vec3(0.0, 0.0, 2.0), + vec3(0.0, 0.0, 0.0), + vec3(0.0, 1.0, 0.0), + degrees(45.0), + 0.1, + 10.0, + ); + + // Create a CPU-side mesh consisting of a single colored triangle + let positions = vec![ + vec3(0.5, -0.5, 0.0), // bottom right + vec3(-0.5, -0.5, 0.0), // bottom left + vec3(0.0, 0.5, 0.0), // top + ]; + let colors = vec![ + Color::new(255, 0, 0, 255), // bottom right + Color::new(0, 255, 0, 255), // bottom left + Color::new(0, 0, 255, 255), // top + ]; + let cpu_mesh = CpuMesh { + positions: Positions::F32(positions), + colors: Some(colors), + ..Default::default() + }; + + // Construct a model, with a default color material, thereby transferring the mesh data to the GPU + let model = Gm::new(Mesh::new(&context, &cpu_mesh), ColorMaterial::default()); + Self { + context, + camera, + model, + } + } + + pub fn frame(&mut self, frame_input: FrameInput<'_>, angle: f32) -> Option { + // Ensure the viewport matches the current window viewport which changes if the window is resized + self.camera.set_viewport(frame_input.viewport); + + // Set the current transformation of the triangle + self.model + .set_transformation(Mat4::from_angle_y(radians(angle))); + + // Get the screen render target to be able to render something on the screen + frame_input + .screen + // Clear the color and depth of the screen render target + .clear_partially(frame_input.scissor_box, ClearState::depth(1.0)) + // Render the triangle with the color material which uses the per vertex colors defined at construction + .render_partially(frame_input.scissor_box, &self.camera, &[&self.model], &[]); + + frame_input.screen.into_framebuffer() // Take back the screen fbo, we will continue to use it. + } } From 5514a8afda53c282d2be670bef657d5c7812d467 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 19 Aug 2022 11:46:38 +0200 Subject: [PATCH 13/16] Update dependencies (#1933) * Update ahash from 0.7 to 0.8 Opt to use ahash::HashMap over ahash::AHashMap * Fix ahash compilation for web * Update ron to 0.8 * Add note about why we cannot update tiny-skia * cargo update Updating crates.io index Updating android_system_properties v0.1.2 -> v0.1.4 Updating anyhow v1.0.58 -> v1.0.62 Updating async-broadcast v0.4.0 -> v0.4.1 Updating async-channel v1.6.1 -> v1.7.1 Updating async-io v1.7.0 -> v1.8.0 Updating async-task v4.2.0 -> v4.3.0 Updating async-trait v0.1.56 -> v0.1.57 Updating backtrace v0.3.65 -> v0.3.66 Updating bit-set v0.5.2 -> v0.5.3 Updating bumpalo v3.10.0 -> v3.11.0 Updating bytemuck v1.10.0 -> v1.12.1 Updating bytemuck_derive v1.1.0 -> v1.2.1 Updating bytes v1.1.0 -> v1.2.1 Updating cast v0.2.7 -> v0.3.0 Updating chrono v0.4.19 -> v0.4.22 Updating clap v3.2.8 -> v3.2.17 Updating clipboard-win v4.4.1 -> v4.4.2 Updating combine v4.6.4 -> v4.6.6 Updating concurrent-queue v1.2.2 -> v1.2.4 Updating criterion v0.3.5 -> v0.3.6 Updating criterion-plot v0.4.4 -> v0.4.5 Updating crossbeam-channel v0.5.5 -> v0.5.6 Updating crossbeam-deque v0.8.1 -> v0.8.2 Updating crossbeam-epoch v0.9.9 -> v0.9.10 Updating crossbeam-utils v0.8.10 -> v0.8.11 Updating document-features v0.2.1 -> v0.2.3 Updating dyn-clone v1.0.6 -> v1.0.9 Removing easy-parallel v3.2.0 Updating either v1.7.0 -> v1.8.0 Updating enum-map v2.1.0 -> v2.4.1 Updating enum-map-derive v0.8.0 -> v0.10.0 Updating event-listener v2.5.2 -> v2.5.3 Updating fastrand v1.7.0 -> v1.8.0 Updating futures-core v0.3.21 -> v0.3.23 Updating futures-io v0.3.21 -> v0.3.23 Updating futures-sink v0.3.21 -> v0.3.23 Updating futures-task v0.3.21 -> v0.3.23 Updating futures-util v0.3.21 -> v0.3.23 Updating gimli v0.26.1 -> v0.26.2 Updating gpu-descriptor v0.2.2 -> v0.2.3 Removing hashbrown v0.11.2 Removing hashbrown v0.12.1 Adding hashbrown v0.12.3 Adding iana-time-zone v0.1.46 Updating image v0.24.2 -> v0.24.3 Updating inplace_it v0.3.3 -> v0.3.4 Updating itoa v1.0.2 -> v1.0.3 Updating js-sys v0.3.58 -> v0.3.59 Updating libc v0.2.126 -> v0.2.132 Updating libm v0.2.2 -> v0.2.5 Removing memmap2 v0.3.1 Removing memmap2 v0.5.4 Adding memmap2 v0.5.7 Removing num-iter v0.1.43 Updating object v0.28.4 -> v0.29.0 Updating once_cell v1.13.0 -> v1.13.1 Updating os_str_bytes v6.1.0 -> v6.3.0 Updating owned_ttf_parser v0.15.0 -> v0.15.1 Removing parking_lot v0.11.2 Removing parking_lot_core v0.8.5 Updating plotters v0.3.1 -> v0.3.3 Updating plotters-backend v0.3.2 -> v0.3.4 Updating plotters-svg v0.3.1 -> v0.3.3 Updating proc-macro-crate v1.1.3 -> v1.2.1 Updating proc-macro2 v1.0.40 -> v1.0.43 Updating quote v1.0.20 -> v1.0.21 Updating redox_syscall v0.2.13 -> v0.2.16 Updating regex v1.5.6 -> v1.6.0 Updating regex-syntax v0.6.26 -> v0.6.27 Updating rfd v0.8.0 -> v0.8.4 Removing rustc_version v0.4.0 Updating ryu v1.0.10 -> v1.0.11 Updating sctk-adwaita v0.4.1 -> v0.4.2 Removing semver v1.0.12 Updating serde v1.0.138 -> v1.0.143 Updating serde_derive v1.0.138 -> v1.0.143 Updating serde_json v1.0.82 -> v1.0.83 Updating serde_repr v0.1.8 -> v0.1.9 Updating slab v0.4.6 -> v0.4.7 Removing smithay-client-toolkit v0.15.4 Updating smithay-clipboard v0.6.5 -> v0.6.6 Updating syn v1.0.98 -> v1.0.99 Updating thiserror v1.0.31 -> v1.0.32 Updating thiserror-impl v1.0.31 -> v1.0.32 Updating time v0.3.11 -> v0.3.13 Adding tiny-skia v0.7.0 Adding tiny-skia-path v0.7.0 Updating tracing v0.1.35 -> v0.1.36 Updating tracing-core v0.1.28 -> v0.1.29 Updating tracing-subscriber v0.3.14 -> v0.3.15 Updating unicode-ident v1.0.1 -> v1.0.3 Updating unicode_names2 v0.5.0 -> v0.5.1 Updating ureq v2.4.0 -> v2.5.0 Updating wasm-bindgen-futures v0.4.31 -> v0.4.32 Updating web-sys v0.3.58 -> v0.3.59 Updating webpki-roots v0.22.3 -> v0.22.4 Updating weezl v0.1.6 -> v0.1.7 Updating wgpu-core v0.13.1 -> v0.13.2 Updating wgpu-hal v0.13.1 -> v0.13.2 Updating wgpu-types v0.13.0 -> v0.13.2 Updating windows v0.32.0 -> v0.37.0 Updating windows_aarch64_msvc v0.32.0 -> v0.37.0 Updating windows_i686_gnu v0.32.0 -> v0.37.0 Updating windows_i686_msvc v0.32.0 -> v0.37.0 Updating windows_x86_64_gnu v0.32.0 -> v0.37.0 Updating windows_x86_64_msvc v0.32.0 -> v0.37.0 Updating x11-dl v2.19.1 -> v2.20.0 Updating zbus_names v2.1.0 -> v2.2.0 Updating zvariant v3.4.1 -> v3.6.0 Updating zvariant_derive v3.4.1 -> v3.6.0 * Add "Unicode-DFS-2016" to deny.toml whitelist --- Cargo.lock | 639 +++++++++++++++----------------- deny.toml | 21 +- eframe/Cargo.toml | 3 +- egui/Cargo.toml | 4 +- egui/src/id.rs | 4 +- egui/src/memory.rs | 10 +- egui/src/util/cache.rs | 2 +- egui/src/widgets/plot/legend.rs | 6 +- egui/src/widgets/plot/mod.rs | 3 +- egui_extras/Cargo.toml | 2 +- egui_glium/Cargo.toml | 2 +- egui_glium/src/painter.rs | 3 +- epaint/Cargo.toml | 2 +- epaint/src/text/font.rs | 5 +- epaint/src/text/fonts.rs | 4 +- epaint/src/textures.rs | 3 +- epaint/src/util/mod.rs | 2 +- 17 files changed, 336 insertions(+), 379 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 069e3a13f..0deb4ba0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,6 +51,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e6e951cfbb2db8de1828d49073a113a29fd7117b1596caa781a258c7e38d72" +dependencies = [ + "cfg-if", "getrandom", "once_cell", "serde", @@ -68,9 +80,9 @@ dependencies = [ [[package]] name = "android_system_properties" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20ae67ce26261f218e2b3f2f0d01887a9818283ca6fb260fa7c67e253d61c92" +checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e" dependencies = [ "libc", ] @@ -86,9 +98,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.58" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" +checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305" [[package]] name = "approx" @@ -110,7 +122,7 @@ dependencies = [ "objc", "objc-foundation", "objc_id", - "parking_lot 0.12.1", + "parking_lot", "thiserror", "winapi", "x11rb", @@ -145,21 +157,20 @@ dependencies = [ [[package]] name = "async-broadcast" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bbd92a9bd0e9c1298118ecf8a2f825e86b12c3ec9e411573e34aaf3a0c03cdd" +checksum = "6d26004fe83b2d1cd3a97609b21e39f9a31535822210fe83205d2ce48866ea61" dependencies = [ - "easy-parallel", "event-listener", "futures-core", - "parking_lot 0.11.2", + "parking_lot", ] [[package]] name = "async-channel" -version = "1.6.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ "concurrent-queue", "event-listener", @@ -182,10 +193,11 @@ dependencies = [ [[package]] name = "async-io" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07" +checksum = "0ab006897723d9352f63e2b13047177c3982d8d79709d713ce7747a8f19fd1b0" dependencies = [ + "autocfg", "concurrent-queue", "futures-lite", "libc", @@ -221,15 +233,15 @@ dependencies = [ [[package]] name = "async-task" -version = "4.2.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" +checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" +checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" dependencies = [ "proc-macro2", "quote", @@ -273,9 +285,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", @@ -310,7 +322,7 @@ dependencies = [ "bitflags", "cexpr", "clang-sys", - "clap 3.2.8", + "clap 3.2.17", "env_logger", "lazy_static", "lazycell", @@ -326,9 +338,9 @@ dependencies = [ [[package]] name = "bit-set" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" dependencies = [ "bit-vec", ] @@ -365,24 +377,24 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" [[package]] name = "bytemuck" -version = "1.10.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" +checksum = "2f5715e491b5a1598fc2bef5a606847b5dc1d48ea625bd3c02c00de8285591da" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" +checksum = "1b9e1f5fa78f69496407a27ae9ed989e3c3b072310286f5ef385525e4cbc24a9" dependencies = [ "proc-macro2", "quote", @@ -397,9 +409,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "cache-padded" @@ -432,12 +444,9 @@ dependencies = [ [[package]] name = "cast" -version = "0.2.7" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" -dependencies = [ - "rustc_version", -] +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" @@ -505,12 +514,12 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" dependencies = [ + "iana-time-zone", "js-sys", - "libc", "num-integer", "num-traits", "time 0.1.44", @@ -554,9 +563,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.8" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83" +checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b" dependencies = [ "atty", "bitflags", @@ -578,9 +587,9 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "4.4.1" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3e1238132dc01f081e1cbb9dace14e5ef4c3a51ee244bd982275fb514605db" +checksum = "c4ab1b92798304eedc095b53942963240037c0516452cb11aeba709d420b2219" dependencies = [ "error-code", "str-buf", @@ -651,9 +660,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "combine" -version = "4.6.4" +version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ "bytes", "memchr", @@ -661,9 +670,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.2.2" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" dependencies = [ "cache-padded", ] @@ -755,9 +764,9 @@ dependencies = [ [[package]] name = "criterion" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10" +checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" dependencies = [ "atty", "cast", @@ -781,9 +790,9 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ "cast", "itertools", @@ -791,9 +800,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if", "crossbeam-utils", @@ -801,9 +810,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -812,9 +821,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" dependencies = [ "autocfg", "cfg-if", @@ -826,9 +835,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if", "once_cell", @@ -1099,9 +1108,9 @@ dependencies = [ [[package]] name = "document-features" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01c09fd63b5136fba41aa625c7b3254f0aa0a435ff6ec4b2c9a28d496c83c88" +checksum = "d99bbe945402eb228b85cdfc7020cf7422574976861c642b28255d0a49606d79" [[package]] name = "downcast-rs" @@ -1157,15 +1166,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "140206b78fb2bc3edbcfc9b5ccbd0b30699cfe8d348b8b31b330e47df5291a5a" - -[[package]] -name = "easy-parallel" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6907e25393cdcc1f4f3f513d9aac1e840eb1cc341a0fccb01171f7d14d10b946" +checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" [[package]] name = "eframe" @@ -1179,6 +1182,7 @@ dependencies = [ "egui-wgpu", "egui-winit", "egui_glow", + "getrandom", "glow", "glutin", "js-sys", @@ -1199,7 +1203,7 @@ dependencies = [ name = "egui" version = "0.18.1" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.0", "document-features", "epaint", "nohash-hasher", @@ -1286,7 +1290,7 @@ dependencies = [ "image", "resvg", "serde", - "tiny-skia", + "tiny-skia 0.6.6", "tracing", "usvg", ] @@ -1295,7 +1299,7 @@ dependencies = [ name = "egui_glium" version = "0.18.0" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.0", "bytemuck", "document-features", "egui", @@ -1336,9 +1340,9 @@ dependencies = [ [[package]] name = "either" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "emath" @@ -1352,9 +1356,9 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.1.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0348b2a57c82f98b9dbd8098b1abb2416f221823d3e50cbe24eaebdd16896826" +checksum = "f5a56d54c8dd9b3ad34752ed197a4eb2a6601bc010808eb097a04a58ae4c43e1" dependencies = [ "enum-map-derive", "serde", @@ -1362,9 +1366,9 @@ dependencies = [ [[package]] name = "enum-map-derive" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a63b7a0ddec6f38dcec5e36257750b7a8fcaf4227e12ceb306e341d63634da05" +checksum = "a9045e2676cd5af83c3b167d917b0a5c90a4d8e266e2683d6631b235c457fc27" dependencies = [ "proc-macro2", "quote", @@ -1410,7 +1414,7 @@ name = "epaint" version = "0.18.1" dependencies = [ "ab_glyph", - "ahash 0.7.6", + "ahash 0.8.0", "atomic_refcell", "backtrace", "bytemuck", @@ -1420,7 +1424,7 @@ dependencies = [ "document-features", "emath", "nohash-hasher", - "parking_lot 0.12.1", + "parking_lot", "serde", ] @@ -1436,9 +1440,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "expat-sys" @@ -1462,9 +1466,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] @@ -1516,7 +1520,7 @@ checksum = "122fa73a5566372f9df09768a16e8e3dad7ad18abe07835f1f0b71f84078ba4c" dependencies = [ "fontconfig-parser", "log", - "memmap2 0.5.4", + "memmap2", "ttf-parser", ] @@ -1596,15 +1600,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115" [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5" [[package]] name = "futures-lite" @@ -1623,21 +1627,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577" dependencies = [ "futures-core", "futures-sink", @@ -1703,8 +1707,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1719,9 +1725,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "gio-sys" @@ -1809,7 +1815,7 @@ dependencies = [ "objc", "once_cell", "osmesa-sys", - "parking_lot 0.12.1", + "parking_lot", "raw-window-handle 0.5.0", "wayland-client", "wayland-egl", @@ -1888,13 +1894,13 @@ dependencies = [ [[package]] name = "gpu-descriptor" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a538f217be4d405ff4719a283ca68323cc2384003eca5baaa87501e821c81dda" +checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" dependencies = [ "bitflags", "gpu-descriptor-types", - "hashbrown 0.11.2", + "hashbrown 0.12.3", ] [[package]] @@ -1945,19 +1951,13 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash 0.7.6", ] -[[package]] -name = "hashbrown" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" - [[package]] name = "heck" version = "0.4.0" @@ -1998,6 +1998,19 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "iana-time-zone" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad2bfd338099682614d3ee3fe0cd72e0b6a41ca6a87f6a74a3bd593c91650501" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "js-sys", + "wasm-bindgen", + "winapi", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -2017,15 +2030,14 @@ dependencies = [ [[package]] name = "image" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212" +checksum = "7e30ca2ecf7666107ff827a8e481de6a132a9b687ed3bb20bb1c144a36c00964" dependencies = [ "bytemuck", "byteorder", "color_quant", "jpeg-decoder", - "num-iter", "num-rational", "num-traits", "png", @@ -2038,14 +2050,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.12.1", + "hashbrown 0.12.3", ] [[package]] name = "inplace_it" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90953f308a79fe6d62a4643e51f848fbfddcd05975a38e69fdf4ab86a7baf7ca" +checksum = "67f0347836f3f6362c1e7efdadde2b1c4b4556d211310b70631bae7eb692070b" [[package]] name = "instant" @@ -2076,9 +2088,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] name = "jni" @@ -2117,9 +2129,9 @@ checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b" [[package]] name = "js-sys" -version = "0.3.58" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" dependencies = [ "wasm-bindgen", ] @@ -2164,9 +2176,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.126" +version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "libloading" @@ -2180,9 +2192,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" +checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" [[package]] name = "line-wrap" @@ -2241,18 +2253,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.3.1" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357" -dependencies = [ - "libc", -] - -[[package]] -name = "memmap2" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5172b50c23043ff43dd53e51392f36519d9b35a8f3a410d30ece5d1aedd58ae" +checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" dependencies = [ "libc", ] @@ -2394,7 +2397,7 @@ dependencies = [ "ndk-macro", "ndk-sys 0.4.0", "once_cell", - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -2492,17 +2495,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-iter" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -2605,18 +2597,18 @@ dependencies = [ [[package]] name = "object" -version = "0.28.4" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" [[package]] name = "oorandom" @@ -2646,9 +2638,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.1.0" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" +checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" [[package]] name = "osmesa-sys" @@ -2661,9 +2653,9 @@ dependencies = [ [[package]] name = "owned_ttf_parser" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1e509cfe7a12db2a90bfa057dfcdbc55a347f5da677c506b53dd099cfec9d" +checksum = "07ef1a404ae479dd6906f4fa2c88b3c94028f1284beb42a47c183a7c27ee9a3e" dependencies = [ "ttf-parser", ] @@ -2686,17 +2678,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.5", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -2704,21 +2685,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.3", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -2780,15 +2747,15 @@ dependencies = [ "indexmap", "line-wrap", "serde", - "time 0.3.11", + "time 0.3.13", "xml-rs", ] [[package]] name = "plotters" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" +checksum = "716b4eeb6c4a1d3ecc956f75b43ec2e8e8ba80026413e70a3f41fd3313d3492b" dependencies = [ "num-traits", "plotters-backend", @@ -2799,15 +2766,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c" +checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" [[package]] name = "plotters-svg" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9" +checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f" dependencies = [ "plotters-backend", ] @@ -2860,19 +2827,20 @@ checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "proc-macro-crate" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" dependencies = [ + "once_cell", "thiserror", "toml", ] [[package]] name = "proc-macro2" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" dependencies = [ "unicode-ident", ] @@ -2893,7 +2861,7 @@ dependencies = [ "bincode", "byteorder", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "ruzstd", "serde", "zstd", @@ -2922,9 +2890,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -3015,9 +2983,9 @@ checksum = "9ae028b272a6e99d9f8260ceefa3caa09300a8d6c8d2b2001316474bc52122e9" [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] @@ -3035,9 +3003,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.6" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -3052,9 +3020,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" -version = "0.6.26" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remove_dir_all" @@ -3085,7 +3053,7 @@ dependencies = [ "rgb", "svgfilters", "svgtypes", - "tiny-skia", + "tiny-skia 0.6.6", "usvg", ] @@ -3100,9 +3068,9 @@ dependencies = [ [[package]] name = "rfd" -version = "0.8.0" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea377e07fe8a55cd3c0752683d32d346e8a3d0a4dda7431c567509dbe3e514b" +checksum = "1f756b55bff8f256a1a8c24dbabb1430ac8110628e418a02e4a1c5ff67179f56" dependencies = [ "block", "dispatch", @@ -3119,7 +3087,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "windows 0.32.0", + "windows 0.37.0", ] [[package]] @@ -3148,9 +3116,9 @@ dependencies = [ [[package]] name = "ron" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" +checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff" dependencies = [ "base64", "bitflags", @@ -3188,15 +3156,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - [[package]] name = "rustls" version = "0.20.6" @@ -3237,9 +3196,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "safe_arch" @@ -3298,27 +3257,21 @@ dependencies = [ [[package]] name = "sctk-adwaita" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cdeb3fbbd384de045d5683bfc3cadfc4c6ed1e6471f201ede801f31571581a" +checksum = "04b7c47a572f73de28bee5b5060d085b42b6ce1e4ee2b49c956ea7b25e94b6f0" dependencies = [ "crossfont", "log", - "smithay-client-toolkit 0.16.0", - "tiny-skia", + "smithay-client-toolkit", + "tiny-skia 0.7.0", ] -[[package]] -name = "semver" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" - [[package]] name = "serde" -version = "1.0.138" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47" +checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553" dependencies = [ "serde_derive", ] @@ -3335,9 +3288,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.138" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c" +checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" dependencies = [ "proc-macro2", "quote", @@ -3346,20 +3299,20 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" dependencies = [ - "itoa 1.0.2", + "itoa 1.0.3", "ryu", "serde", ] [[package]] name = "serde_repr" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ad84e47328a31223de7fed7a4f5087f2d6ddfe586cf3ca25b7a165bc0a5aed" +checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" dependencies = [ "proc-macro2", "quote", @@ -3451,9 +3404,12 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "slab" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] [[package]] name = "slotmap" @@ -3470,24 +3426,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" -[[package]] -name = "smithay-client-toolkit" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" -dependencies = [ - "bitflags", - "dlib", - "lazy_static", - "log", - "memmap2 0.3.1", - "nix 0.22.3", - "pkg-config", - "wayland-client", - "wayland-cursor", - "wayland-protocols", -] - [[package]] name = "smithay-client-toolkit" version = "0.16.0" @@ -3499,7 +3437,7 @@ dependencies = [ "dlib", "lazy_static", "log", - "memmap2 0.5.4", + "memmap2", "nix 0.24.2", "pkg-config", "wayland-client", @@ -3509,11 +3447,11 @@ dependencies = [ [[package]] name = "smithay-clipboard" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "610b551bd25378bfd2b8e7a0fcbd83d427e8f2f6a40c47ae0f70688e9949dd55" +checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" dependencies = [ - "smithay-client-toolkit 0.15.4", + "smithay-client-toolkit", "wayland-client", ] @@ -3609,9 +3547,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ "proc-macro2", "quote", @@ -3712,18 +3650,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" dependencies = [ "proc-macro2", "quote", @@ -3779,11 +3717,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217" +checksum = "db76ff9fa4b1458b3c7f077f3ff9887394058460d21e634355b273aaf11eea45" dependencies = [ - "itoa 1.0.2", + "itoa 1.0.3", "libc", "num_threads", ] @@ -3802,6 +3740,31 @@ dependencies = [ "safe_arch", ] +[[package]] +name = "tiny-skia" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "642680569bb895b16e4b9d181c60be1ed136fa0c9c7f11d004daf053ba89bf82" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "bytemuck", + "cfg-if", + "png", + "safe_arch", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c114d32f0c2ee43d585367cb013dfaba967ab9f62b90d9af0d696e955e70fa6c" +dependencies = [ + "arrayref", + "bytemuck", +] + [[package]] name = "tinytemplate" version = "1.2.1" @@ -3838,9 +3801,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" +checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" dependencies = [ "cfg-if", "pin-project-lite", @@ -3861,9 +3824,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.28" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" +checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" dependencies = [ "once_cell", "valuable", @@ -3882,9 +3845,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a713421342a5a666b7577783721d3117f1b69a393df803ee17bb73b1e122a59" +checksum = "60db860322da191b40952ad9affe65ea23e7dd6a5c442c2c42865810c6ab8e6b" dependencies = [ "ansi_term", "sharded-slab", @@ -3987,9 +3950,9 @@ checksum = "07547e3ee45e28326cc23faac56d44f58f16ab23e413db526debce3b0bfd2742" [[package]] name = "unicode-ident" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] name = "unicode-normalization" @@ -4026,9 +3989,9 @@ checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "unicode_names2" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eec8e807a365e5c972debc47b8f06d361b37b94cfd18d48f7adc715fb86404dd" +checksum = "029df4cc8238cefc911704ff8fa210853a0f3bce2694d8f51181dd41ee0f3301" [[package]] name = "untrusted" @@ -4038,9 +4001,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9399fa2f927a3d327187cbd201480cee55bee6ac5d3c77dd27f0c6814cff16d5" +checksum = "b97acb4c28a254fd7a4aeec976c46a7fa404eac4d7c134b30c75144846d7cb8f" dependencies = [ "base64", "chunked_transfer", @@ -4172,9 +4135,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.31" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" +checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" dependencies = [ "cfg-if", "js-sys", @@ -4296,9 +4259,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.58" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -4330,18 +4293,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.3" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" +checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf" dependencies = [ "webpki", ] [[package]] name = "weezl" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c97e489d8f836838d497091de568cf16b117486d529ec5579233521065bd5e4" +checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "wepoll-ffi" @@ -4362,7 +4325,7 @@ dependencies = [ "js-sys", "log", "naga", - "parking_lot 0.12.1", + "parking_lot", "raw-window-handle 0.4.3", "smallvec", "wasm-bindgen", @@ -4375,9 +4338,9 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266ca6be6004fd1b2a768023b1cb0afbf7af0cbffaba19af25c5792d44e74784" +checksum = "89b92788dec9d0c1bed849a1b83f01b2ee12819bf04a79c90f68e4173f7b5ba2" dependencies = [ "arrayvec 0.7.2", "bit-vec", @@ -4388,7 +4351,7 @@ dependencies = [ "fxhash", "log", "naga", - "parking_lot 0.12.1", + "parking_lot", "profiling", "raw-window-handle 0.4.3", "smallvec", @@ -4400,9 +4363,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef50e48812c7eb958fa52d28a912f8b77c96453ebab21c72b01cdda61d3e65d" +checksum = "20cbdfc3d0637dba3d5536b93adef3d26023a0b96f0e1ee5ee9560a401d9f646" dependencies = [ "android_system_properties", "arrayvec 0.7.2", @@ -4425,7 +4388,7 @@ dependencies = [ "metal", "naga", "objc", - "parking_lot 0.12.1", + "parking_lot", "profiling", "range-alloc", "raw-window-handle 0.4.3", @@ -4439,9 +4402,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.13.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f48d691b733b9d50ea8cb18f377fd1ed927c90c55ad1ec5b90f68885471977f7" +checksum = "1f762cbc08e1a51389859cf9c199c7aef544789cf3510889aab12c607f701604" dependencies = [ "bitflags", ] @@ -4503,19 +4466,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbedf6db9096bc2364adce0ae0aa636dcd89f3c3f2cd67947062aaf0ca2a10ec" -dependencies = [ - "windows_aarch64_msvc 0.32.0", - "windows_i686_gnu 0.32.0", - "windows_i686_msvc 0.32.0", - "windows_x86_64_gnu 0.32.0", - "windows_x86_64_msvc 0.32.0", -] - [[package]] name = "windows" version = "0.33.0" @@ -4529,6 +4479,19 @@ dependencies = [ "windows_x86_64_msvc 0.33.0", ] +[[package]] +name = "windows" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" +dependencies = [ + "windows_aarch64_msvc 0.37.0", + "windows_i686_gnu 0.37.0", + "windows_i686_msvc 0.37.0", + "windows_x86_64_gnu 0.37.0", + "windows_x86_64_msvc 0.37.0", +] + [[package]] name = "windows-sys" version = "0.36.1" @@ -4542,12 +4505,6 @@ dependencies = [ "windows_x86_64_msvc 0.36.1", ] -[[package]] -name = "windows_aarch64_msvc" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" - [[package]] name = "windows_aarch64_msvc" version = "0.33.0" @@ -4561,10 +4518,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] -name = "windows_i686_gnu" -version = "0.32.0" +name = "windows_aarch64_msvc" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" +checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" [[package]] name = "windows_i686_gnu" @@ -4579,10 +4536,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] -name = "windows_i686_msvc" -version = "0.32.0" +name = "windows_i686_gnu" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" +checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" [[package]] name = "windows_i686_msvc" @@ -4597,10 +4554,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] -name = "windows_x86_64_gnu" -version = "0.32.0" +name = "windows_i686_msvc" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" +checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" [[package]] name = "windows_x86_64_gnu" @@ -4615,10 +4572,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] -name = "windows_x86_64_msvc" -version = "0.32.0" +name = "windows_x86_64_gnu" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" +checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" [[package]] name = "windows_x86_64_msvc" @@ -4632,6 +4589,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" + [[package]] name = "winit" version = "0.27.2" @@ -4651,12 +4614,12 @@ dependencies = [ "ndk-glue 0.7.0", "objc", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "percent-encoding", "raw-window-handle 0.4.3", "raw-window-handle 0.5.0", "sctk-adwaita", - "smithay-client-toolkit 0.16.0", + "smithay-client-toolkit", "wasm-bindgen", "wayland-client", "wayland-protocols", @@ -4685,9 +4648,9 @@ dependencies = [ [[package]] name = "x11-dl" -version = "2.19.1" +version = "2.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea26926b4ce81a6f5d9d0f3a0bc401e5a37c6ae14a1bfaa8ff6099ca80038c59" +checksum = "0c83627bc137605acc00bb399c7b908ef460b621fc37c953db2b09f88c449ea6" dependencies = [ "lazy_static", "libc", @@ -4797,9 +4760,9 @@ dependencies = [ [[package]] name = "zbus_names" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45dfcdcf87b71dad505d30cc27b1b7b88a64b6d1c435648f48f9dbc1fdc4b7e1" +checksum = "41a408fd8a352695690f53906dc7fd036be924ec51ea5e05666ff42685ed0af5" dependencies = [ "serde", "static_assertions", @@ -4858,9 +4821,9 @@ dependencies = [ [[package]] name = "zvariant" -version = "3.4.1" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2c71467724d4a77f0a1f0339dab10ca5d63f6a82411289cdcdfbfd47d2e407" +checksum = "1bd68e4e6432ef19df47d7e90e2e72b5e7e3d778e0ae3baddf12b951265cc758" dependencies = [ "byteorder", "enumflags2", @@ -4872,9 +4835,9 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "3.4.1" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c47f3630ce926a03abf21f5a8db90c60c81ed71599b5c86ad1a54fd3c7564c5" +checksum = "08e977eaa3af652f63d479ce50d924254ad76722a6289ec1a1eac3231ca30430" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/deny.toml b/deny.toml index 7d40eadd9..2157da876 100644 --- a/deny.toml +++ b/deny.toml @@ -49,16 +49,17 @@ confidence-threshold = 0.92 # We want really high confidence when inferring lice copyleft = "deny" allow = [ # "Apache-2.0 WITH LLVM-exception", # https://spdx.org/licenses/LLVM-exception.html - "Apache-2.0", # https://tldrlegal.com/license/apache-license-2.0-(apache-2.0) - "BSD-2-Clause", # https://tldrlegal.com/license/bsd-2-clause-license-(freebsd) - "BSD-3-Clause", # https://tldrlegal.com/license/bsd-3-clause-license-(revised) - "BSL-1.0", # https://tldrlegal.com/license/boost-software-license-1.0-explained - "CC0-1.0", # https://creativecommons.org/publicdomain/zero/1.0/ - "ISC", # https://tldrlegal.com/license/-isc-license - "MIT", # https://tldrlegal.com/license/mit-license - "MPL-2.0", # https://www.mozilla.org/en-US/MPL/2.0/FAQ/ - see Q11 - "OpenSSL", # https://www.openssl.org/source/license.html - "Zlib", # https://tldrlegal.com/license/zlib-libpng-license-(zlib) + "Apache-2.0", # https://tldrlegal.com/license/apache-license-2.0-(apache-2.0) + "BSD-2-Clause", # https://tldrlegal.com/license/bsd-2-clause-license-(freebsd) + "BSD-3-Clause", # https://tldrlegal.com/license/bsd-3-clause-license-(revised) + "BSL-1.0", # https://tldrlegal.com/license/boost-software-license-1.0-explained + "CC0-1.0", # https://creativecommons.org/publicdomain/zero/1.0/ + "ISC", # https://tldrlegal.com/license/-isc-license + "MIT", # https://tldrlegal.com/license/mit-license + "MPL-2.0", # https://www.mozilla.org/en-US/MPL/2.0/FAQ/ - see Q11 + "OpenSSL", # https://www.openssl.org/source/license.html + "Unicode-DFS-2016", # https://spdx.org/licenses/Unicode-DFS-2016.html + "Zlib", # https://tldrlegal.com/license/zlib-libpng-license-(zlib) ] [[licenses.clarify]] diff --git a/eframe/Cargo.toml b/eframe/Cargo.toml index 4540f9a3d..bbe1cc819 100644 --- a/eframe/Cargo.toml +++ b/eframe/Cargo.toml @@ -74,7 +74,7 @@ document-features = { version = "0.2", optional = true } egui_glow = { version = "0.18.0", path = "../egui_glow", optional = true, default-features = false } egui-wgpu = { version = "0.18.0", path = "../egui-wgpu", optional = true, features = ["winit"] } glow = { version = "0.11", optional = true } -ron = { version = "0.7", optional = true } +ron = { version = "0.8", optional = true } serde = { version = "1", optional = true, features = ["derive"] } wgpu = { version = "0.13", optional = true } @@ -94,6 +94,7 @@ directories-next = { version = "2", optional = true } # web: [target.'cfg(target_arch = "wasm32")'.dependencies] bytemuck = "1.7" +getrandom = { version = "0.2", features = ["js"] } # used by ahash js-sys = "0.3" percent-encoding = "2.1" wasm-bindgen = "0.2" diff --git a/egui/Cargo.toml b/egui/Cargo.toml index 10b1b73a4..0c6d6868a 100644 --- a/egui/Cargo.toml +++ b/egui/Cargo.toml @@ -57,14 +57,14 @@ serde = ["dep:serde", "epaint/serde"] [dependencies] epaint = { version = "0.18.1", path = "../epaint", default-features = false } -ahash = "0.7" +ahash = "0.8" nohash-hasher = "0.2" #! ### Optional dependencies ## Enable this when generating docs. document-features = { version = "0.2", optional = true } -ron = { version = "0.7", optional = true } +ron = { version = "0.8", optional = true } serde = { version = "1", optional = true, features = ["derive", "rc"] } # egui doesn't log much, but when it does, it uses [`tracing`](https://docs.rs/tracing). diff --git a/egui/src/id.rs b/egui/src/id.rs index b83d911c8..74290ad4a 100644 --- a/egui/src/id.rs +++ b/egui/src/id.rs @@ -46,7 +46,7 @@ impl Id { /// Generate a new [`Id`] by hashing some source (e.g. a string or integer). pub fn new(source: impl std::hash::Hash) -> Id { use std::hash::Hasher; - let mut hasher = epaint::ahash::AHasher::new_with_keys(123, 456); + let mut hasher = epaint::ahash::AHasher::default(); source.hash(&mut hasher); Id(hasher.finish()) } @@ -54,7 +54,7 @@ impl Id { /// Generate a new [`Id`] by hashing the parent [`Id`] and the given argument. pub fn with(self, child: impl std::hash::Hash) -> Id { use std::hash::Hasher; - let mut hasher = epaint::ahash::AHasher::new_with_keys(123, 456); + let mut hasher = epaint::ahash::AHasher::default(); hasher.write_u64(self.0); child.hash(&mut hasher); Id(hasher.finish()) diff --git a/egui/src/memory.rs b/egui/src/memory.rs index 8aca74fd2..a588bf87e 100644 --- a/egui/src/memory.rs +++ b/egui/src/memory.rs @@ -1,5 +1,3 @@ -use epaint::ahash::AHashSet; - use crate::{area, window, Id, IdMap, InputState, LayerId, Pos2, Rect, Style}; // ---------------------------------------------------------------------------- @@ -490,15 +488,15 @@ pub struct Areas { areas: IdMap, /// Back-to-front. Top is last. order: Vec, - visible_last_frame: AHashSet, - visible_current_frame: AHashSet, + visible_last_frame: ahash::HashSet, + visible_current_frame: ahash::HashSet, /// When an area want to be on top, it is put in here. /// At the end of the frame, this is used to reorder the layers. /// This means if several layers want to be on top, they will keep their relative order. /// So if you close three windows and then reopen them all in one frame, /// they will all be sent to the top, but keep their previous internal order. - wants_to_be_on_top: AHashSet, + wants_to_be_on_top: ahash::HashSet, } impl Areas { @@ -550,7 +548,7 @@ impl Areas { self.visible_last_frame.contains(layer_id) || self.visible_current_frame.contains(layer_id) } - pub fn visible_layer_ids(&self) -> AHashSet { + pub fn visible_layer_ids(&self) -> ahash::HashSet { self.visible_last_frame .iter() .cloned() diff --git a/egui/src/util/cache.rs b/egui/src/util/cache.rs index 9cca39bfb..b1c65565f 100644 --- a/egui/src/util/cache.rs +++ b/egui/src/util/cache.rs @@ -119,7 +119,7 @@ impl CacheTrait /// ``` #[derive(Default)] pub struct CacheStorage { - caches: ahash::AHashMap>, + caches: ahash::HashMap>, } impl CacheStorage { diff --git a/egui/src/widgets/plot/legend.rs b/egui/src/widgets/plot/legend.rs index 1679fce33..a0a8ad991 100644 --- a/egui/src/widgets/plot/legend.rs +++ b/egui/src/widgets/plot/legend.rs @@ -1,7 +1,5 @@ use std::{collections::BTreeMap, string::String}; -use epaint::ahash::AHashSet; - use crate::*; use super::items::PlotItem; @@ -168,7 +166,7 @@ impl LegendWidget { rect: Rect, config: Legend, items: &[Box], - hidden_items: &AHashSet, + hidden_items: &ahash::HashSet, ) -> Option { // Collect the legend entries. If multiple items have the same name, they share a // checkbox. If their colors don't match, we pick a neutral color for the checkbox. @@ -199,7 +197,7 @@ impl LegendWidget { } // Get the names of the hidden items. - pub fn hidden_items(&self) -> AHashSet { + pub fn hidden_items(&self) -> ahash::HashSet { self.entries .iter() .filter(|(_, entry)| !entry.checked) diff --git a/egui/src/widgets/plot/mod.rs b/egui/src/widgets/plot/mod.rs index 6603451de..d9c08afbb 100644 --- a/egui/src/widgets/plot/mod.rs +++ b/egui/src/widgets/plot/mod.rs @@ -3,7 +3,6 @@ use std::{cell::Cell, ops::RangeInclusive, rc::Rc}; use crate::*; -use epaint::ahash::AHashSet; use epaint::color::Hsva; use epaint::util::FloatOrd; @@ -96,7 +95,7 @@ impl From for AutoBounds { struct PlotMemory { auto_bounds: AutoBounds, hovered_entry: Option, - hidden_items: AHashSet, + hidden_items: ahash::HashSet, min_auto_bounds: PlotBounds, last_screen_transform: ScreenTransform, /// Allows to remember the first click position when performing a boxed zoom diff --git a/egui_extras/Cargo.toml b/egui_extras/Cargo.toml index 24258d2f1..483c020bb 100644 --- a/egui_extras/Cargo.toml +++ b/egui_extras/Cargo.toml @@ -60,7 +60,7 @@ image = { version = "0.24", optional = true, default-features = false } # svg feature resvg = { version = "0.23", optional = true } -tiny-skia = { version = "0.6", optional = true } +tiny-skia = { version = "0.6", optional = true } # must be updated in lock-step with resvg usvg = { version = "0.23", optional = true } # feature "serde": diff --git a/egui_glium/Cargo.toml b/egui_glium/Cargo.toml index 31b9c6807..faeaef75c 100644 --- a/egui_glium/Cargo.toml +++ b/egui_glium/Cargo.toml @@ -44,7 +44,7 @@ egui = { version = "0.18.0", path = "../egui", default-features = false, feature ] } egui-winit = { version = "0.18.0", path = "../egui-winit", default-features = false } -ahash = "0.7" +ahash = "0.8" bytemuck = "1.7" glium = "0.32" diff --git a/egui_glium/src/painter.rs b/egui_glium/src/painter.rs index d0bd81325..6615457f2 100644 --- a/egui_glium/src/painter.rs +++ b/egui_glium/src/painter.rs @@ -4,7 +4,6 @@ use egui::epaint::Primitive; use { - ahash::AHashMap, egui::{emath::Rect, epaint::Mesh}, glium::{ implement_vertex, @@ -21,7 +20,7 @@ pub struct Painter { max_texture_side: usize, program: glium::Program, - textures: AHashMap>, + textures: ahash::HashMap>, /// [`egui::TextureId::User`] index next_native_tex_id: u64, diff --git a/epaint/Cargo.toml b/epaint/Cargo.toml index 9a33734e5..05fa98f56 100644 --- a/epaint/Cargo.toml +++ b/epaint/Cargo.toml @@ -56,7 +56,7 @@ serde = ["dep:serde", "ahash/serde", "emath/serde"] emath = { version = "0.18.0", path = "../emath" } ab_glyph = "0.2.11" -ahash = { version = "0.7", default-features = false, features = ["std"] } +ahash = { version = "0.8", default-features = false, features = ["std"] } nohash-hasher = "0.2" #! ### Optional dependencies diff --git a/epaint/src/text/font.rs b/epaint/src/text/font.rs index 4cd02a38d..698956b02 100644 --- a/epaint/src/text/font.rs +++ b/epaint/src/text/font.rs @@ -2,7 +2,6 @@ use crate::{ mutex::{Mutex, RwLock}, TextureAtlas, }; -use ahash::AHashMap; use emath::{vec2, Vec2}; use std::collections::BTreeSet; use std::sync::Arc; @@ -66,7 +65,7 @@ pub struct FontImpl { // move each character by this much (hack) y_offset: f32, pixels_per_point: f32, - glyph_info_cache: RwLock>, // TODO(emilk): standard Mutex + glyph_info_cache: RwLock>, // TODO(emilk): standard Mutex atlas: Arc>, } @@ -221,7 +220,7 @@ pub struct Font { replacement_glyph: (FontIndex, GlyphInfo), pixels_per_point: f32, row_height: f32, - glyph_info_cache: AHashMap, + glyph_info_cache: ahash::HashMap, } impl Font { diff --git a/epaint/src/text/fonts.rs b/epaint/src/text/fonts.rs index 3b85a02cb..a95df05bd 100644 --- a/epaint/src/text/fonts.rs +++ b/epaint/src/text/fonts.rs @@ -535,7 +535,7 @@ pub struct FontsImpl { definitions: FontDefinitions, atlas: Arc>, font_impl_cache: FontImplCache, - sized_family: ahash::AHashMap<(u32, FontFamily), Font>, + sized_family: ahash::HashMap<(u32, FontFamily), Font>, } impl FontsImpl { @@ -673,7 +673,7 @@ struct FontImplCache { ab_glyph_fonts: BTreeMap, /// Map font pixel sizes and names to the cached [`FontImpl`]. - cache: ahash::AHashMap<(u32, String), Arc>, + cache: ahash::HashMap<(u32, String), Arc>, } impl FontImplCache { diff --git a/epaint/src/textures.rs b/epaint/src/textures.rs index 967ae3f2b..1ace2be06 100644 --- a/epaint/src/textures.rs +++ b/epaint/src/textures.rs @@ -1,5 +1,4 @@ use crate::{ImageData, ImageDelta, TextureId}; -use ahash::AHashMap; // ---------------------------------------------------------------------------- @@ -11,7 +10,7 @@ pub struct TextureManager { /// We allocate texture id:s linearly. next_id: u64, /// Information about currently allocated textures. - metas: AHashMap, + metas: ahash::HashMap, delta: TexturesDelta, } diff --git a/epaint/src/util/mod.rs b/epaint/src/util/mod.rs index 726dcfe3b..2b7e0c736 100644 --- a/epaint/src/util/mod.rs +++ b/epaint/src/util/mod.rs @@ -6,7 +6,7 @@ pub use ordered_float::*; #[inline] pub fn hash(value: impl std::hash::Hash) -> u64 { use std::hash::Hasher as _; - let mut hasher = ahash::AHasher::new_with_keys(123, 456); + let mut hasher = ahash::AHasher::default(); value.hash(&mut hasher); hasher.finish() } From 277f199df4b819899f19911e0a18992e5cad6545 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 19 Aug 2022 12:04:08 +0200 Subject: [PATCH 14/16] eframe: make sure we can serialize i128/u128 with ron Some eframe users may be relying on this. --- eframe/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eframe/Cargo.toml b/eframe/Cargo.toml index bbe1cc819..440248d13 100644 --- a/eframe/Cargo.toml +++ b/eframe/Cargo.toml @@ -74,7 +74,7 @@ document-features = { version = "0.2", optional = true } egui_glow = { version = "0.18.0", path = "../egui_glow", optional = true, default-features = false } egui-wgpu = { version = "0.18.0", path = "../egui-wgpu", optional = true, features = ["winit"] } glow = { version = "0.11", optional = true } -ron = { version = "0.8", optional = true } +ron = { version = "0.8", optional = true, features = ["integer128"] } serde = { version = "1", optional = true, features = ["derive"] } wgpu = { version = "0.13", optional = true } From 193a434717791af7a2904c92f83d83422390fae0 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 19 Aug 2022 12:04:43 +0200 Subject: [PATCH 15/16] eframe persistence: persistence failure is now logged instead of a panic --- eframe/src/epi.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eframe/src/epi.rs b/eframe/src/epi.rs index 950a94cb7..7a66b0373 100644 --- a/eframe/src/epi.rs +++ b/eframe/src/epi.rs @@ -780,7 +780,10 @@ pub fn get_value(storage: &dyn Storage, key: &st /// Serialize the given value as [RON](https://github.com/ron-rs/ron) and store with the given key. #[cfg(feature = "ron")] pub fn set_value(storage: &mut dyn Storage, key: &str, value: &T) { - storage.set_string(key, ron::ser::to_string(value).unwrap()); + match ron::ser::to_string(value) { + Ok(string) => storage.set_string(key, string), + Err(err) => tracing::error!("eframe failed to encode data using ron: {}", err), + } } /// [`Storage`] key used for app From 5c63648c023af363c319f31b6a2b1d10f51e2f42 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 20 Aug 2022 09:32:48 +0200 Subject: [PATCH 16/16] clean up rust.yml (#1939) --- .github/workflows/rust.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5be2cc79b..19597deec 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -58,8 +58,8 @@ jobs: with: profile: minimal toolchain: 1.61.0 + target: wasm32-unknown-unknown override: true - - run: rustup target add wasm32-unknown-unknown - uses: actions-rs/cargo@v1 with: command: check @@ -87,8 +87,8 @@ jobs: with: profile: minimal toolchain: 1.61.0 + target: wasm32-unknown-unknown override: true - - run: rustup target add wasm32-unknown-unknown - name: check run: cargo check -p eframe --lib --no-default-features --features glow,persistence --target wasm32-unknown-unknown @@ -101,8 +101,8 @@ jobs: with: profile: minimal toolchain: 1.61.0 + target: wasm32-unknown-unknown override: true - - run: rustup target add wasm32-unknown-unknown - uses: actions-rs/cargo@v1 with: command: check @@ -136,7 +136,7 @@ jobs: profile: minimal toolchain: 1.61.0 override: true - - run: rustup component add rustfmt + components: rustfmt - uses: actions-rs/cargo@v1 with: command: fmt @@ -191,8 +191,8 @@ jobs: with: profile: minimal toolchain: 1.61.0 + target: wasm32-unknown-unknown override: true - - run: rustup target add wasm32-unknown-unknown - run: ./sh/setup_web.sh - run: ./sh/wasm_bindgen_check.sh