@@ -12,7 +12,6 @@ use winit::event::StartCause;
1212use winit:: event:: WindowEvent ;
1313use winit:: event_loop:: ActiveEventLoop ;
1414use winit:: event_loop:: ControlFlow ;
15- use winit:: event_loop:: EventLoopProxy ;
1615use winit:: window:: Window ;
1716use winit:: window:: WindowId ;
1817
@@ -26,12 +25,11 @@ pub(crate) struct WinitApp {
2625 window_size_sender : Sender < WindowSize > ,
2726 _viewport_frame_buffer : Option < wgpu:: Texture > ,
2827 graphics_state : Option < GraphicsState > ,
29- event_loop_proxy : EventLoopProxy < CustomEvent > ,
3028 wgpu_context : WgpuContext ,
3129}
3230
3331impl WinitApp {
34- pub ( crate ) fn new ( cef_context : cef:: Context < cef:: Initialized > , window_size_sender : Sender < WindowSize > , event_loop_proxy : EventLoopProxy < CustomEvent > , wgpu_context : WgpuContext ) -> Self {
32+ pub ( crate ) fn new ( cef_context : cef:: Context < cef:: Initialized > , window_size_sender : Sender < WindowSize > , wgpu_context : WgpuContext ) -> Self {
3533 Self {
3634 cef_context,
3735 window : None ,
@@ -40,7 +38,6 @@ impl WinitApp {
4038 _ui_frame_buffer : None ,
4139 graphics_state : None ,
4240 window_size_sender,
43- event_loop_proxy,
4441 wgpu_context,
4542 }
4643 }
@@ -84,21 +81,21 @@ impl ApplicationHandler<CustomEvent> for WinitApp {
8481
8582 fn user_event ( & mut self , _: & ActiveEventLoop , event : CustomEvent ) {
8683 match event {
87- CustomEvent :: UiUpdate ( ( texture, width , height ) ) => {
84+ CustomEvent :: UiUpdate ( texture) => {
8885 if let Some ( graphics_state) = self . graphics_state . as_mut ( ) {
8986 graphics_state. bind_texture ( & texture) ;
90- graphics_state. resize ( width, height) ;
87+ graphics_state. resize ( texture . width ( ) , texture . height ( ) ) ;
9188 }
9289 if let Some ( window) = & self . window {
9390 window. request_redraw ( ) ;
9491 }
9592 }
9693 CustomEvent :: ScheduleBrowserWork ( instant) => {
97- if instant < Instant :: now ( ) {
94+ if instant <= Instant :: now ( ) {
9895 self . cef_context . work ( ) ;
99- let _ = self . event_loop_proxy . send_event ( CustomEvent :: ScheduleBrowserWork ( Instant :: now ( ) + Duration :: from_millis ( 10 ) ) ) ;
96+ } else {
97+ self . cef_schedule = Some ( instant) ;
10098 }
101- self . cef_schedule = Some ( instant) ;
10299 }
103100 }
104101 }
0 commit comments