Reduce CPU usage while window is unfocused and not hovered over

Only render if window is focused, hovered, subscript is running,
or coroutine is active.

Closes #18
This commit is contained in:
meehl committed 2025-11-28 18:30:25 +01:00
1 parent 0066a05e13
commit ae6a24f82c
9 files changed
+116 -30

No files matched your search

+1 -3
View File
@@ -147,8 +147,6 @@ impl GraphicsContext {
pub fn render(&mut self, render_job: RenderJob) -> Result<(), wgpu::SurfaceError> {
profiling::scope!("render");
self.window.request_redraw();
if !self.is_surface_configured {
return Ok(());
}
@@ -217,7 +215,7 @@ impl GraphicsContext {
pixels_per_point,
);
self.renderer.free_textures(&textures_delta)
self.renderer.free_textures(&textures_delta);
}
{