From 0daafa0c0fc1e64784068fa6f665b926ccda88eb Mon Sep 17 00:00:00 2001 From: Konkitoman Date: Fri, 21 Jul 2023 22:58:17 +0300 Subject: [PATCH] Fixed the problem that cause a break in time space --- crates/eframe/src/native/epi_integration.rs | 7 ++++++- crates/egui/src/context.rs | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/eframe/src/native/epi_integration.rs b/crates/eframe/src/native/epi_integration.rs index f30e0f385..6d9fb6a10 100644 --- a/crates/eframe/src/native/epi_integration.rs +++ b/crates/eframe/src/native/epi_integration.rs @@ -1,3 +1,5 @@ +use std::time::Instant; + use winit::event_loop::EventLoopWindowTarget; #[cfg(target_os = "macos")] @@ -325,6 +327,7 @@ pub fn create_storage(_app_name: &str) -> Option> { pub struct EpiIntegration { pub frame: epi::Frame, last_auto_save: std::time::Instant, + pub beagining: Instant, pub egui_ctx: egui::Context, pending_full_output: egui::FullOutput, /// When set, it is time to close the native window. @@ -396,6 +399,7 @@ impl EpiIntegration { window_state, follow_system_theme: native_options.follow_system_theme, app_icon_setter, + beagining: Instant::now(), } } @@ -499,7 +503,8 @@ impl EpiIntegration { self.frame.info.window_info = read_window_info(window, self.egui_ctx.pixels_per_point(), &self.window_state); - let raw_input = egui_winit.take_egui_input(window); + let mut raw_input = egui_winit.take_egui_input(window); + raw_input.time = Some(self.beagining.elapsed().as_secs_f64()); // Run user code: let full_output = self.egui_ctx.run(raw_input, |egui_ctx| { diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index ec188e40a..6098df878 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -1279,9 +1279,7 @@ impl Context { ctx.windows.retain(|_, (builder, id, parent, used)| { let out = *used; if ctx.current_rendering_window == *parent || ctx.current_rendering_window == *id { - // WARNING NOT IMPLEMENTED BECAUSE THE WINDOW ONLY RENDER WHEN THE CURRENT WINDOW FRAME IS BIGGER THEN THE CURRENT FRAME - // I DONT KNOW WHY - *used = true; + *used = false; } else { } windows.push((*id, builder.clone()));