@@ -24,15 +24,30 @@ impl ViziaWindow {
2424 builder : Option < Box < dyn FnOnce ( & mut Context ) + Send > > ,
2525 on_idle : Option < Box < dyn Fn ( & mut Context ) + Send > > ,
2626 ) -> ViziaWindow {
27+ let context = window. gl_context ( ) . expect ( "Window was created without OpenGL support" ) ;
28+ let renderer = load_renderer ( window) ;
29+
30+ unsafe { context. make_current ( ) } ;
31+
32+ let canvas = Canvas :: new ( renderer) . expect ( "Cannot create canvas" ) ;
33+
34+ // Assume scale for now until there is an event with a new one.
35+ let scale_factor = match scale_policy {
36+ WindowScalePolicy :: ScaleFactor ( scale) => scale,
37+ WindowScalePolicy :: SystemScaleFactor => 1.0 ,
38+ } ;
39+
40+ BackendContext :: new ( & mut cx) . add_main_window ( & win_desc, canvas, scale_factor as f32 ) ;
41+
42+ cx. remove_user_themes ( ) ;
2743 if let Some ( builder) = builder {
2844 ( builder) ( & mut cx) ;
2945 }
3046
31- let context = window . gl_context ( ) . expect ( "Window was created without OpenGL support" ) ;
32- let renderer = load_renderer ( window ) ;
47+ let mut backend_cx = BackendContext :: new ( & mut cx ) ;
48+ backend_cx . synchronize_fonts ( ) ;
3349
34- unsafe { context. make_current ( ) } ;
35- let application = ApplicationRunner :: new ( cx, win_desc, scale_policy, renderer) ;
50+ let application = ApplicationRunner :: new ( cx, scale_policy) ;
3651 unsafe { context. make_not_current ( ) } ;
3752
3853 ViziaWindow { application, on_idle }
0 commit comments