diff --git a/gpui/src/app.rs b/gpui/src/app.rs index 8df38af0d47300d37bef7b1a6206dfbb95fd9c69..8d626d2d626af2c8ea7153826c3a4d9efcbabd45 100644 --- a/gpui/src/app.rs +++ b/gpui/src/app.rs @@ -1041,6 +1041,7 @@ impl MutableAppContext { app.update(|cx| { let scene = presenter.borrow_mut().build_scene( window.size(), + window.titlebar_height(), window.scale_factor(), cx, ); @@ -1197,7 +1198,12 @@ impl MutableAppContext { { let mut presenter = presenter.borrow_mut(); presenter.invalidate(invalidation, self.as_ref()); - let scene = presenter.build_scene(window.size(), window.scale_factor(), self); + let scene = presenter.build_scene( + window.size(), + window.titlebar_height(), + window.scale_factor(), + self, + ); window.present_scene(scene); } self.presenters_and_platform_windows diff --git a/gpui/src/presenter.rs b/gpui/src/presenter.rs index 844dc0502432dc2c96fabca95a92aac36ac202dd..05aa2acc46c906c02fd8fc8d6374d84e30b0fe6b 100644 --- a/gpui/src/presenter.rs +++ b/gpui/src/presenter.rs @@ -70,13 +70,14 @@ impl Presenter { pub fn build_scene( &mut self, window_size: Vector2F, + titlebar_height: f32, scale_factor: f32, cx: &mut MutableAppContext, ) -> Scene { let mut scene = Scene::new(scale_factor); if let Some(root_view_id) = cx.root_view_id(self.window_id) { - self.layout(window_size, cx); + self.layout(window_size, titlebar_height, cx); self.after_layout(cx); let mut paint_cx = PaintContext { scene: &mut scene, @@ -98,7 +99,7 @@ impl Presenter { scene } - fn layout(&mut self, size: Vector2F, cx: &mut MutableAppContext) { + fn layout(&mut self, size: Vector2F, titlebar_height: f32, cx: &mut MutableAppContext) { if let Some(root_view_id) = cx.root_view_id(self.window_id) { let mut layout_ctx = LayoutContext { rendered_views: &mut self.rendered_views, @@ -108,6 +109,7 @@ impl Presenter { asset_cache: &self.asset_cache, view_stack: Vec::new(), app: cx, + titlebar_height, }; layout_ctx.layout(root_view_id, SizeConstraint::strict(size)); } @@ -186,6 +188,7 @@ pub struct LayoutContext<'a> { pub asset_cache: &'a AssetCache, pub app: &'a mut MutableAppContext, view_stack: Vec, + pub titlebar_height: f32, } impl<'a> LayoutContext<'a> {