Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Fix dropped frames when scrolling an unfocused window (#61600)
Agus Zubiagaa50a292fd179
diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rsindex 9dd236260e0..292126e6d88 100644--- a/crates/gpui/src/window.rs+++ b/crates/gpui/src/window.rs@@ -1589,13 +1589,16 @@ impl Window {// Throttle frame rate based on conditions:// - Thermal pressure (Serious/Critical): cap to ~60fps- // - Inactive window (not focused): cap to ~30fps to save energy+ // - Inactive window (not focused): cap to ~30fps to save energy,+ // unless input is arriving at a high rate (e.g. scrolling an+ // unfocused window, which is delivered to the window under+ // the pointer).let min_frame_interval = if !force_render&& !request_frame_options.require_presentation&& next_frame_callbacks.borrow().is_empty(){None- } else if !active.get() {+ } else if !active.get() && !input_rate_tracker.borrow_mut().is_high_rate() {Some(Duration::from_micros(33333))} else if let Some(ThermalState::Critical | ThermalState::Serious) = thermal_state {Some(Duration::from_micros(16667))@@ -1638,7 +1641,7 @@ impl Window {// to prevent display underclocking during active input.let needs_present = request_frame_options.require_presentation|| needs_present.get()- || (active.get() && input_rate_tracker.borrow_mut().is_high_rate());+ || input_rate_tracker.borrow_mut().is_high_rate();if invalidator.is_dirty() || force_render {measure("frame duration", || {