From d3916b84c93c1bf5c2be849812ec47216e76a942 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 3 Oct 2023 13:55:53 -0600 Subject: [PATCH] Checkpoint --- crates/gpui3/src/color.rs | 9 +++++++++ crates/gpui3/src/elements/text.rs | 2 -- crates/gpui3/src/window.rs | 11 ----------- crates/storybook2/src/workspace.rs | 6 +++--- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/crates/gpui3/src/color.rs b/crates/gpui3/src/color.rs index 58bbcb5db2..1ace030482 100644 --- a/crates/gpui3/src/color.rs +++ b/crates/gpui3/src/color.rs @@ -146,6 +146,15 @@ pub fn black() -> Hsla { } } +pub fn white() -> Hsla { + Hsla { + h: 0., + s: 0., + l: 1., + a: 1., + } +} + impl Hsla { /// Returns true if the HSLA color is fully transparent, false otherwise. pub fn is_transparent(&self) -> bool { diff --git a/crates/gpui3/src/elements/text.rs b/crates/gpui3/src/elements/text.rs index db94b96b77..b5f8fc5ec5 100644 --- a/crates/gpui3/src/elements/text.rs +++ b/crates/gpui3/src/elements/text.rs @@ -39,8 +39,6 @@ impl Element for Text { _view: &mut S, cx: &mut ViewContext, ) -> Result<(LayoutId, Self::FrameState)> { - dbg!("layout text"); - let text_system = cx.text_system().clone(); let text_style = cx.text_style(); let font_size = text_style.font_size * cx.rem_size(); diff --git a/crates/gpui3/src/window.rs b/crates/gpui3/src/window.rs index 58f0687482..605f1390bf 100644 --- a/crates/gpui3/src/window.rs +++ b/crates/gpui3/src/window.rs @@ -251,15 +251,11 @@ impl<'a, 'w> WindowContext<'a, 'w> { let (root_layout_id, mut frame_state) = root_view.layout(&mut (), cx)?; let available_space = cx.window.content_size.map(Into::into); - dbg!("computing layout"); cx.window .layout_engine .compute_layout(root_layout_id, available_space)?; - dbg!("asking for layout"); let layout = cx.window.layout_engine.layout(root_layout_id)?; - dbg!("painting root view"); - root_view.paint(layout, &mut (), &mut frame_state, cx)?; cx.window.root_view = Some(root_view); let scene = cx.window.scene.take(); @@ -277,13 +273,6 @@ impl<'a, 'w> WindowContext<'a, 'w> { } } -impl MainThread> { - // todo!("implement other methods that use platform window") - fn platform_window(&self) -> &dyn PlatformWindow { - self.window.platform_window.borrow_on_main_thread().as_ref() - } -} - impl Context for WindowContext<'_, '_> { type EntityContext<'a, 'w, T: 'static + Send + Sync> = ViewContext<'a, 'w, T>; type Result = T; diff --git a/crates/storybook2/src/workspace.rs b/crates/storybook2/src/workspace.rs index c48993a9af..1ffb536713 100644 --- a/crates/storybook2/src/workspace.rs +++ b/crates/storybook2/src/workspace.rs @@ -4,7 +4,7 @@ use crate::{ themes::rose_pine_dawn, }; use gpui3::{ - black, div, img, svg, view, Context, Element, ParentElement, RootView, StyleHelpers, View, + div, img, svg, view, white, Context, Element, ParentElement, RootView, StyleHelpers, View, ViewContext, WindowContext, }; @@ -29,10 +29,10 @@ impl Workspace { let theme = rose_pine_dawn(); div() .font("Helvetica") - .text_color(black()) + .text_color(white()) .text_base() .size_full() - .fill(theme.middle.positive.default.background) + .fill(theme.middle.base.default.background) .child("Hello world") // TODO: Implement style.