Change summary
crates/gpui/src/platform.rs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Detailed changes
@@ -289,10 +289,13 @@ pub trait PlatformDisplay: Send + Sync + Debug {
/// Get the default bounds for this display to place a window
fn default_bounds(&self) -> Bounds<Pixels> {
- let center = self.bounds().center();
- let offset = DEFAULT_WINDOW_SIZE / 2.0;
+ let bounds = self.bounds();
+ let center = bounds.center();
+ let clipped_window_size = DEFAULT_WINDOW_SIZE.min(&bounds.size);
+
+ let offset = clipped_window_size / 2.0;
let origin = point(center.x - offset.width, center.y - offset.height);
- Bounds::new(origin, DEFAULT_WINDOW_SIZE)
+ Bounds::new(origin, clipped_window_size)
}
}