@@ -3,7 +3,8 @@ use std::process::exit;
3
3
use std:: sync:: { Arc , Mutex , MutexGuard , PoisonError } ;
4
4
use std:: time:: Instant ;
5
5
6
- use winit:: event_loop:: { self , EventLoop , EventLoopProxy } ;
6
+ use tracing_subscriber:: EnvFilter ;
7
+ use winit:: event_loop:: { EventLoop , EventLoopProxy } ;
7
8
8
9
mod cef;
9
10
use cef:: Setup ;
@@ -20,11 +21,12 @@ pub(crate) enum CustomEvent {
20
21
ScheduleBrowserWork ( Instant ) ,
21
22
}
22
23
24
+ #[ derive( Debug ) ]
23
25
pub ( crate ) struct WindowState {
24
26
width : Option < usize > ,
25
27
height : Option < usize > ,
26
- ui_fb : Option < FrameBuffer > ,
27
- preview_fb : Option < FrameBuffer > ,
28
+ ui_frame_buffer : Option < FrameBuffer > ,
29
+ _viewport_frame_buffer : Option < FrameBuffer > ,
28
30
graphics_state : Option < GraphicsState > ,
29
31
event_loop_proxy : Option < EventLoopProxy < CustomEvent > > ,
30
32
}
@@ -34,8 +36,8 @@ impl WindowState {
34
36
Self {
35
37
width : None ,
36
38
height : None ,
37
- ui_fb : None ,
38
- preview_fb : None ,
39
+ ui_frame_buffer : None ,
40
+ _viewport_frame_buffer : None ,
39
41
graphics_state : None ,
40
42
event_loop_proxy : None ,
41
43
}
@@ -46,18 +48,6 @@ impl WindowState {
46
48
}
47
49
}
48
50
49
- impl Debug for WindowState {
50
- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
51
- f. debug_struct ( "WindowState" )
52
- . field ( "width" , & self . width . is_some ( ) )
53
- . field ( "height" , & self . height . is_some ( ) )
54
- . field ( "ui_fb" , & self . ui_fb . is_some ( ) )
55
- . field ( "preview_fb" , & self . preview_fb . is_some ( ) )
56
- . field ( "graphics_state" , & self . graphics_state . is_some ( ) )
57
- . finish ( )
58
- }
59
- }
60
-
61
51
pub ( crate ) struct WindowStateHandle {
62
52
inner : Arc < Mutex < WindowState > > ,
63
53
}
@@ -126,7 +116,7 @@ impl cef::CefEventHandler for CefHandler {
126
116
if frame_buffer. width ( ) != s. width . unwrap_or ( 1 ) || frame_buffer. height ( ) != s. height . unwrap_or ( 1 ) {
127
117
correct_size = false ;
128
118
} else {
129
- s. ui_fb = Some ( frame_buffer) ;
119
+ s. ui_frame_buffer = Some ( frame_buffer) ;
130
120
}
131
121
} )
132
122
. unwrap ( ) ;
@@ -145,11 +135,13 @@ impl cef::CefEventHandler for CefHandler {
145
135
}
146
136
147
137
fn main ( ) {
138
+ tracing_subscriber:: fmt ( ) . with_env_filter ( EnvFilter :: from_default_env ( ) ) . init ( ) ;
139
+
148
140
let cef_context = match cef:: Context :: < Setup > :: new ( ) {
149
141
Ok ( c) => c,
150
142
Err ( cef:: SetupError :: Subprocess ) => exit ( 0 ) ,
151
143
Err ( cef:: SetupError :: SubprocessFailed ( t) ) => {
152
- println ! ( "Subprocess of type {t} failed" ) ;
144
+ tracing :: error !( "Subprocess of type {t} failed" ) ;
153
145
exit ( 1 ) ;
154
146
}
155
147
} ;
@@ -170,12 +162,12 @@ fn main() {
170
162
let cef_context = match cef_context. init ( CefHandler :: new ( window_state. clone ( ) ) ) {
171
163
Ok ( c) => c,
172
164
Err ( cef:: InitError :: InitializationFailed ) => {
173
- println ! ( "Cef initialization failed" ) ;
165
+ tracing :: error !( "Cef initialization failed" ) ;
174
166
exit ( 1 ) ;
175
167
}
176
168
} ;
177
169
178
- println ! ( "Cef initialized successfully" ) ;
170
+ tracing :: info !( "Cef initialized successfully" ) ;
179
171
180
172
let mut winit_app = WinitApp :: new ( window_state, cef_context) ;
181
173
0 commit comments