@@ -41,6 +41,17 @@ impl WinitApp {
4141 window_size_sender,
4242 }
4343 }
44+ fn run_cef ( & mut self ) {
45+ if self . ui_frame_buffer . is_none ( ) {
46+ self . cef_context . work ( ) ;
47+ }
48+ if let Some ( schedule) = self . cef_schedule
49+ && schedule < Instant :: now ( )
50+ {
51+ self . cef_schedule = None ;
52+ self . cef_context . work ( ) ;
53+ }
54+ }
4455}
4556
4657impl ApplicationHandler < CustomEvent > for WinitApp {
@@ -51,15 +62,7 @@ impl ApplicationHandler<CustomEvent> for WinitApp {
5162 }
5263
5364 fn new_events ( & mut self , _event_loop : & ActiveEventLoop , _cause : StartCause ) {
54- if self . ui_frame_buffer . is_none ( ) {
55- self . cef_context . work ( ) ;
56- }
57- if let Some ( schedule) = self . cef_schedule
58- && schedule < Instant :: now ( )
59- {
60- self . cef_schedule = None ;
61- self . cef_context . work ( ) ;
62- }
65+ self . run_cef ( ) ;
6366 }
6467
6568 fn resumed ( & mut self , event_loop : & ActiveEventLoop ) {
@@ -81,6 +84,7 @@ impl ApplicationHandler<CustomEvent> for WinitApp {
8184 }
8285
8386 fn user_event ( & mut self , _: & ActiveEventLoop , event : CustomEvent ) {
87+ self . run_cef ( ) ;
8488 match event {
8589 CustomEvent :: UiUpdate ( frame_buffer) => {
8690 if let Some ( graphics_state) = self . graphics_state . as_mut ( ) {
@@ -99,6 +103,7 @@ impl ApplicationHandler<CustomEvent> for WinitApp {
99103 }
100104
101105 fn window_event ( & mut self , event_loop : & ActiveEventLoop , _window_id : WindowId , event : WindowEvent ) {
106+ self . run_cef ( ) ;
102107 let Some ( event) = self . cef_context . handle_window_event ( event) else { return } ;
103108
104109 match event {
0 commit comments