Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Make inactive frame throttling configurable (#62628)
Pavel Olizko511ac1703637
diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rsindex 805ed375ce2..ecb1fa40d34 100644--- a/crates/gpui/src/platform.rs+++ b/crates/gpui/src/platform.rs@@ -1827,6 +1827,11 @@ pub struct WindowOptions {/// Leave this `false` for windows that rely on AppKit's native titlebar dragging.pub app_owns_titlebar_drag: bool,+ /// The minimum interval between animation frames while the window is inactive.+ ///+ /// Set to `None` to disable inactive-window animation frame throttling.+ pub inactive_frame_interval: Option<Duration>,+/// Whether the window should be resizable by the userpub is_resizable: bool,@@ -1971,6 +1976,7 @@ impl Default for WindowOptions {kind: WindowKind::Normal,is_movable: true,app_owns_titlebar_drag: false,+ inactive_frame_interval: Some(Duration::from_micros(33_333)),is_resizable: true,is_minimizable: true,display_id: None,diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rsindex a92ae8f8efc..4e2f11b75ce 100644--- a/crates/gpui/src/window.rs+++ b/crates/gpui/src/window.rs@@ -1340,6 +1340,7 @@ impl Window {kind,is_movable,app_owns_titlebar_drag,+ inactive_frame_interval,is_resizable,is_minimizable,display_id,@@ -1557,7 +1558,7 @@ impl Window {{None} else if !active.get() && !input_rate_tracker.borrow_mut().is_high_rate() {- Some(Duration::from_micros(33333))+ inactive_frame_interval} else if let Some(ThermalState::Critical | ThermalState::Serious) = thermal_state {Some(Duration::from_micros(16667))} else {