Skip to content

Commit 28c14e3

Browse files
committed
Don't immedeatly request new frame at the end of the event loop
1 parent adc6368 commit 28c14e3

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

desktop/src/app.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ impl ApplicationHandler for App {
544544
Err(RenderError::SurfaceError(e)) => tracing::error!("Render error: {:?}", e),
545545
}
546546
let _ = self.start_render_sender.try_send(());
547+
// self.cef_context.schedule_frame();
547548
}
548549
}
549550
WindowEvent::DragDropped { paths, .. } => {
@@ -612,7 +613,6 @@ impl ApplicationHandler for App {
612613
fn about_to_wait(&mut self, event_loop: &dyn ActiveEventLoop) {
613614
// Set a timeout in case we miss any cef schedule requests
614615
let timeout = Instant::now() + Duration::from_millis(10);
615-
let wait_until = timeout.min(self.cef_schedule.unwrap_or(timeout));
616616
if let Some(schedule) = self.cef_schedule
617617
&& schedule < Instant::now()
618618
{
@@ -621,11 +621,9 @@ impl ApplicationHandler for App {
621621
for _ in 0..CEF_MESSAGE_LOOP_MAX_ITERATIONS {
622622
self.cef_context.work();
623623
}
624+
} else {
625+
let wait_until = timeout.min(self.cef_schedule.unwrap_or(timeout));
626+
event_loop.set_control_flow(ControlFlow::WaitUntil(wait_until));
624627
}
625-
if let Some(window) = &self.window.as_ref() {
626-
window.request_redraw();
627-
}
628-
629-
event_loop.set_control_flow(ControlFlow::WaitUntil(wait_until));
630628
}
631629
}

0 commit comments

Comments
 (0)