docs: a part's notify draws the whole window, not just the part
The records said the shell's parts draw only when what they show changed. In gpui-pre 0.3.10 a child view embedded with .child(entity) is rendered on every frame (only Entity::cached and AnyView::cached reuse a subtree), so a part that is told tells the window, and the window draws every part. Correct the shell section of docs/ui.md, the status paragraph of the spikes report and the module comments of the shell and the root state, and add to "For the next slices" the gate's notes: heavy panes cached and Update.refresh turned into per-area signals, Update.reloaded ignored and img() caching by path, SettingChanged for audio and playback not reloaded. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d32ac25f0
commit
7c0f385f2f
8 files changed
+53
-14
No files matched your search
@@ -21,7 +21,7 @@
|
||||
//!
|
||||
//! The root notifies on every batch of events and on every move of the user's;
|
||||
//! it is the views (`crate::shell`) that decide whether what they show changed
|
||||
//! and draw again only then. What a transition asks for besides the state
|
||||
//! and tell the window only then (the window draws every part). What a transition asks for besides the state
|
||||
//! (`Update`) is carried out as far as this front end has the parts: the
|
||||
//! engine's commands go out, the status line is set, what is to be kept goes
|
||||
//! to the store, a setting the theme follows is applied and the warnings are
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! empty page: the "no server selected" state with the way to add one, and for
|
||||
//! a server on screen its name, address and state with the buttons that
|
||||
//! connect, disconnect and edit it. An entity of its own: it observes the root
|
||||
//! state and draws again only when what it shows changed.
|
||||
//! state and tells the window only when what it shows changed.
|
||||
|
||||
use gpui_kit::component::button::{Button, ButtonVariants as _};
|
||||
use gpui_kit::prelude::FluentBuilder as _;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
//! The desktop shell of the GPUI front end (`ui/shells/desktop.slint` and
|
||||
//! the server callbacks of `bind/servers.rs`): the server rail, the top bar,
|
||||
//! the sidebar, the main area, the server form and the toast, each an entity
|
||||
//! that observes the root state ([`crate::app::AppState`]) and draws again
|
||||
//! only when what it shows changed, and the actions the user's moves are
|
||||
//! ([`actions`]). [`crate::view::MainView`] puts them in the window.
|
||||
//! that observes the root state ([`crate::app::AppState`]) and tells the window
|
||||
//! only when what it shows changed (the window then draws every part), and the
|
||||
//! actions the user's moves are ([`actions`]). [`crate::view::MainView`] puts
|
||||
//! them in the window.
|
||||
|
||||
pub mod actions;
|
||||
mod form;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! The server rail: the saved servers as avatars with their state, the
|
||||
//! selection, the add-server button and the settings button (`ServerRail` of
|
||||
//! `ui/shells/desktop.slint`). An entity of its own: it observes the root
|
||||
//! state and draws again only when the servers it lists changed.
|
||||
//! state and tells the window only when the servers it lists changed.
|
||||
|
||||
use gpui_kit::prelude::FluentBuilder as _;
|
||||
use gpui_kit::{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! `shells/common.slint`): the server on screen, the place of its channel tree
|
||||
//! (the next slice), the voice card while voice is connecting or connected, and
|
||||
//! the user's own card with the voice buttons. An entity of its own: it
|
||||
//! observes the root state and draws again only when what it shows changed.
|
||||
//! observes the root state and tells the window only when what it shows changed.
|
||||
|
||||
use gpui_kit::prelude::FluentBuilder as _;
|
||||
use gpui_kit::{
|
||||
|
||||
@@ -234,8 +234,10 @@ fn report(app: &Entity<AppState>, window: &Window, cx: &mut App) {
|
||||
|
||||
impl Render for MainView {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
// One render of the window is one frame: the parts draw when they are
|
||||
// told, and the window is drawn when one was.
|
||||
// One render of the window is one frame. A part that has something new
|
||||
// tells the window, and the window then renders every part (gpui-pre
|
||||
// renders each uncached child view on every frame); a window nobody
|
||||
// tells is not drawn.
|
||||
self.counters.renders.incr();
|
||||
let theme = VoelinTheme::global(cx).clone();
|
||||
let (c, m) = (&theme.colors, &theme.metrics);
|
||||
|
||||
@@ -37,8 +37,9 @@ the slices that meet them are in docs/ui.md, "For the next slices". Item 5, the
|
||||
desktop shell, is slice 1 of the step's list and landed on `phase5/gpui-shell`
|
||||
(2026-10-27): the store at start (the client's database, the settings with the
|
||||
UI's keys, the secrets, the default identity), the server rail, the sidebar,
|
||||
the top bar and the main area as entities that draw when what they show
|
||||
changed, the eleven callbacks of `bind/servers.rs` as actions through
|
||||
the top bar and the main area as entities that tell the window when what they
|
||||
show changed (the window then draws every part: gpui-pre 0.3.10 renders every
|
||||
uncached child view on every frame), the eleven callbacks of `bind/servers.rs` as actions through
|
||||
`voelin-ui-vm`'s logic and the engine's commands, the window's size and
|
||||
position kept in `ui.window`, the engine-event task in steps and a tick that
|
||||
draws nothing. What it shows, what it costs idle and what it leaves to the
|
||||
|
||||
+38
-3
@@ -1141,9 +1141,15 @@ is the server form.
|
||||
What is on screen, each part an entity of `crates/voelin-gpui/src/shell/` that
|
||||
observes the root state, makes its view of it (`voelin_ui_vm::servers::logic`:
|
||||
`rail`, `toolbar`) and tells the window only when the view differs from the one
|
||||
it showed: an engine event about a talker, a setting that is not the theme's or
|
||||
a tick draws nothing (the `what_changes_nothing_shown_draws_nothing` test counts
|
||||
the parts told).
|
||||
it showed (`cx.notify()`): an engine event about a talker, a setting that is not
|
||||
the theme's or a tick tells no part, so the window is not drawn at all (the
|
||||
`what_changes_nothing_shown_draws_nothing` test counts the parts told). A part
|
||||
that is told tells the window, and **the window draws every part**: in gpui-pre
|
||||
0.3.10 a child view embedded with `.child(entity)` is rendered again on every
|
||||
frame (only `Entity::cached` and `AnyView::cached`, which need a definite size,
|
||||
reuse a subtree until its entity is notified), so the parts' comparison saves the
|
||||
frames of a window nobody changes, not the work inside a frame ("For the next
|
||||
slices" says what the heavy panes do about it).
|
||||
|
||||
- **The rail** (`rail.rs`): the app's mark, then the saved servers as 46 pixel
|
||||
rounded squares (the server's icon from the engine's cache, else its initials
|
||||
@@ -1358,6 +1364,35 @@ entries); the in-window keys as GPUI key bindings and the global ones through
|
||||
What the foundation's review and the Opus gate (2026-10-27) found and left to
|
||||
the slices that meet it; none of it is a defect of what exists today.
|
||||
|
||||
- **A part's notify draws the whole window, and `Update.refresh` is not used
|
||||
yet.** The root notifies on every batch and each part compares the whole view
|
||||
it would show with the one it showed; a part that differs tells the window,
|
||||
and the window renders every uncached child view (gpui-pre 0.3.10: only
|
||||
`Entity::cached` and `AnyView::cached` skip one). With a rail, a sidebar and a
|
||||
top bar that costs little; the channel tree and the members of slice 2 (and
|
||||
later the chat's list and the stream tiles) are heavy, and one talker's
|
||||
indicator must not render the rail and the chat. Slice 2 embeds the heavy panes
|
||||
with `Entity::cached` (a definite size is needed: the pane's bounds come from
|
||||
its place in the layout) and turns `Update.refresh` (`voelin_ui_vm::host::
|
||||
Refresh`: `servers`, `toolbar`, `tree`, `chat`, ...; `perform` drops it today)
|
||||
into per-area signals, a generation or a flag per pane that its entity
|
||||
observes, so that a change of the tree or the members notifies those panes and
|
||||
not the rail and the chat.
|
||||
- **`Update.reloaded` is ignored, and `img()` caches by path.** `perform` drops
|
||||
`Update.reloaded` (the pictures the engine wrote again, whose decoded copies a
|
||||
front end drops). GPUI's `img()` caches what it decoded per source in the
|
||||
asset cache, so a picture rewritten into the same cache file (a server icon or
|
||||
an avatar that changed) stays stale on screen. The slice that shows engine
|
||||
pictures (slice 2: avatars, the tree's icons) drops the decoded copy for each
|
||||
path of `reloaded` (`ImageSource::remove_asset`, and `drop_image` for what the
|
||||
atlas holds) or keys the image by something that changes with the file.
|
||||
- **`SettingChanged` for the audio and the playback keys is not reloaded.**
|
||||
`AppState::setting_changed` follows `ui.theme` and `ui.font_scale` only; the
|
||||
Slint front end also reloads `audio` (unless the page has unsaved edits) and
|
||||
`client_playback`, the crash-reports flag and the decoder keys. The values the
|
||||
window keeps copies of (`vm.audio`, `vm.playback`) go stale when a command,
|
||||
the config file or another window changes them; the settings slice (5) adds
|
||||
the reload with the page that shows them.
|
||||
- **Settled by the shell slice: the engine-event task and the tick.** The task
|
||||
takes what is queued (64 events at most) in one `update` with one
|
||||
`cx.notify()` and yields between steps, and the tick notifies nobody (the
|
||||
|
||||
Reference in new issue
Block a user