diff --git a/crates/gpui3/src/app.rs b/crates/gpui3/src/app.rs index 00f42946f6..23e05657d4 100644 --- a/crates/gpui3/src/app.rs +++ b/crates/gpui3/src/app.rs @@ -232,6 +232,7 @@ impl AppContext { } fn update(&mut self, update: impl FnOnce(&mut Self) -> R) -> R { + dbg!("update"); self.pending_updates += 1; let result = update(self); self.pending_updates -= 1; @@ -242,6 +243,8 @@ impl AppContext { } fn flush_effects(&mut self) { + dbg!("Flush effects"); + while let Some(effect) = self.pending_effects.pop_front() { match effect { Effect::Notify(entity_id) => self.apply_notify_effect(entity_id), diff --git a/crates/gpui3/src/view.rs b/crates/gpui3/src/view.rs index 261505ce51..2acdfa570c 100644 --- a/crates/gpui3/src/view.rs +++ b/crates/gpui3/src/view.rs @@ -59,6 +59,7 @@ impl Element for View { _: &mut Self::State, cx: &mut ViewContext, ) -> Result<(LayoutId, Self::FrameState)> { + dbg!("Layout view"); self.state.update(cx, |state, cx| { let mut element = (self.render)(state, cx); let layout_id = element.layout(state, cx)?; @@ -73,6 +74,7 @@ impl Element for View { element: &mut Self::FrameState, cx: &mut ViewContext, ) -> Result<()> { + dbg!("Paint view"); self.state .update(cx, |state, cx| element.paint(state, None, cx)) } @@ -100,10 +102,10 @@ impl ViewObject for View { fn paint(&mut self, _: Layout, element: &mut dyn Any, cx: &mut WindowContext) -> Result<()> { self.state.update(cx, |state, cx| { - element - .downcast_mut::>() - .unwrap() - .paint(state, None, cx) + let boxed_element = element.downcast_mut::>().unwrap(); + let element = boxed_element.downcast_mut::>().unwrap(); + + element.paint(state, None, cx) }) } } @@ -132,6 +134,7 @@ impl Element for AnyView { element: &mut Self::FrameState, cx: &mut ViewContext, ) -> Result<()> { + dbg!("Element.paint for AnyView"); self.view.lock().paint(layout, element, cx) } } diff --git a/crates/gpui3/src/window.rs b/crates/gpui3/src/window.rs index fda69ba650..647217bef1 100644 --- a/crates/gpui3/src/window.rs +++ b/crates/gpui3/src/window.rs @@ -81,6 +81,7 @@ impl<'a, 'w> WindowContext<'a, 'w> { } pub(crate) fn draw(&mut self) -> Result<()> { + dbg!("Draw"); let unit_entity = self.unit_entity.clone(); self.update_entity(&unit_entity, |_, cx| { let mut root_view = cx.window.root_view.take().unwrap(); @@ -90,6 +91,7 @@ impl<'a, 'w> WindowContext<'a, 'w> { .layout_engine .compute_layout(root_layout_id, available_space)?; let layout = cx.window.layout_engine.layout(root_layout_id)?; + dbg!("Paint root view"); root_view.paint(layout, &mut (), &mut frame_state, cx)?; cx.window.root_view = Some(root_view); let scene = cx.window.scene.take(); diff --git a/crates/storybook2/src/storybook2.rs b/crates/storybook2/src/storybook2.rs index 8dc18a930f..b119c56a20 100644 --- a/crates/storybook2/src/storybook2.rs +++ b/crates/storybook2/src/storybook2.rs @@ -15,25 +15,31 @@ mod workspace; // } fn main() { - unsafe { backtrace_on_stack_overflow::enable() }; + // unsafe { backtrace_on_stack_overflow::enable() }; SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger"); gpui3::App::production().run(|cx| { - let window = cx.open_window( - WindowOptions { - bounds: WindowBounds::Fixed(Bounds { - size: gpui3::Size { - width: 800_f32.into(), - height: 600_f32.into(), - }, + cx.run_on_main(|cx| { + dbg!("Run on main"); + let window = cx.open_window( + WindowOptions { + bounds: WindowBounds::Fixed(Bounds { + size: gpui3::Size { + width: 800_f32.into(), + height: 600_f32.into(), + }, + ..Default::default() + }), ..Default::default() - }), - ..Default::default() - }, - |cx| workspace(cx), - ); - cx.activate(true); + }, + |cx| { + dbg!("in build_root_view"); + workspace(cx) + }, + ); + cx.activate(true); + }); }); } diff --git a/crates/storybook2/src/workspace.rs b/crates/storybook2/src/workspace.rs index 4ed5bbf879..de4509aeab 100644 --- a/crates/storybook2/src/workspace.rs +++ b/crates/storybook2/src/workspace.rs @@ -19,6 +19,7 @@ pub fn workspace(cx: &mut WindowContext) -> RootView { impl Workspace { fn new(cx: &mut ViewContext) -> Self { + dbg!("Workspace::new"); Self { left_panel: collab_panel(cx), right_panel: collab_panel(cx), @@ -28,31 +29,38 @@ impl Workspace { fn render(&mut self, cx: &mut ViewContext) -> impl Element { let theme = rose_pine_dawn(); - themed(rose_pine_dawn(), cx, |cx| { - div() - .size_full() - .flex() - .flex_col() - .font("Zed Sans Extended") - .gap_0() - .justify_start() - .items_start() - .text_color(theme.lowest.base.default.foreground) - .fill(theme.middle.base.default.background) - .child(titlebar(cx)) - .child( - div() - .flex_1() - .w_full() - .flex() - .flex_row() - .overflow_hidden() - .child(self.left_panel.clone()) - .child(div().h_full().flex_1()) - .child(self.right_panel.clone()), - ) - .child(statusbar::statusbar(cx)) - }) + dbg!("Render workspace"); + div().size_full().fill(gpui3::hsla(0.83, 1., 0.5, 1.)) + + // TODO: Debug font not font. + //.child("Is this thing on?") + + // themed(rose_pine_dawn(), cx, |cx| { + // div() + // .size_full() + // .flex() + // .flex_col() + // .font("Zed Sans Extended") + // .gap_0() + // .justify_start() + // .items_start() + // .text_color(theme.lowest.base.default.foreground) + // // .fill(theme.middle.base.default.background) + // .fill(gpui3::hsla(0.83, 1., 0.5, 1.)) + // .child(titlebar(cx)) + // .child( + // div() + // .flex_1() + // .w_full() + // .flex() + // .flex_row() + // .overflow_hidden() + // .child(self.left_panel.clone()) + // .child(div().h_full().flex_1()) + // .child(self.right_panel.clone()), + // ) + // .child(statusbar::statusbar(cx)) + // }) } }