Skip to content

Commit 2288cbe

Browse files
committed
[add] Default value for WindowSize in WindowHandleBuilder.
1 parent 01fa89d commit 2288cbe

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

  • crates/lambda-platform/src/winit

crates/lambda-platform/src/winit/mod.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,28 @@ pub struct WindowHandle {
8181
// Should we take the loop as a field right here? Probably a ref or something? IDK
8282
pub struct WindowHandleBuilder {
8383
window_handle: Option<Window>,
84-
size: Option<WindowSize>,
84+
size: WindowSize,
8585
monitor_handle: Option<MonitorHandle>,
8686
}
8787

8888
impl WindowHandleBuilder {
8989
/// Instantiate an empty builder
9090
pub fn new() -> Self {
91-
return Self;
91+
// Initialize the window size with some default values.
92+
let logical: LogicalSize<u32> = [0, 0].into();
93+
let physical = logical.to_physical(1.0);
94+
let size = WindowSize {
95+
width: 0,
96+
height: 0,
97+
logical,
98+
physical,
99+
};
100+
101+
return Self {
102+
window_handle: None,
103+
size,
104+
monitor_handle: None,
105+
};
92106
}
93107

94108
/// Set the window size for the WindowHandle

0 commit comments

Comments
 (0)