11use crate :: Size ;
22
3+ #[ cfg( feature = "opengl" ) ]
4+ use crate :: gl:: GlConfig ;
5+
36/// The dpi scaling policy of the window
4- #[ derive( Debug , Clone , Copy , PartialEq ) ]
7+ #[ derive( Default , Debug , Clone , Copy , PartialEq ) ]
58pub enum WindowScalePolicy {
69 /// Use the system's dpi scale factor
10+ #[ default]
711 SystemScaleFactor ,
812 /// Use the given dpi scale factor (e.g. `1.0` = 96 dpi)
913 ScaleFactor ( f64 ) ,
1014}
1115
1216/// The options for opening a new window
17+ #[ derive( Debug , Clone , PartialEq ) ]
1318pub struct WindowOpenOptions {
1419 pub title : String ,
1520
@@ -24,6 +29,32 @@ pub struct WindowOpenOptions {
2429
2530 /// If provided, then an OpenGL context will be created for this window. You'll be able to
2631 /// access this context through [crate::Window::gl_context].
32+ ///
33+ /// By default this is set to `Some(GlConfig::default())`.
2734 #[ cfg( feature = "opengl" ) ]
28- pub gl_config : Option < crate :: gl:: GlConfig > ,
35+ pub gl_config : Option < GlConfig > ,
36+ }
37+
38+ impl WindowOpenOptions {
39+ pub fn default_no_gl ( ) -> Self {
40+ Self {
41+ title : String :: from ( "baseview window" ) ,
42+ size : Size { width : 500.0 , height : 400.0 } ,
43+ scale : WindowScalePolicy :: default ( ) ,
44+ #[ cfg( feature = "opengl" ) ]
45+ gl_config : None ,
46+ }
47+ }
48+ }
49+
50+ impl Default for WindowOpenOptions {
51+ fn default ( ) -> Self {
52+ Self {
53+ title : String :: from ( "baseview window" ) ,
54+ size : Size { width : 500.0 , height : 400.0 } ,
55+ scale : WindowScalePolicy :: default ( ) ,
56+ #[ cfg( feature = "opengl" ) ]
57+ gl_config : Some ( GlConfig :: default ( ) ) ,
58+ }
59+ }
2960}
0 commit comments