Skip to content

Commit 569515f

Browse files
TrueDoctortimon-schelling
authored andcommitted
Address review comments
1 parent 5163c6b commit 569515f

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

desktop/src/app.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ impl WinitApp {
4646

4747
impl ApplicationHandler<CustomEvent> for WinitApp {
4848
fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) {
49-
let timeout = Instant::now() + Duration::from_millis(1000);
49+
// Set a timeout in case we miss any cef schedule requests
50+
let timeout = Instant::now() + Duration::from_millis(100);
5051
let wait_until = timeout.min(self.cef_schedule.unwrap_or(timeout));
5152
event_loop.set_control_flow(ControlFlow::WaitUntil(wait_until));
5253
}
5354

5455
fn new_events(&mut self, _event_loop: &ActiveEventLoop, _cause: StartCause) {
55-
if self.ui_frame_buffer.is_none() {
56-
self.cef_context.work();
57-
}
5856
if let Some(schedule) = self.cef_schedule
5957
&& schedule < Instant::now()
6058
{

desktop/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ fn main() {
3636

3737
let event_loop = EventLoop::<CustomEvent>::with_user_event().build().unwrap();
3838

39-
let (send, recv) = std::sync::mpsc::channel();
39+
let (window_size_sender, window_size_receiver) = std::sync::mpsc::channel();
4040

41-
let cef_context = match cef_context.init(cef::CefHandler::new(recv, event_loop.create_proxy())) {
41+
let cef_context = match cef_context.init(cef::CefHandler::new(window_size_receiver, event_loop.create_proxy())) {
4242
Ok(c) => c,
4343
Err(cef::InitError::InitializationFailed) => {
4444
tracing::error!("Cef initialization failed");
@@ -48,7 +48,7 @@ fn main() {
4848

4949
tracing::info!("Cef initialized successfully");
5050

51-
let mut winit_app = WinitApp::new(cef_context, send, event_loop.create_proxy());
51+
let mut winit_app = WinitApp::new(cef_context, window_size_sender, event_loop.create_proxy());
5252

5353
event_loop.run_app(&mut winit_app).unwrap();
5454
}

0 commit comments

Comments
 (0)