//! Application composition: shared services live in a GPUI Global, while each //! CodexGui assembles one window's views and presentation state. mod bootstrap; mod windows; use crate::{ controllers::WorkspaceController, gui::{SourceRegistry, Workbench}, }; use gpui::{ Context, Entity, Global, IntoElement, Render, Subscription, Task, Window, WindowHandle, }; use gpui_component::Root; pub(crate) use windows::{TabContent, init, open_window, reopen}; /// Strong application ownership survives the destruction of every window. pub(crate) struct ApplicationServices(pub Entity); impl Global for ApplicationServices {} pub(crate) struct AppServices { workspace: Entity, sources: Entity, pub(crate) appearance: Entity, window_title: &'static str, windows: Vec>, _url_task: Task<()>, _subscriptions: Vec, } /// A window's composition. Connections and controllers belong to AppServices. pub struct CodexGui { workbench: Entity, _subscriptions: Vec, } impl Render for CodexGui { fn render(&mut self, _: &mut Window, _: &mut Context) -> impl IntoElement { self.workbench.clone() } }