File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -46,15 +46,13 @@ impl WinitApp {
46
46
47
47
impl ApplicationHandler < CustomEvent > for WinitApp {
48
48
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 ) ;
50
51
let wait_until = timeout. min ( self . cef_schedule . unwrap_or ( timeout) ) ;
51
52
event_loop. set_control_flow ( ControlFlow :: WaitUntil ( wait_until) ) ;
52
53
}
53
54
54
55
fn new_events ( & mut self , _event_loop : & ActiveEventLoop , _cause : StartCause ) {
55
- if self . ui_frame_buffer . is_none ( ) {
56
- self . cef_context . work ( ) ;
57
- }
58
56
if let Some ( schedule) = self . cef_schedule
59
57
&& schedule < Instant :: now ( )
60
58
{
Original file line number Diff line number Diff line change @@ -34,9 +34,9 @@ fn main() {
34
34
35
35
let event_loop = EventLoop :: < CustomEvent > :: with_user_event ( ) . build ( ) . unwrap ( ) ;
36
36
37
- let ( send , recv ) = std:: sync:: mpsc:: channel ( ) ;
37
+ let ( window_size_sender , window_size_receiver ) = std:: sync:: mpsc:: channel ( ) ;
38
38
39
- let cef_context = match cef_context. init ( cef:: CefHandler :: new ( recv , event_loop. create_proxy ( ) ) ) {
39
+ let cef_context = match cef_context. init ( cef:: CefHandler :: new ( window_size_receiver , event_loop. create_proxy ( ) ) ) {
40
40
Ok ( c) => c,
41
41
Err ( cef:: InitError :: InitializationFailed ) => {
42
42
tracing:: error!( "Cef initialization failed" ) ;
@@ -46,7 +46,7 @@ fn main() {
46
46
47
47
tracing:: info!( "Cef initialized successfully" ) ;
48
48
49
- let mut winit_app = WinitApp :: new ( cef_context, send , event_loop. create_proxy ( ) ) ;
49
+ let mut winit_app = WinitApp :: new ( cef_context, window_size_sender , event_loop. create_proxy ( ) ) ;
50
50
51
51
event_loop. run_app ( & mut winit_app) . unwrap ( ) ;
52
52
}
You can’t perform that action at this time.
0 commit comments